GeometryLayer
- class GeometryLayer
-
- property name
The name of the layer.
- Type
- Raises
ReadOnlyError -- If
Database
is in read only mode.
- property visible
The layer visibility.
- Type
- Raises
ReadOnlyError -- If
Database
is in read only mode.
- property locked
The layer lock state.
- Type
- Raises
ReadOnlyError -- If
Database
is in read only mode.
- property active
Geometry layer active state.
- Type
- Raises
ReadOnlyError -- If
Database
is in read only mode.
- property parent_layer
The parent layer of this layer or
None
if no parent.- Type
- Raises
ReadOnlyError -- If
Database
is in read only mode.ValueError -- If trying to move the layer into one of its children or trying to move the layer to another model or trying to move the layer to itself.
- list_child_layers(recursive=True)
List the child geometry layers of this layer.
- create_geometry_layer(name)
Create a new child geometry layer of this layer.
- Parameters
name (str) -- Name of the layer.
- Returns
The newly created layer.
- Return type
- Raises
ReadOnlyError -- If
Database
is in read only mode.
- duplicate()
Duplicate this geometry layer with its children.
- Returns
The duplicated layer.
- Return type
- Raises
ReadOnlyError -- If
Database
is in read only mode.
- remove(force=False)
Delete this geometry layer
Note
By default, only empty layers can be deleted (
NotEmptyError
is raised otherwise), useforce
to force deletion of non empty layers.- Parameters
force (bool) -- Force the deletion of the layer even if it contains surfaces.
- Raises
NotEmptyError -- If
force
isFalse
and the layer contains surfaces.ReadOnlyError -- If
Database
is in read only mode.ValueError -- Cannot be removed if the geometry layer is the only one remaining.
- list_surfaces()
List the surfaces of this layer.
- import_triangle_mesh(name, positions, normals, uvs)
Import a surface from triangle mesh buffers.
Note
The winding order of triangles is counter-clockwise (OpenGL default).
- Parameters
name (str) -- Name of the surface.
positions (list(float)) -- Vertices position (x, y, z) as floats. Units are meters.
normals (list(float)) -- Vertices normals (x, y, z) as floats. It can be empty if no normals are available.
uvs (list(float)) -- Vertices UVs (u, v) as floats. It can be empty if no UVs are available.
- Returns
The imported surface.
- Return type
- Raises
ReadOnlyError -- If
Database
is in read only mode.ValueError -- If one of positions, normals or uvs have an incorrect number of elements.
- import_indexed_triangle_mesh(name, indices, positions, normals, uvs)
Import a surface from indexed triangle mesh buffers. This is faster than
import_triangle_mesh
Note
The winding order of triangles is counter-clockwise (OpenGL default).
- Parameters
name (str) -- Name of the surface.
indices (list(int)) -- Indices of vertices in
positions
,normals
anduvs
to make triangles.positions (list(float)) -- Vertices position (x, y, z) as floats. Units are meters.
normals (list(float)) -- Vertices normals (x, y, z) as floats. It can be empty if no normals are available.
uvs (list(float)) -- Vertices UVs (u, v) as floats. It can be empty if no UVs are available.
- Returns
The imported surface.
- Return type
- Raises
ReadOnlyError -- If
Database
is in read only mode.ValueError -- If one of indices, positions, normals or uvs have an incorrect number of elements.