ShapeList

An ordered collection of Shape objects from a single stage.

Returned by selection and query methods. The scalar properties (id, type, length, area, volume, location) return the value of the single contained shape when the list holds exactly one shape, and None otherwise. Supports indexing, len(), merge() and remove(); the raw list is available via values.

Properties

values : list[Shape]
The underlying list of Shape objects.
id : int
Id of the single contained shape, or None if not exactly one shape.
type : ShapeType
Type of the single contained shape, or None if not exactly one shape.
length : float
Length of the single contained shape, or None if not exactly one shape.
area : float
Area of the single contained shape, or None if not exactly one shape.
volume : float
Volume of the single contained shape, or None if not exactly one shape.
location : list[float]
Location of the single contained shape, or None if not exactly one shape.
settings_3d : ExtrudeTo3dSettings or None
Remote 2D-to-3D extrusion feature for these shapes, whose properties can be read and written directly; None if not applicable.

Methods

vertices()

List of all the vertices bounding the shape. Designed for a single Shape in the shapelist.

Returns

ShapeList
List of vertices

Examples

shapes = model.get_shapes()
shapes[26].vertices()

edges()

List of all the edges bounding the shape. Designed for a single Shape in the shapelist.

Returns

ShapeList
List of edges

Examples

shapes = model.get_shapes()
shapes[26].edges()

faces()

List of all the faces bounding the shape. Designed for a single Shape in the shapelist.

Returns

ShapeList
List of faces

Examples

shapes = model.get_shapes()
shapes[26].faces()

volumes()

List with the volume shape. Designed for a single Shape in the shapelist.

Returns

ShapeList
List with volume

Examples

shapes = model.get_shapes()
shapes[26].volumes()

set_2d_to_3d_settings()

Set 2D to 3D extrusion settings for shapes.

Parameters

depth_in : float, optional
Extrusion depth inward
depth_out : float, optional
Extrusion depth outward
repetition : bool, optional
Enable repetition
repetition_spacing : float, optional
Spacing between repetitions
repetition_out : float, optional
Number of repetitions outward
repetition_in : float, optional
Number of repetitions inward
fill : bool, optional
Fill between repetitions
fill_in : float, optional
Fill depth inward
fill_out : float, optional
Fill depth outward
as_face : bool, optional
Treat as face

Returns

bool
True if settings were applied successfully

get_2d_to_3d_settings()

Get 2D to 3D extrusion settings for the first shape in the list.

Returns

dict
Dictionary containing extrusion settings: - depth_in: Extrusion depth inward - depth_out: Extrusion depth outward - repetition: Whether repetition is enabled - repetition_spacing: Spacing between repetitions - repetition_out: Number of repetitions outward - repetition_in: Number of repetitions inward - fill: Whether fill is enabled - fill_in: Fill depth inward - fill_out: Fill depth outward - as_face: Whether to treat as face

contains()

Check if Shape is contained in ShapeList.

Returns

bool
True or False

Examples

shapes = model.get_shapes()
shape = model.get_shape_by_id(26)
shapes.contains(shape)

find()

Find Shape contained in ShapeList.

Parameters

items : Shape
shape

Returns

Shape or None.

Examples

shapes = model.get_shapes()
shape = model.get_shape_by_id(26)
shapes.contains(shape)

remove()

Remove Shape from ShapeList.

Parameters

items : Shape or ShapeList
shape or shapes.

Examples

shapes = model.get_shapes()
shape = model.get_shape_by_id(26)
shapes.remove(shape)
shapes.remove(model.get_shapes(['vertex']))

get()

Get new Shapelist from index in Shapelist

Parameters

index : int
index of shape to get new shapelist from.

Returns

ShapeList.

Examples

shapes = model.get_shapes()
shapes.get(10)

merge()

' Merge current ShapeList with another.

Parameters

other : ShapeList
ShapeList to merge with.

Returns

ShapeList.

Examples

vertexList = model.get_shapes(types=['vertex'])
edgeList = model.get_shapes(types=['edge'])
vertexList.merge(edgeList)