ObjectAttributes

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

Constructors

ObjectAttributes

#Since v5.0
public ObjectAttributes()

ObjectAttributes

#
protected ObjectAttributes(SerializationInfo info, StreamingContext context)
info (SerializationInfo)
context (StreamingContext)

Properties

CastsShadows

#Since v6.0
public bool CastsShadows { get; set; }
Gets or sets an object's casts shadows property, or whether or not an object casts shadows on other objects and a ground plane.

ClippingPlaneLabelStyle

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

ColorSource

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

CustomMeshingParameters

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

Decals

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

DetailBackgroundVisible

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

DisplayOrder

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

Disposed

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

EnableCustomMeshingParameters

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

File3dmMeshModifiers

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

GroupCount

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

HasMapping

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

HasUserData

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

HatchBackgroundFillColor

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

HatchBackgroundFillPrintColor

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

HatchBoundaryColor

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

HatchBoundaryColorSource

#Since v9.0
public ItemColorSource HatchBoundaryColorSource { get; set; }
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).

HatchBoundaryPlotColor

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

HatchBoundaryPlotColorSource

#Since v9.0
public ItemColorSource HatchBoundaryPlotColorSource { get; set; }
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).

HatchBoundaryPlotWeightMillimeters

#Since v9.0
public double HatchBoundaryPlotWeightMillimeters { get; set; }
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

HatchBoundaryVisible

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

IsDocumentControlled

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

IsInstanceDefinitionObject

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

IsValid

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

LayerIndex

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

LinetypeIndex

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

LinetypePatternScale

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

LinetypeSource

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

MaterialIndex

#Since v5.0
public int MaterialIndex { get; set; }
Gets or sets the material index.

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

MaterialRefs

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

MaterialSource

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

Mode

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

Name

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

ObjectColor

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

ObjectDecoration

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

ObjectId

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

OCSMappingChannelId

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

PlotColor

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

PlotColorSource

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

PlotWeight

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

PlotWeightSource

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

ReceivesShadows

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

RenderMaterial

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

SectionAttributesSource

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

SectionStyleIndex

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

Space

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

Url

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

UserData

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

UserDictionary

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

UserStringCount

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

ViewportId

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

Visible

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

WireDensity

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

AddActiveInViewportOverride

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

AddHideInDetailOverride

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

AddToGroup

#Since v5.0
public void AddToGroup(int groupIndex)
Adds object to the group with specified index by appending index to group list.

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

groupIndex (int)The index that will be added.

ClearRenderingAttributes

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

ComputedPlotColor

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

ComputedPlotColor

#Since v5.6
public Color ComputedPlotColor(RhinoDoc document)
document (RhinoDoc)

ComputedPlotWeight

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

ComputedPlotWeight

#Since v5.6
public double ComputedPlotWeight(RhinoDoc document)
document (RhinoDoc)

ComputedSectionStyle

#Since v9.0
public SectionStyle ComputedSectionStyle(RhinoDoc doc, ObjectAttributes sectionerAttributes, bool computeColors, Guid viewport_id)
doc (RhinoDoc)
sectionerAttributes (ObjectAttributes)
computeColors (bool)
viewport_id (Guid)

ConstructConstObject

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

DeleteAllUserStrings

#Since v6.0
public void DeleteAllUserStrings()

DeleteUserString

#Since v6.0
public bool DeleteUserString(string key)
key (string)

Dispose

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

Dispose

protected virtual void Dispose(bool disposing)
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 fromCommonObject
disposing (bool)true if the call comes from the Dispose() method; false if it comes from the Garbage Collector finalizer.

DrawColor

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

DrawColor

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

Duplicate

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

EnsurePrivateCopy

public void 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 fromCommonObject

GetActiveInViewportOverrides

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

GetCustomLinetype

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

GetCustomSectionStyle

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

GetDisplayModeOverride

#Since v6.18
public Guid GetDisplayModeOverride(Guid viewportId)
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.
viewportId (Guid)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
public int[] GetGroupList()
Returns an array of GroupCount group indices. If GroupCount is zero, then GetGroupList() returns null.
An array of group indices. null might be returned in place of an empty array.

GetHideInDetailOverrides

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

GetObjectData

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

GetUserString

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

GetUserStrings

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

HasActiveInViewportOverride

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

HasDisplayModeOverride

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

HasHideInDetailOverrideSet

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

IsInGroup

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

IsValidWithLog

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

NonConstOperation

protected virtual void NonConstOperation()
For derived classes implementers.

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

inherited fromCommonObject

ObjectFrame

#Since v8.0
public Plane ObjectFrame()

OnSwitchToNonConst

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

RemoveActiveInViewportOverride

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

RemoveCustomLinetype

#Since v8.0
public void RemoveCustomLinetype()

RemoveCustomSectionStyle

#Since v8.0
public void RemoveCustomSectionStyle()

RemoveDisplayModeOverride

#Since v5.0
public void 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.

RemoveDisplayModeOverride

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

RemoveFromAllGroups

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

RemoveFromGroup

#Since v5.0
public void RemoveFromGroup(int groupIndex)
removes object from the group with specified index.

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

groupIndex (int)The index that will be removed.

RemoveHideInDetailOverride

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

SetActiveInViewportOverrides

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

SetCustomLinetype

#Since v8.0
public void SetCustomLinetype(Linetype linetype)
linetype (Linetype)

SetCustomSectionStyle

#Since v8.0
public void SetCustomSectionStyle(SectionStyle sectionStyle)
sectionStyle (SectionStyle)

SetDisplayModeOverride

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

SetDisplayModeOverride

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

SetObjectFrame

#Since v8.0
public void SetObjectFrame(Plane plane)
plane (Plane)

SetObjectFrame

#Since v8.0
public void SetObjectFrame(Transform xform)
xform (Transform)

SetUserString

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

ToJSON

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

Transform

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