Model.separate_holes_in_3d_body_new#

Model.separate_holes_in_3d_body_new(input_collection, output_collection, flags, string_array)#

Takes as input a collection of surfaces or solids of a 3D body. It finds holes in the 3D body, collects the found connected holes in tubes, and groups the tubes by diameter either according to the user-specified diameter ranges or by auto-creating the groups from the user-specified tolerance. The function creates a component with an auto-generated name for each diameter group and moves the relevant surfaces of the tubes to the corresponding components. Blind-holes and through-holes are considered as different groups, so they are grouped separately. Optionally, the surfaces of the detected holes can be put to an output mark.

The function parameters have the following meaning:

Parameters:
  • input_collection (Collection) – The collection containing the entities.

  • output_collection (Collection) – The collection containing the entities.

  • flags (int) –

    Sets a filter for the shape of cross sections of holes to be recognized. Supported values are:

    0 - Holes are not filtered by shape (arbitrarily shaped).

    1 - Only round holes are detected.

    2 - Only rounded slots are detected.

    3 - Both round holes and rounded slots are detected.

  • string_array (hwStringList) –

    The object describing the entity that contains the fillet width and radius group information. The first (optional) string in quotations may contain the following parameters as keywords followed by the parameters values.

    cross_sect_size_max - Maximum length of the holes normal to the holes axes cross sections. This applies only to elongated holes (rounded slots or elliptical holes). If cross_sect_size_max = 0, then no limitation is applied. (default=0)

    diam_tolerance - If this option is set, then the holes tube groups are to be auto-defined by this specified tolerance and any group diameter ranges are ignored.

    diam_min - Minimum diameter of holes for recognition. (default=0)

    diam_max - Maximum diameter of holes for recognition. If specified to be 0, then no limit is applied. (default=0)

    diams_ratio_max - Maximum ratio of diameters of adjacent co-axial cylindrical hole sections when the sections are considered within the same tube. (Default=2.5)

    All other strings may contain up to 3 quoted values. These indicate the group diameter ranges. It is not necessary to specify the string name, just the values:

    min_group_diam (double) - The minimum diameter of the group

    max_group_diam (double) - The maximum diamter fo the group

    group_flag (int) (optional) -

    0 - Disable group

    1 - Enable gorup

    Value of 0 (disable group) or 1 (enable group) indicating if that diameter group is considered. (default=1 for all groups)

    The group ranges should not overlap but may have gaps between them.

Examples#

Recognize round holes with diameters from 0.0 to 50.0 in 3D model , separate them in groups by diameter accord the ranges : 10.0 - 11.0 , 12.0 - 15.0 , 17.0 - 20.0 , 20.0 - 30.0 and 30.0 - 50.0 , allow adjacent tube sections diameter ratio of up to 3.0 and place the detectedholes in the output_collection#
import hm
import hm.entities as ent

model = hm.Model()

# Creating a collection that contains all the surfaces
surfaces_collection = hm.Collection(model, ent.Surface)

model.separate_holes_in_3d_body_new(
    input_collection=surfaces_collection,
    output_collection=hm.Collection(model, ent.Surface, populate=False),
    flags=0,
    string_array=[
        "cross_sect_size_max = 50.0 diams_ratio_max = 3.0",
        "min_group_diam=10.0 max_group_diam=11.0",
        "min_group_diam=12.0 max_group_diam=15.0",
        "min_group_diam=17.0 max_group_diam=20.0",
        "min_group_diam=21.0 max_group_diam=30.0",
        "min_group_diam=31.0 max_group_diam=50.0",
    ],
)
Recognize round holes with diameters from 0.0 to 50.0 in 3D model , separate them in groups by diameter accord the ranges : 10.0 - 11.0 , 12.0 - 15.0 , 17.0 - 20.0 , 20.0 - 30.0 and 30.0 - 50.0 , allow adjacent tube sections diameter ratio of up to 3.0 and place the detectedholes in the output_collection . The diameters range 12.0 - 15.0 should be disabled without remove it from the input#
import hm
import hm.entities as ent

model = hm.Model()

# Creating a collection that contains all the surfaces
surfaces_collection = hm.Collection(model, ent.Surface)

model.separate_holes_in_3d_body_new(
    input_collection=surfaces_collection,
    output_collection=hm.Collection(model, ent.Surface, populate=False),
    flags=0,
    string_array=[
        "cross_sect_size_max = 50.0 diams_ratio_max = 3.0",
        "min_group_diam=10.0 max_group_diam=11.0",
        "min_group_diam=12.0 max_group_diam=15.0 group_flag=0",
        "min_group_diam=17.0 max_group_diam=20.0",
        "min_group_diam=21.0 max_group_diam=30.0",
        "min_group_diam=31.0 max_group_diam=50.0",
    ],
)