CSGModel

class compas_gmsh.models.CSGModel(tree: dict, name: str, **kwargs)[source]

Bases: compas_gmsh.models.model.Model

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.

Methods

add(shape)

Add a shape to the underlying OCC model.

compute_tree()

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

generate_mesh([dim, verbose, algorithm])

Generate a mesh of the current model.

info()

Print information about the current model.

mesh_to_compas()

Convert the model mesh to a COMPAS mesh data structure.

mesh_to_openmesh()

Convert the model mesh to a COMPAS mesh data structure.

mesh_to_tets()

Convert the model mesh to a COMPAS mesh data structure.

mesh_to_volmesh()

Convert the model mesh to a COMPAS mesh data structure.

optimize_mesh([algo, niter])

Optimize the model mesh using the specified method.

recombine_mesh()

Recombine the mesh into quadrilateral faces.

refine_mesh()

Refine the model mesh by uniformly splitting the edges.