ModelComponent
Base class for all components in a model (document) and manages the index, id and other information common to this type of objects.
This class parallels the C++ ON_ModelComponent.
Inheritance Hierarchy
System.Object
Rhino.Runtime.CommonObject
Rhino.DocObjects.ModelComponent
Namespace: Rhino.DocObjects
Assembly: RhinoCommon (in RhinoCommon.dll)
Syntax
public abstract class ModelComponent : CommonObject
The ModelComponent type exposes the following members.
Properties
Name
Description
Public Property
ComponentStatus
Gets or sets the component status of the model component.
Public Property
ComponentType
Gets the ModelComponentType for this object. Useful in switch statements.
Public Property
DeletedName
Gets the name of a component that is deleted.
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
HasId
Returns a value indicating whether the component has an ID.
Public Property
HasIndex
Returns a value indicating whether the component has an Index.
Public Property
HasName
Returns a value indicating whether the component has a Name.
Public Property
HasUserData
Gets true if this class has any custom information attached to it through UserData.
(Inherited from CommonObject.)
Public Property
Id
Gets or sets the ID of the current instance.
Public Property
IdIsLocked
Returns a value indicating whether the component ID is already locked.
Public Property
Index
Gets or sets the model component index attribute.
Public Property
IndexIsLocked
Returns a value indicating whether the component Index is already locked.
Public Property
InstanceDefinitionModelSerialNumber
When a component is in a model as part of the information required for a linked instance definition, this value identifies the linked instance definition reference model.
Public Property
IsComponentStatusLocked
The component status itself can be locked. This returns an indication.
Public Property
IsDeleted
true if the component is deleted. Deleted components are kept by the document for undo purposes.
Public Property
IsDocumentControlled
If true this object may not be modified. Any properties or functions that attempt to modify this object when it is set to “IsReadOnly” will throw a NotSupportedException.
(Inherited from CommonObject.)
Public Property
IsReference
Gets a value indicting whether this component is a referenced component. Referenced components are part of referenced documents.
Public Property
IsSystemComponent
True if this model component is a system constant.
An incomplete list of system constant model components is below:
-
ON_ModelComponent::Unset
-
ON_InstanceDefinition::Empty
-
ON_Linetype::Unset
-
ON_Linetype::Continuous
-
ON_Linetype::ByLayer
-
ON_Linetype::ByParent
-
ON_Layer::Unset
-
ON_Layer::Default
-
ON_TextStyle::Unset
-
ON_TextStyle::Default
-
ON_TextStyle::ByLayer
-
ON_TextStyle::ByParent
-
ON_DimStyle::Unset
-
ON_DimStyle::Default
-
ON_DimStyle::DefaultInchDecimal
-
ON_DimStyle::DefaultInchFractional
-
ON_DimStyle::DefaultFootInchArchitecture
-
ON_DimStyle::DefaultMillimeterSmall
-
ON_DimStyle::DefaultMillimeterLarge
-
ON_DimStyle::DefaultMillimeterArchitecture
Public Property
IsValid
Tests an object to see if it is valid.
(Inherited from CommonObject.)
Public Property
ModelSerialNumber
A value identifying the model that manages this component.
Public Property
Code Example
Name
Gets or sets the name
Public Property
NameIsLocked
Returns a value indicating whether the component Name is already locked.
Public Property
Static Member
NamePathSeparator
Returns the string ”::”. This is the string Rhino uses in layer full path names to separate the names of individual layers.
Public Property
ReferenceModelSerialNumber
When a component is in a model for reference, this value identifies the reference model.
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.)
Methods
Name
Description
Public Method
ClearId
Resets the HasId property of the model component to false, if possible.
Public Method
ClearIndex
Resets the HasIndex property of the model component to false, if possible.
Public Method
ClearName
Resets the HasName property of the model component to false, if possible.
Protected Method
ConstructConstObject
Assigns a parent object and a sub-object index to this.
(Inherited from CommonObject.)
Public Method
DataCRC
Increments the Cyclic Redundancy Check value by this instance.
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
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
GetHashCode
Serves as the default hash function.
(Inherited from Object.)
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
Static Member
IsValidComponentName
Tests for a valid model component name.
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.)
Public Method
LockId
Locks the component Id property.
Public Method
LockIndex
Locks the component Index property.
Public Method
LockName
Locks the component Name property.
Protected Method
MemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public Method
Static Member
ModelComponentTypeIgnoresCase
Informs the developer if a particular model component type will require case-ignoring searching within a document. This is currently true with groups; false otherwise.
Public Method
Static Member
ModelComponentTypeIncludesParent
Informs the developer if a particular model component type will include the hash of the parent.
Public Method
Static Member
ModelComponentTypeRequiresUniqueName
Informs the developer if a particular model component type will require uniqueness within a document. This is currently true with render materials and model geometry; false otherwise.
Protected Method
NonConstOperation
For derived classes implementers.
Defines the necessary implementation to free the instance from being constant.
(Inherited from CommonObject.)
Protected Method
OnSwitchToNonConst
Is called when a non-constant operation first occurs.
(Inherited from CommonObject.)
Public Method
ToJSON
Create a JSON string representation of this object
(Inherited from CommonObject.)
Public Method
ToString
Returns the name of the model component type, and then its name and index.
(Overrides Object.ToString..)
Inheritance Hierarchy
System.Object
Rhino.Runtime.CommonObject
Rhino.DocObjects.ModelComponent
Rhino.DocObjects.BitmapEntry
Rhino.DocObjects.DimensionStyle
Rhino.DocObjects.Group
Rhino.DocObjects.HatchPattern
Rhino.DocObjects.Layer
Rhino.DocObjects.Linetype
Rhino.DocObjects.Material
Rhino.DocObjects.RhinoObject
Rhino.DocObjects.SectionStyle
Rhino.FileIO.File3dmEmbeddedFile
Rhino.FileIO.File3dmObject
Rhino.FileIO.File3dmRenderContent
Rhino.Geometry.InstanceDefinitionGeometry
Rhino.Render.TextureMapping