rhino3dm.ModelComponent

class rhino3dm.ModelComponent

Bases: CommonObject

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.

ClearId() → None

Resets the HasId property of the model component to false, if possible.

Raises:

InvalidOperationException – If the ID is locked.

ClearIndex() → None

Resets the HasIndex property of the model component to false, if possible.

Raises:

InvalidOperationException – If the index is locked.

ClearName() → None

Resets the HasName property of the model component to false, if possible.

Raises:

InvalidOperationException – If the name is locked.

DataCRC(currentRemainder: int) → int

Increments the Cyclic Redundancy Check value by this instance.

Parameters:

currentRemainder – The current remainder value.

Returns:

The updated remainder value.

static IsValidComponentName(name: str) → bool

Tests for a valid model component name.

Parameters:

name – The string to validate.

Returns:

true if the string is a valid model component name, false otherwise.

LockId() → None

Locks the component Id property.

LockIndex() → None

Locks the component Index property.

LockName() → None

Locks the component Name property.

static ModelComponentTypeIgnoresCase(type: ModelComponentType) → bool

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.

Parameters:

type – True if the component ignores case.

static ModelComponentTypeIncludesParent(type: ModelComponentType) → bool

Informs the developer if a particular model component type will include the hash of the parent.

Parameters:

type – True if the component includes parent hash.

static ModelComponentTypeRequiresUniqueName(type: ModelComponentType) → bool

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.

Parameters:

type – The type to check.

Returns:

true with render materials and model geometry; false otherwise.

property DeletedName: str

Gets the name of a component that is deleted.

property HasId: bool

Returns a value indicating whether the component has an ID.

property HasIndex: bool

Returns a value indicating whether the component has an Index.

property HasName: bool

Returns a value indicating whether the component has a Name.

property Id: uuid.UUID

Gets or sets the ID of the current instance.

Raises:

InvalidOperationException – When setting the ID failed. This usually happened because the instance ID is already locked.

property IdIsLocked: bool

Returns a value indicating whether the component ID is already locked.

property Index: int

Gets or sets the model component index attribute.

Raises:

InvalidOperationException – When setting the Index failed. This usually happens because the instance Index is already locked.

property IndexIsLocked: bool

Returns a value indicating whether the component Index is already locked.

property InstanceDefinitionModelSerialNumber: int

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.

Reference components are not saved in .3dm archives. Typically this value is set and locked by the code that adds a component to a model. This value is not saved in .3dm archives.

property IsComponentStatusLocked: bool

The component status itself can be locked. This returns an indication.

property IsDeleted: bool

true if the component is deleted. Deleted components are kept by the document for undo purposes.

property IsReference: bool

Gets a value indicting whether this component is a referenced component. Referenced components are part of referenced documents.

property IsSystemComponent: bool

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

property ModelSerialNumber: int

A value identifying the model that manages this component.

If the component is being managed by a model, this value identifies the model. In Rhino, this value is the document runtime serial number. Typically this value is set and locked by the code that adds a component to a model. This value is not saved in .3dm archives.

property Name: str

Gets or sets the name

Raises:

InvalidOperationException – When setting the Name failed. This usually happens because the instance Name is already locked.

property NameIsLocked: bool

Returns a value indicating whether the component Name is already locked.

NamePathSeparator: str = Ellipsis

object, /) -> str

Type:

(arg

property ReferenceModelSerialNumber: int

When a component is in a model for reference, this value identifies the reference model.

Reference components are not saved in .3dm archives. Typically this value is set and locked by the code that adds a component to a model. This value is not saved in .3dm archives.