Model.find_holes_in_3d_body#

Model.find_holes_in_3d_body(input_collection, output_collection, mode, flags, min_diam, max_diam, max_lensize)#

Finds holes in 3d body and puts the result in an output collection.

Parameters:
  • input_collection (Collection) – The collection containing the the desired surface or solid entities.

  • output_collection (Collection) – The collection containing the the surface entities recognized as sides of the holes in 3D body.

  • mode (int) –

    Selects the search algorithm to use (see the comments section below for known limitations of each mode):

    1 - Recognize all circular holes passing through the entire solid. Recognizes filleted ends/rims. Ignores all other parameters.

    2 - Recognize elongated or circular holes that do not pass through the entire solid. Does not recognize holes with filleted ends/rims.

  • flags (int) –

    Sets a filter for the shape of holes to be recognized:

    0 - No filtering (arbitrary shapes allowed).

    1 - Only round holes are found.

    2 - Only rounded slots are found.

    3 - Round holes and round slots are found.

  • min_diam (double) –

    Smallest diameter of holes to be found.

    0 - No limit

  • max_diam (double) –

    Largest diameter or width of the holes to be found.

    0 - uses no upper limit.

  • max_lensize (double) –

    Maximum length for elongated holes/slots.

    0 - To allow any length (no limit).

Examples#

Take the surfaces from the input collection, find the holes using algorithm 1 (from the midsurface tool) and put the result into output collection#
import hm
import hm.entities as ent

model = hm.Model()

model.find_holes_in_3d_body(
  input_collection=hm.Collection(model, ent.Surface),
  output_collection=hm.Collection(model, ent.Surface, populate=False),
  mode=1,
  flags=0,
  min_diam=0.0,
  max_diam=0.0,
  max_lensize=0.0
)
Take the surfaces from the input collection, find the holes using algorithm 2 to find round holes ranging from 1-5mm, and up to 10mm deep, and put the result into output collection#
import hm
import hm.entities as ent

model = hm.Model()

model.find_holes_in_3d_body(
  input_collection=hm.Collection(model, ent.Surface),
  output_collection=hm.Collection(model, ent.Surface, populate=False),
  mode=1,
  flags=0,
  min_diam=0.0,
  max_diam=5.0,
  max_lensize=10.0
)

Note

Mode=1 does not utilize the arguments for flags, min_diam, max_diam, and max_lensize. Thus, these are each treated as being zero.

Mode=2 utilizes all arguments, but only locates holes with sharp edges.

Both modes assume that the element normals around holes face outward. If this is not so, the results may be unpredictable and unsatisfactory.

Note

This function also does not clean the surfaces collection output after completion, so holes are added to the surfaces collection.