bluemira.codes.python_occ.imprint_solids

Imprinting solids together.

Classes

_Imprinter

Imprints solids together using the BOPAlgo_MakeConnected algorithm.

ImprintResult

Result of imprinting solids together.

Functions

imprint_solids(→ ImprintResult)

Imprints solids together.

Module Contents

class bluemira.codes.python_occ.imprint_solids._Imprinter(*, run_parallel=False, parallel_mode=False, use_obb=False)

Imprints solids together using the BOPAlgo_MakeConnected algorithm.

_imprint_builder
__call__(imprintables: list[bluemira.codes.python_occ.imprintable_solid.ImprintableSolid]) int

Imprints the solids together, internally mutating the ImprintableSolid.

Parameters:

imprintables (list[ImprintableSolid]) – The imprintables to imprint together.

Returns:

The number of imprints performed.

Return type:

int

Raises:

ValueError – If the imprintables are not valid.

class bluemira.codes.python_occ.imprint_solids.ImprintResult(imprintables: list[bluemira.codes.python_occ.imprintable_solid.ImprintableSolid], total_imprints: int)

Result of imprinting solids together.

Parameters:
_imprintables
total_imprints
property imprintables: list[bluemira.codes.python_occ.imprintable_solid.ImprintableSolid]

Returns the imprintables.

Return type:

list[bluemira.codes.python_occ.imprintable_solid.ImprintableSolid]

property labels: list[str]

Returns the labels of the imprintables.

Return type:

list[str]

property solids: list[bluemira.geometry.solid.BluemiraSolid]

Returns the imprinted BluemiraSolids.

Return type:

list[bluemira.geometry.solid.BluemiraSolid]

property as_compound: bluemira.geometry.compound.BluemiraCompound

Returns the imprinted BluemiraCompound.

Return type:

bluemira.geometry.compound.BluemiraCompound

property occ_solids: list[OCC.Core.TopoDS.TopoDS_Solid]

Returns the imprinted TopoDS_Solids.

Return type:

list[OCC.Core.TopoDS.TopoDS_Solid]

property occ_faces: list[OCC.Core.TopoDS.TopoDS_Face]

Returns the imprinted TopoDS_Face.

Return type:

list[OCC.Core.TopoDS.TopoDS_Face]

bluemira.codes.python_occ.imprint_solids.imprint_solids(solids: collections.abc.Collection[bluemira.geometry.solid.BluemiraSolid], labels: collections.abc.Collection[str] | str, *, use_cgal=True) ImprintResult

Imprints solids together.

Parameters:
  • solids (collections.abc.Collection[bluemira.geometry.solid.BluemiraSolid]) – The solids to imprint together.

  • labels (collections.abc.Collection[str] | str) – The labels to use for the solids. If None, the labels will be taken from the solids. Must be the same length as solids.

  • use_cgal – Whether to use CGAL for improved overlap checking speed and precision. If True and CGAL is not available, a numpy based approach will be used as a fallback. If False, the numpy based approach will be used regardless of CGAL availability.

Return type:

The imprintable solids.

Raises:
  • ValueError – If the labels are not the same length as the solids.

  • TypeError – If the solids are not of type BluemiraSolid.