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[LayerView]¶
- 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(layer_name: str) bool¶
- delete(layer_uuid: uuid.UUID) bool
Deletes the Layer given its uuid.
- Returns:
success –
Trueif successfull,Falseotherwise.- Return type:
- get(layer_index: int) LayerView | None¶
- get(full_name: str) LayerView | None
- get(layer_uuid: uuid.UUID) LayerView | None
Returns a view of the
Layerif the givenlayer_uuidis found in the table,Noneotherwise.
- get_exclusive(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.