ObjectAttributes
Attributes (color, material, layer,…) associated with a rhino object
Inheritance Hierarchy
System.Object
Rhino.Runtime.CommonObject
Rhino.DocObjects.ObjectAttributes
Namespace: Rhino.DocObjects
Assembly: RhinoCommon (in RhinoCommon.dll)
Syntax
[SerializableAttribute]public class ObjectAttributes : CommonObject
The ObjectAttributes type exposes the following members.
Constructors
Name
Description
Public Method
ObjectAttributes.
Initializes a new instance of the ObjectAttributes class
Protected Method
ObjectAttributes(SerializationInfo, StreamingContext)
Initializes a new instance of the ObjectAttributes class
Properties
Name
Description
Public Property
CastsShadows
Gets or sets an object’s casts shadows property, or whether or not an object casts shadows on other objects and a ground plane.
Public Property
ClippingPlaneLabelStyle
Defines how a label for a clipping plane object should be shown
Public Property
Code Example
ColorSource
The color used to display an object is specified in one of three ways. If ColorSource is ON::color_from_layer, then the object’s layer ON_Layer::Color() is used. If ColorSource is ON::color_from_object, then value of m_color is used. If ColorSource is ON::color_from_material, then the diffuse color of the object’s render material is used. See ON_3dmObjectAttributes::MaterialSource() to determine where to get the definition of the object’s render material.
Public Property
CustomMeshingParameters
Returns or sets the per-object render meshing parameters, which controls the object’s render mesh density. If this property is null, then the object uses the document’s render meshing parameters. To remove the per-object render meshing parameters, set this property to null.
Public Property
Decals
Gets all object decals associated with this object.
Public Property
Code Example
DisplayOrder
Display order used to force objects to be drawn on top or behind each other. Larger numbers draw on top of smaller numbers.
0 = draw object in standard depth buffered order
<0 = draw object behind “normal” draw order objects
\>0 = draw object on top of “normal” draw order objects
Public Property
Disposed
Indicates if this object has been disposed or the document it originally belonged to has been disposed.
(Inherited from CommonObject.)
Public Property
File3dmMeshModifiers
Get an object that provides access to mesh modifiers when the attributes is for a File3dmObject.
Public Property
GroupCount
number of groups object belongs to.
Public Property
HasMapping
A mapping from any plug-in source is associated with these attributes Need to do this here to respond correctly to ModifyObjectAttributes event
Public Property
HasUserData
Gets true if this class has any custom information attached to it through UserData.
(Inherited from CommonObject.)
Public Property
HatchBackgroundFillColor
Fill color for hatches (default is Color.Empty)
Public Property
HatchBoundaryVisible
Draw the bounrdaries for a hatch (default is false)
Public Property
IsDocumentControlled
(Overrides
CommonObject.IsDocumentControlled
.)Public Property
IsInstanceDefinitionObject
Use this query to determine if an object is part of an instance definition.
Public Property
IsValid
Tests an object to see if it is valid.
(Inherited from CommonObject.)
Public Property
Code Example
LayerIndex
Gets or sets an associated layer index.
Layer definitions in an OpenNURBS model are stored in a layer table. The layer table is conceptually an array of ON_Layer classes. Every OpenNURBS object in a model is on some layer. The object’s layer is specified by zero based indices into the ON_Layer array.
Public Property
LinetypeIndex
Gets or sets the linetype index.
Linetype definitions in an OpenNURBS model are stored in a linetype table. The linetype table is conceptually an array of ON_Linetype classes. Every OpenNURBS object in a model references some linetype. The object’s linetype is specified by zero based indices into the ON_Linetype array.
Index 0 is reserved for continuous linetype (no pattern).
Public Property
LinetypePatternScale
Per object linetype scale
Public Property
LinetypeSource
The Linetype used to display an object is specified in one of two ways. If LinetypeSource is ON::linetype_from_layer, then the object’s layer ON_Layer::Linetype() is used. If LinetypeSource is ON::linetype_from_object, then value of m_linetype is used.
Public Property
MaterialIndex
Gets or sets the material index.
If you want something simple and fast, set the index of the rendering material.
Public Property
MaterialRefs
If you are developing a high quality plug-in renderer, and a user is assigning a custom render material to this object, then add rendering material information to the MaterialRefs dictionary. Note to developers: As soon as the MaterialRefs dictionary contains items rendering material queries slow down. Do not populate the MaterialRefs dictionary when setting the MaterialIndex will take care of your needs.
Public Property
MaterialSource
Determines if the simple material should come from the object or from it’s layer. High quality rendering plug-ins should use m_rendering_attributes.
Public Property
Mode
An object must be in one of three modes: normal, locked or hidden. If an object is in normal mode, then the object’s layer controls visibility and selectability. If an object is locked, then the object’s layer controls visibility by the object cannot be selected. If the object is hidden, it is not visible and it cannot be selected.
Public Property
Name
Gets or sets an object optional text name.
More than one object in a model can have the same name and some objects may have no name.
Public Property
Code Example
ObjectColor
If ON::color_from_object == ColorSource, then color is the object’s display color.
Public Property
ObjectDecoration
Used to indicate an object has a decoration (like an arrowhead on a curve)
Public Property
ObjectId
Every object has a Guid (globally unique identifier, also known as UUID, or universally unique identifier). The default value is Guid.Empty.
When an object is added to a model, the value is checked. If the value is Guid.Empty, a new Guid is created. If the value is not null but it is already used by another object in the model, a new Guid is created. If the value is not Guid.Empty and it is not used by another object in the model, then that value persists. When an object is updated, by a move for example, the value of ObjectId persists.
This value is the same as the one returned by object.Id.
Public Property
Static Member
OCSMappingChannelId
The mapping channel id to use when calling MappingChannel to retrieve the OCS mapping if there is one.
Public Property
PlotColor
If plot_color_from_object == PlotColorSource, then PlotColor is the object’s plotting color.
Public Property
PlotColorSource
The color used to plot an object on paper is specified in one of three ways. If PlotColorSource is ON::plot_color_from_layer, then the object’s layer ON_Layer::PlotColor() is used. If PlotColorSource is ON::plot_color_from_object, then value of PlotColor() is used.
Public Property
PlotWeight
Plot weight in millimeters. =0.0 means use the default width <0.0 means don’t plot (visible for screen display, but does not show on plot)
Public Property
PlotWeightSource
Public Property
ReceivesShadows
Gets or sets an object’s receives shadows property, or whether or not an object receives shadows from other objects.
Public Property
RenderMaterial
Sets the render material for the object - higher level function for setting MaterialSource and MaterialIndex
Public Property
SectionAttributesSource
Where section attributes are read from
Public Property
Space
Starting with V4, objects can be in either model space or page space. If an object is in page space, then ViewportId is not nil and identifies the page it is on.
Public Property
Url
Objects may have an URL. There are no restrictions on what value this URL may have. As an example, if the object came from a commercial part library, the URL might point to the definition of that part.
Public Property
UserData
List of custom information that is attached to this class.
(Inherited from CommonObject.)
Public Property
UserDictionary
Dictionary of custom information attached to this class. The dictionary is actually user data provided as an easy to use shareable set of information.
(Inherited from CommonObject.)
Public Property
UserStringCount
Public Property
ViewportId
If ViewportId is nil, the object is active in all viewports. If ViewportId is not nil, then this object is only active in a specific view. This field is primarily used to assign page space objects to a specific page, but it can also be used to restrict model space to a specific view.
Public Property
Visible
Gets or sets an object’s visibility.
Public Property
Code Example
WireDensity
When a surface object is displayed in wireframe, this controls how many isoparametric wires are used. value number of isoparametric wires -1 boundary wires (off) 0 boundary and knot wires 1 boundary and knot wires and, if there are no interior knots, a single interior wire. N>=2 boundary and knot wires and (N+1) interior wires.
Methods
Name
Description
Public Method
AddHideInDetailOverride
Make this object hidden in a given detail
Public Method
AddToGroup
Adds object to the group with specified index by appending index to group list.
If the object is already in group, nothing is changed.
Public Method
ComputedPlotColor(RhinoDoc)
Public Method
ComputedPlotColor(RhinoDoc, Guid)
Public Method
ComputedPlotWeight(RhinoDoc)
Public Method
ComputedPlotWeight(RhinoDoc, Guid)
Protected Method
ConstructConstObject
Assigns a parent object and a sub-object index to this.
(Inherited from CommonObject.)
Public Method
DeleteAllUserStrings
Public Method
DeleteUserString
Public Method
Dispose.
Actively reclaims unmanaged resources that this instance uses.
(Inherited from CommonObject.)
Protected Method
Dispose(Boolean)
For derived class implementers.
This method is called with argument true when class user calls Dispose(), while with argument false when the Garbage Collector invokes the finalizer, or Finalize() method.
You must reclaim all used unmanaged resources in both cases, and can use this chance to call Dispose on disposable fields if the argument is true.
Also, you must call the base virtual method within your overriding method.
(Inherited from CommonObject.)
Public Method
DrawColor(RhinoDoc)
Gets an object’s draw color, which is based on the object’s color source
Public Method
DrawColor(RhinoDoc, Guid)
Gets an object’s draw color, which is based on the object’s color source
Public Method
Duplicate
Constructs a copy of this ObjectAttributes instance.
Public Method
EnsurePrivateCopy
If you want to keep a copy of this class around by holding onto it in a variable after a command completes, call EnsurePrivateCopy to make sure that this class is not tied to the document. You can call this function as many times as you want.
(Inherited from CommonObject.)
Public Method
Equals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Protected Method
Finalize
Passively reclaims unmanaged resources when the class user did not explicitly call Dispose().
(Inherited from CommonObject.)
Public Method
GetCustomLinetype
Get an optional custom linetype associated with these attributes. If null, then the attributes use the linetype index to determine it’s linetype
Public Method
GetCustomSectionStyle
Get an optional custom section style associated with these attributes.
Public Method
GetDisplayModeOverride
Returns the id of the display mode of an objects. Object display modes are view based. Thus, it is possible to have an object display different in different views.
Public Method
GetGroupList
Returns an array of GroupCount group indices. If GroupCount is zero, then GetGroupList() returns null.
Public Method
GetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public Method
GetHideInDetailOverrides
Get list of details that this object is supposed to be hidden in
Public Method
GetObjectData
Populates a System.Runtime.Serialization.SerializationInfo with the data needed to serialize the target object.
(Inherited from CommonObject.)
Public Method
GetType
Gets the Type of the current instance.
(Inherited from Object.)
Public Method
GetUserString
Gets a user string.
Public Method
GetUserStrings
Gets an independent copy of the collection of (user text key, user text value) pairs attached to this object.
Public Method
Code Example
HasDisplayModeOverride
Determines if an object has a display mode override for a given viewport.
Public Method
HasHideInDetailOverrideSet
Is this object supposed to be hidden in a given detail
Public Method
IsInGroup
Determines if an object belong to a group or not.
Public Method
IsValidWithLog
Determines if an object is valid. Also provides a report on errors if this object happens not to be valid.
(Inherited from CommonObject.)
Protected Method
MemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Protected Method
NonConstOperation
For derived classes implementers.
Defines the necessary implementation to free the instance from being constant.
(Inherited from CommonObject.)
Public Method
ObjectFrame
Protected Method
OnSwitchToNonConst
Is called when a non-constant operation first occurs.
(Inherited from CommonObject.)
Public Method
RemoveCustomLinetype
Public Method
RemoveCustomSectionStyle
Public Method
RemoveDisplayModeOverride.
By default, objects are drawn using the display mode of the viewport that the object is being drawn in. Setting a specific display mode, instructs Rhino to always use that display mode, regardless of the viewport’s mode. This function resets an object to use the viewport’s display mode for all viewports.
Public Method
Code Example
RemoveDisplayModeOverride(Guid)
By default, objects are drawn using the display mode of the viewport that the object is being drawn in. Setting a specific display mode, instructs Rhino to always use that display mode, regardless of the viewport’s mode. This function resets an object to use the viewport’s display mode.
Public Method
RemoveFromAllGroups
Removes object from all groups.
Public Method
RemoveFromGroup
removes object from the group with specified index.
If the object is not in the group, nothing is changed.
Public Method
RemoveHideInDetailOverride
Remove hidden in detail flag for a specific detail
Public Method
SetCustomLinetype
Public Method
SetCustomSectionStyle
Public Method
SetDisplayModeOverride(DisplayModeDescription)
By default, objects are drawn using the display mode of the viewport that the object is being drawn in. Setting a specific display mode, instructs Rhino to always use that display mode, regardless of the viewport’s mode. This version affects the object’s display mode for all viewports.
Public Method
Code Example
SetDisplayModeOverride(DisplayModeDescription, Guid)
By default, objects are drawn using the display mode of the viewport that the object is being drawn in. Setting a specific display mode, instructs Rhino to always use that display mode, regardless of the viewport’s mode. This version sets a display mode for a specific viewport.
Public Method
SetObjectFrame(Plane)
Public Method
SetObjectFrame(Transform)
Public Method
SetUserString
Attach a user string (key,value combination) to this geometry.
Public Method
ToJSON
Create a JSON string representation of this object
(Inherited from CommonObject.)
Public Method
ToString
Returns a string that represents the current object.
(Inherited from Object.)
Public Method
Transform
Apply a transformation.