ObjectAttributes

CommonObjectReferences
Attributes (color, material, layer,...) associated with a rhino object

Constructors

ObjectAttributes

#Since v5.0
public ObjectAttributes()

ObjectAttributes

#
protected ObjectAttributes()

Properties

CastsShadows

#Since v6.0
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 bool CastsShadows { get; set; }

ClippingPlaneLabelStyle

#Since v8.0
Defines how a label for a clipping plane object should be shown
public SectionLabelStyle ClippingPlaneLabelStyle { get; set; }

ColorSource

#ExampleSince v5.0
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 ObjectColorSource ColorSource { get; set; }

CustomMeshingParameters

#Since v7.6
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 MeshingParameters CustomMeshingParameters { get; set; }

Decals

#Since v5.10
Gets all object decals associated with this object.
public Decals Decals { get; }

DetailBackgroundVisible

#Since v9.0
Should the background color show for a detail
public bool DetailBackgroundVisible { get; set; }

DisplayOrder

#ExampleSince v5.10
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 int DisplayOrder { get; set; }

Disposed

Indicates if this object has been disposed or the document it originally belonged to has been disposed.
public bool Disposed { get; }
inherited fromCommonObject

EnableCustomMeshingParameters

#Since v9.0
En/disables the custom meshing parameters enabled state.
public bool EnableCustomMeshingParameters { get; set; }

File3dmMeshModifiers

#Since v8.0
Get an object that provides access to mesh modifiers when the attributes is for a File3dmObject.
public File3dmMeshModifiers File3dmMeshModifiers { get; }

GroupCount

#Since v5.0
number of groups object belongs to.
public int GroupCount { get; }

HasMapping

#Since v5.10
A mapping from any plug-in source is associated with these attributes Need to do this here to respond correctly to ModifyObjectAttributes event
public bool HasMapping { get; }

HasUserData

Gets true if this class has any custom information attached to it through UserData.
public bool HasUserData { get; }
inherited fromCommonObject

HatchBackgroundFillColor

#Since v8.0
Fill color for hatches (default is Color.Empty)
public Color HatchBackgroundFillColor { get; set; }

HatchBackgroundFillPrintColor

#Since v9.0
Fill color for hatches when printing (default is Color.Empty)
public Color HatchBackgroundFillPrintColor { get; set; }

HatchBoundaryColor

#Since v9.0
Hatch boundary color override. Default is unset color which means use the standard attributes and layer colors to determine the boundary color
public Color HatchBoundaryColor { get; set; }

HatchBoundaryColorSource

#Since v9.0
Source for the hatch boundary display color. Determines whether the boundary color is read from the layer, from the object's main attribute color, inherited from the parent, or read from the custom override color set by HatchBoundaryColor (ColorCustom).
public ItemColorSource HatchBoundaryColorSource { get; set; }

HatchBoundaryPlotColor

#Since v9.0
Hatch boundary plot color override. Default is unset color which means use the standard attributes and layer colors to determine the boundary color
public Color HatchBoundaryPlotColor { get; set; }

HatchBoundaryPlotColorSource

#Since v9.0
Source for the hatch boundary plot/print color. Determines whether the boundary plot color is read from the layer, from the object's main attribute color, inherited from the parent, or read from the custom override color set by HatchBoundaryPlotColor (ColorCustom).
public ItemColorSource HatchBoundaryPlotColorSource { get; set; }

HatchBoundaryPlotWeightMillimeters

#Since v9.0
Plot width of hatch boundary curves. values less than -1 (-10 is default): plot weight is determined by the m_plot_weight -1: do not plot 0: use default weight defined by the print dialog positive values are thicknesses in millimeters to print to
public double HatchBoundaryPlotWeightMillimeters { get; set; }

HatchBoundaryVisible

#Since v8.0
Draw the bounrdaries for a hatch (default is false)
public bool HatchBoundaryVisible { get; set; }

IsDocumentControlled

#Since v5.0
public override bool IsDocumentControlled { get; }

IsInstanceDefinitionObject

#Since v5.0
Use this query to determine if an object is part of an instance definition.
public bool IsInstanceDefinitionObject { get; }

IsValid

Tests an object to see if it is valid.
public virtual bool IsValid { get; }
inherited fromCommonObject

LayerIndex

#ExampleSince v5.0
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 int LayerIndex { get; set; }

LinetypeIndex

#Since v5.0
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 int LinetypeIndex { get; set; }

LinetypePatternScale

#Since v8.0
Per object linetype scale
public double LinetypePatternScale { get; set; }

LinetypeSource

#Since v5.0
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 ObjectLinetypeSource LinetypeSource { get; set; }

MaterialIndex

#Since v5.0
Gets or sets the material index.

If you want something simple and fast, set the index of the rendering material.

public int MaterialIndex { get; set; }
RenderMaterial

MaterialRefs

#Since v5.10
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 MaterialRefs MaterialRefs { get; }

MaterialSource

#Since v5.0
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 ObjectMaterialSource MaterialSource { get; set; }
RenderMaterial

Mode

#Since v5.0
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 ObjectMode Mode { get; set; }

Name

#Since v5.0
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 string Name { get; set; }

ObjectColor

#ExampleSince v5.0
If ON::color_from_object == ColorSource, then color is the object's display color.
public Color ObjectColor { get; set; }

ObjectDecoration

#Since v5.0
Used to indicate an object has a decoration (like an arrowhead on a curve)
public ObjectDecoration ObjectDecoration { get; set; }

ObjectId

#Since v5.0
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 Guid ObjectId { get; set; }

OCSMappingChannelId

#Since v7.17
The mapping channel id to use when calling MappingChannel to retrieve the OCS mapping if there is one.
public static int OCSMappingChannelId { get; }
The mapping channel id to use when calling MappingChannel to retrieve the OCS mapping if there is one.

PlotColor

#Since v5.0
If plot_color_from_object == PlotColorSource, then PlotColor is the object's plotting color.
public Color PlotColor { get; set; }

PlotColorSource

#Since v5.0
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 ObjectPlotColorSource PlotColorSource { get; set; }

PlotWeight

#Since v5.0
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 double PlotWeight { get; set; }

PlotWeightSource

#Since v5.0
public ObjectPlotWeightSource PlotWeightSource { get; set; }

ReceivesShadows

#Since v6.0
Gets or sets an object's receives shadows property, or whether or not an object receives shadows from other objects.
public bool ReceivesShadows { get; set; }

RenderMaterial

#Since v7.8
Sets the render material for the object - higher level function for setting MaterialSource and MaterialIndex
public RenderMaterial RenderMaterial { set; }

SectionAttributesSource

#Since v8.0
Where section attributes are read from
public ObjectSectionAttributesSource SectionAttributesSource { get; set; }

SectionStyleIndex

#Since v9.0
Gets or sets the section style index.
public int SectionStyleIndex { get; set; }

Space

#Since v5.0
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 ActiveSpace Space { get; set; }

Url

#Since v6.8
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 string Url { get; set; }

UserData

List of custom information that is attached to this class.
public UserDataList UserData { get; }
inherited fromCommonObject

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.
public ArchivableDictionary UserDictionary { get; }
inherited fromCommonObject

UserStringCount

#Since v5.0
public int UserStringCount { get; }

ViewportId

#Since v5.0
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 Guid ViewportId { get; set; }

Visible

#Since v5.0
Gets or sets an object's visibility.
public bool Visible { get; set; }

WireDensity

#ExampleSince v5.0
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.
public int WireDensity { get; set; }

Methods

AddActiveInViewportOverride

#Since v9.0
public bool AddActiveInViewportOverride(
viewportId,
active
)

AddHideInDetailOverride

#Since v6.1
Make this object hidden in a given detail
public bool AddHideInDetailOverride(
detailId
)

AddToGroup

#Since v5.0
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 void AddToGroup(
groupIndex
The index that will be added.
)

ClearRenderingAttributes

#Since v8.28
Clears, or resets the rendering attributes.
public void ClearRenderingAttributes()

ComputedPlotColor

#Since v5.6
public Color ComputedPlotColor(
document,
viewportId
)

ComputedPlotColor

#Since v5.6
public Color ComputedPlotColor(
document
)

ComputedPlotWeight

#Since v5.6
public double ComputedPlotWeight(
document,
viewportId
)

ComputedPlotWeight

#Since v5.6
public double ComputedPlotWeight(
document
)

ComputedSectionStyle

#Since v9.0
public SectionStyle ComputedSectionStyle(
doc,
sectionerAttributes,
computeColors,
viewport_id
)

ConstructConstObject

Assigns a parent object and a sub-object index to this.
protected void ConstructConstObject(
parentObject,
The parent object.
subobjectIndex
The sub-object index.
)
inherited fromCommonObject

DeleteAllUserStrings

#Since v6.0
public void DeleteAllUserStrings()

DeleteUserString

#Since v6.0
public bool DeleteUserString(
key
)

Dispose

Actively reclaims unmanaged resources that this instance uses.
public void Dispose()
inherited fromCommonObject

Dispose

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.

protected virtual void Dispose(
disposing
true if the call comes from the Dispose() method; false if it comes from the Garbage Collector finalizer.
)
inherited fromCommonObject

DrawColor

#Since v9.1
Gets the draw color of an object in a file, which is based on the object's color source. See DrawColor(File3dm).
public Color DrawColor(
file,
The file that contains the object's layer and material.
viewportId
The id of the viewport, for a layer's per-viewport color.
)
The draw color.

DrawColor

#Since v9.1
Gets the draw color of an object in a file, which is based on the object's color source: the layer's color, the object's color, or the color of its material (the base color of a physically based material, else the diffuse color). Unlike the document overload in Rhino, black and white are never switched to suit a viewport background.
public Color DrawColor(
file
The file that contains the object's layer and material.
)
The draw color.

DrawColor

#Since v5.0
Gets an object's draw color, which is based on the object's color source
public Color DrawColor(
document,
The object's documnt.
viewportId
The id of the viewport.
)
The draw color.

DrawColor

#Since v5.0
Gets an object's draw color, which is based on the object's color source
public Color DrawColor(
document
The object's documnt.
)
The draw color.

Duplicate

#Since v5.0
Constructs a copy of this ObjectAttributes instance.
public ObjectAttributes Duplicate()
A new instance on success, or null on failure.

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.
public void EnsurePrivateCopy()
inherited fromCommonObject

GetActiveInViewportOverrides

#Since v9.0
public bool GetActiveInViewportOverrides(
out Guid[]
viewportIds,
out bool
active
)

GetCustomLinetype

#Since v8.0
Get an optional custom linetype associated with these attributes. If null, then the attributes use the linetype index to determine it's linetype
public Linetype GetCustomLinetype()

GetCustomSectionStyle

#Since v8.0
Get an optional custom section style associated with these attributes.
public SectionStyle GetCustomSectionStyle()

GetDisplayModeOverride

#Since v6.18
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 Guid GetDisplayModeOverride(
viewportId
Id of a Rhino Viewport.
)
A display node id if the object has a display mode override for the viewport; otherwise Guid.Empty is returned.

GetGroupList

#Since v5.0
Returns an array of GroupCount group indices. If GroupCount is zero, then GetGroupList() returns null.
public int[] GetGroupList()
An array of group indices. null might be returned in place of an empty array.

GetHideInDetailOverrides

#Since v6.1
Get list of details that this object is supposed to be hidden in
public Guid[] GetHideInDetailOverrides()

GetObjectData

Populates a System.Runtime.Serialization.SerializationInfo with the data needed to serialize the target object.
[SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.SerializationFormatter)] public virtual void GetObjectData(
info,
The System.Runtime.Serialization.SerializationInfo to populate with data.
context
The destination (see System.Runtime.Serialization.StreamingContext) for this serialization.
)
inherited fromCommonObject

GetUserString

#Since v5.0
Gets a user string.
public string GetUserString(
key
id used to retrieve the string.
)
string associated with the key if successful. null if no key was found.

GetUserStrings

#Since v5.0
Gets an independent copy of the collection of (user text key, user text value) pairs attached to this object.
public NameValueCollection GetUserStrings()
A collection of key strings and values strings. This

HasActiveInViewportOverride

#Since v9.0
public bool HasActiveInViewportOverride(
viewportId,
out bool
active
)

HasDisplayModeOverride

#ExampleSince v5.0
Determines if an object has a display mode override for a given viewport.
public bool HasDisplayModeOverride(
viewportId
Id of a Rhino Viewport.
)
true if the object has a display mode override for the viewport; otherwise, false.

HasHideInDetailOverrideSet

#Since v6.1
Is this object supposed to be hidden in a given detail
public bool HasHideInDetailOverrideSet(
detailId
)

IsInGroup

#Since v8.11
Determines if an object belong to a group or not.
public bool IsInGroup(
groupIndex
The index that will be tested.
)

IsValidWithLog

Determines if an object is valid. Also provides a report on errors if this object happens not to be valid.
public bool IsValidWithLog(
out string
log
A textual log. This out parameter is assigned during this call.
)
inherited fromCommonObject
true if this object is valid; false otherwise.

NonConstOperation

For derived classes implementers.

Defines the necessary implementation to free the instance from being constant.

protected virtual void NonConstOperation()
inherited fromCommonObject

ObjectFrame

#Since v8.0
public Plane ObjectFrame()

OnSwitchToNonConst

Is called when a non-constant operation first occurs.
protected virtual void OnSwitchToNonConst()
inherited fromCommonObject

RemoveActiveInViewportOverride

#Since v9.0
public bool RemoveActiveInViewportOverride(
viewportId,
active
)

RemoveCustomLinetype

#Since v8.0
public void RemoveCustomLinetype()

RemoveCustomSectionStyle

#Since v8.0
public void RemoveCustomSectionStyle()

RemoveDisplayModeOverride

#Since v5.0
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 void RemoveDisplayModeOverride()

RemoveDisplayModeOverride

#ExampleSince v5.0
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 void RemoveDisplayModeOverride(
rhinoViewportId
viewport that display mode overrides should be cleared from.
)

RemoveFromAllGroups

#Since v5.0
Removes object from all groups.
public void RemoveFromAllGroups()

RemoveFromGroup

#Since v5.0
removes object from the group with specified index.

If the object is not in the group, nothing is changed.

public void RemoveFromGroup(
groupIndex
The index that will be removed.
)

RemoveHideInDetailOverride

#Since v6.1
Remove hidden in detail flag for a specific detail
public bool RemoveHideInDetailOverride(
detailId
)

SetActiveInViewportOverrides

#Since v9.0
public bool SetActiveInViewportOverrides(
Guid[]
viewportIds,
active
)

SetCustomLinetype

#Since v8.0
public void SetCustomLinetype(
linetype
)

SetCustomSectionStyle

#Since v8.0
public void SetCustomSectionStyle(
sectionStyle
)

SetDisplayModeOverride

#ExampleSince v5.0
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 bool SetDisplayModeOverride(
mode,
The display mode.
rhinoViewportId
The Rhino viewport ID.
)
true on success.

SetDisplayModeOverride

#Since v5.0
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 bool SetDisplayModeOverride(
mode
The display mode.
)
true if setting was successful.

SetObjectFrame

#Since v8.0
public void SetObjectFrame(
plane
)

SetObjectFrame

#Since v8.0
public void SetObjectFrame(
xform
)

SetUserString

#Since v5.0
Attach a user string (key,value combination) to this geometry.
public bool SetUserString(
key,
id used to retrieve this string.
value
string associated with key. If null, the key will be removed
)
true on success.

ToJSON

Create a JSON string representation of this object
public string ToJSON()
inherited fromCommonObject

Transform

#Since v6.0
Apply a transformation.
public bool Transform(
Transform
xform
The transformation.
)
true if successful, false otherwise.