rhino3dm.File3dmLayerTable

class rhino3dm.File3dmLayerTable

Provides access to layers in the 3dm file.

Add(item: Layer) → None

Adds an item.

Parameters:

item – The item to add.

AddDefaultLayer(name: str, color: tuple[int, int, int, int]) → int

Easy way to add a default layer to the model.

Note, the layer name will be modified as needed in the model and manifest.

Parameters:
  • name – Layer name.

  • color – Layer color.

Returns:

The layer’s index (>=0) is returned. Otherwise, RhinoMath.UnsetIntIndex is returned.

AddLayer(name: str, color: tuple[int, int, int, int]) → int
AddLayer(name: str, color: tuple[int, int, int, int], parentId: uuid.UUID) → int

Add a new layer to the model.

Parameters:
  • name – Layer name.

  • color – Layer color.

  • parentId – The id of the parent layer, can be Guid.Empty.

Returns:

The layer’s index (>=0) is returned. Otherwise, RhinoMath.UnsetIntIndex is returned.

Delete(item: Layer | None) → bool
Delete(index: int) → None

Flags a component as deleted.

Parameters:

index – The index of the item to flag.

Returns:

True on success.

Dump() → str

Prepares a text dump of object table.

Returns:

A string containing the dump.

FindId(id: uuid.UUID) → Layer

Uses the guid to find a model component. Deleted objects cannot be found by id. The guid is the value that is stored in the .Id property. In a single document, no two active objects have the same guid. If an object is replaced with a new object, then the guid persists. For example, if the _Move command moves an object, then the moved object inherits its guid from the starting object. If the Copy command copies an object, then the copy gets a new guid. This guid persists through file saving/opening operations. This function will not find grip objects.

Parameters:

id – ID of model component to search for.

Returns:

Reference to the rhino object with the objectId or null if no such object could be found.

FindIndex(index: int) → Layer

Retrieves a Layer object based on Index. This search type of search is discouraged. We are moving towards using only IDs for all tables.

Parameters:

index – The index to search for.

Returns:

A Layer object, or null if none was found.

FindName(name: str, parentId: uuid.UUID) → Layer

Finds a Layer given its name.

Parameters:
  • name – The name of the Layer to be searched.

  • parentId – The id of the parent Layer to be searched.

Returns:

A Layer, or null on error.

property ComponentType: ModelComponentType

Returns ModelComponentType.Layer.

property Count: int

Returns the count of all items, including deleted ones.