Skip to content

CSGModel ¤

CSGModel(tree: dict, name: str, **kwargs)

Model for shape generation through Constructive Solid Geometry.

Parameters:

  • tree (dict) –

    The CSG tree as a dictionary mapping operations to operands. The operations have to be one of {"union", "intersection", "difference"}. The operands have to be lists of shapes or lists of dicts that are CSG trees themselves. At every level of the tree, there can be only one operation.

  • name (str) –

    The name of the model.

Attributes:

  • tree (dict) –

    The CSG tree as a dictionary mapping operations to operands. The operations have to be one of {"union", "intersection", "difference"}. The operands have to be lists of shapes or lists of dicts that are CSG trees themselves. At every level of the tree, there can be only one operation.

Functions¤

add ¤

add(shape: Shape) -> tuple[int, int]

Add a shape to the underlying OCC model.

Parameters:

  • shape (Shape) –

    A geometric shape.

Returns:

  • tuple[int, int]

    A "dimtag", a dimension and a tag that together uniquely identify the shape in the OCC model.

compute_tree ¤

compute_tree() -> None

Comute the compound shape resulting from the operations on shape primitives in the tree.

Returns:

  • None