LayerTable

class py3dm.LayerTable

Python wrapper providing access to objects of type ON::Layer stored in an ONX_Model.

This class offers a convenient interface for adding, retrieving, counting, and iterating over layer objects.

LayerTable does not own the underlying data; it operates on the associated ONX_Model instance.

__getitem__(index: int) Layer
__iter__() collections.abc.Iterator[Layer]
__len__() int
add(layer: Layer) uuid.UUID

Adds the layer to the table.

Returns:

layer_uuid – If the layer has been successfully added, ON_nil_uuid otherwise.

Return type:

UUID

count() int

Returns the number of active model components of type ON_ModelComponent::Type::Layer in 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:

successTrue if successfull, False otherwise.

Return type:

bool

delete_by_uuid(layer_uuid: uuid.UUID) bool

Deletes the Layer given its uuid.

Returns:

successTrue if successfull, False otherwise.

Return type:

bool

get_by_index(layer_index: int) Layer | None

Returns the Layer if the given index is found in the table, None otherwise.

Raises:

IndexError – if layer_index is < 0

get_by_name(full_name: str) Layer | None

Returns the Layer if the given full_name is found in the table, None otherwise.

get_by_uuid(layer_uuid: uuid.UUID) Layer | None

Returns the Layer if the given layer_uuid is found in the table, None otherwise.

get_index(full_name: str) int

Returns the layer index if the given full_name is found in the table, ON_UNSET_INT_INDEX otherwise.

get_uuid(full_name: str) uuid.UUID

Returns the layer uuid if the given full_name is found in the table, ON_nil_uuid otherwise.

has(full_name: str) bool

Returns True if the given full_name is found in the table, False otherwise.

max_index() int

Returns the maximum index among all active model components of type ON_ModelComponent::Type::Layer in the table.