LayerTable¶
- class py3dm.LayerTable¶
Python wrapper providing access to objects of type
ON::Layerstored in anONX_Model.This class offers a convenient interface for adding, retrieving, counting, and iterating over layer objects.
LayerTabledoes not own the underlying data; it operates on the associatedONX_Modelinstance.- __iter__() collections.abc.Iterator[Layer]¶
- add(layer: Layer) uuid.UUID¶
Adds the
layerto the table.- Returns:
layer_uuid – If the
layerhas been successfully added,ON_nil_uuidotherwise.- Return type:
UUID
- count() int¶
Returns the number of active model components of type
ON_ModelComponent::Type::Layerin the table.Notes
The
count()does not include system components.
- delete_by_name(layer_name: str) bool¶
Deletes the Layer given its full name, e.g.,
Layer 01::Nested layer 02.- Returns:
success –
Trueif successfull,Falseotherwise.- Return type:
- delete_by_uuid(layer_uuid: uuid.UUID) bool¶
Deletes the Layer given its uuid.
- Returns:
success –
Trueif successfull,Falseotherwise.- Return type:
- get_by_index(layer_index: int) Layer | None¶
Returns the
Layerif the givenindexis found in the table,Noneotherwise.- Raises:
IndexError – if
layer_indexis < 0
- get_by_name(full_name: str) Layer | None¶
Returns the
Layerif the givenfull_nameis found in the table,Noneotherwise.
- get_by_uuid(layer_uuid: uuid.UUID) Layer | None¶
Returns the
Layerif the givenlayer_uuidis found in the table,Noneotherwise.
- get_index(full_name: str) int¶
Returns the layer
indexif the givenfull_nameis found in the table,ON_UNSET_INT_INDEXotherwise.
- get_uuid(full_name: str) uuid.UUID¶
Returns the layer
uuidif the givenfull_nameis found in the table,ON_nil_uuidotherwise.