LayerTable ========== .. py: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. .. py:method:: __getitem__(index: int) -> LayerView .. py:method:: __iter__() -> collections.abc.Iterator[LayerView] .. py:method:: __len__() -> int .. py:method:: 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. :rtype: UUID .. py:method:: count() -> int Returns the number of active model components of type ``ON_ModelComponent::Type::Layer`` in the table. .. rubric:: Notes The ``count()`` does not include system components. .. py:method:: delete(layer_name: str) -> bool delete(layer_uuid: uuid.UUID) -> bool Deletes the `Layer` given its uuid. :returns: **success** -- ``True`` if successfull, ``False`` otherwise. :rtype: bool .. py:method:: get(layer_index: int) -> LayerView | None get(full_name: str) -> LayerView | None get(layer_uuid: uuid.UUID) -> LayerView | None Returns a view of the ``Layer`` if the given ``layer_uuid`` is found in the table, ``None`` otherwise. .. py:method:: get_exclusive(layer_uuid: uuid.UUID) -> Layer | None Returns the ``Layer`` if the given ``layer_uuid`` is found in the table, ``None`` otherwise. .. py:method:: 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. .. py:method:: 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. .. py:method:: has(full_name: str) -> bool Returns ``True`` if the given ``full_name`` is found in the table, ``False`` otherwise. .. py:method:: max_index() -> int Returns the maximum index among all active model components of type ``ON_ModelComponent::Type::Layer`` in the table.