Model.boolean_solids#

Model.boolean_solids(SolidCollectionA, SolidCollectionB=Collection(), OpCode=14, Option=3, BooleanTolerance=DBL_MAX)#

Performs a Boolean operation on selected solid entities.

Parameters:
  • SolidCollectionA (Collection) – The collection containing the solid entities in set A. For combination operation only this collection can be populated.

  • SolidCollectionB (Collection) – The collection containing the solid entities in set B.

  • OpCode (int) –

    The code of the Boolean operation to be performed. Valid options are:

    2 - Set A minus set B.

    8 - Set A or set B

    14 - Set A and set B

  • Option (int) –

    Specifies how to process internal shared boundaries in resulted solid or solids. Valid values are:

    0 - All boundaries shared between sets A and B are removed.

    1 - Surfaces that were part of the boundary of solids in the set B are kept in the result.

    2 - All shared boundaries are kept in the result.

    3 - All shared boundaries are removed.

  • BooleanTolerance (double) – Solids in proximity below this distance will get combined. Currently used for Boolean combine operations among FE-Geometry solids. Any positive value is acceptable.

Examples#

Subtract solid with ID 20 from solid with ID 10#
import hm
import hm.entities as ent

model = hm.Model()

solid_set_A = hm.Collection(model, ent.Solid, [10])
solid_set_B = hm.Collection(model, ent.Solid, [20])

model.boolean_solids(SolidCollectionA=solid_set_A, SolidCollectionB=solid_set_B, OpCode=2)
Combine FE solids with IDs 10, 20 with distance smaller 0.1 and keep the shared boundaries#
import hm
import hm.entities as ent

model = hm.Model()

solid_set_A = hm.Collection(model, ent.Solid, [10, 20])

model.boolean_solids(SolidCollectionA=solid_set_A, OpCode=14, Option=2, BooleanTolerance=0.1)