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) -> Layer .. py:method:: __iter__() -> collections.abc.Iterator[Layer] .. 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_by_name(layer_name: str) -> bool Deletes the `Layer` given its full name, e.g., ``Layer 01::Nested layer 02``. :returns: **success** -- ``True`` if successfull, ``False`` otherwise. :rtype: bool .. py:method:: delete_by_uuid(layer_uuid: uuid.UUID) -> bool Deletes the `Layer` given its uuid. :returns: **success** -- ``True`` if successfull, ``False`` otherwise. :rtype: bool .. py:method:: 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 .. py:method:: get_by_name(full_name: str) -> Layer | None Returns the ``Layer`` if the given ``full_name`` is found in the table, ``None`` otherwise. .. py:method:: get_by_uuid(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.