Model.hm_holedetectionsetholeparams#

Model.hm_holedetectionsetholeparams(hole_shape, hole_type=0, min_planar_dim=0, max_planar_dim=0, max_big_planar_dim=0, max_offset_plane_dev=0, max_geom_dev_percent=0, max_smooth_edge_angle=-1, max_geom_dev_abs=-1, max_geom_angle_dev_abs=-1, max_straightness_dev_percent=-1, max_avg_adj_surf_angle=0, max_geom_dist=0.0, break_angle=0.0, inspect_non_manifold_loops=0.0)#

Defines parameters for finding 2D holes in both geometry and FE. Multiple calls to this function can be made to override or redefine the parameters for each hole shape. Settings are cleared on any call to Model.hm_holedetectioninit() /hm_holedetectionend().

This must be preceded by a call to Model.hm_holedetectioninit(). Only hole_shape is mandatory. All other parameters are optional and have default values. Parameters can be specified in any order.

Parameters:
  • hole_shape (int) –

    The shape of hole the parameters are being defined for.

    Bit values are used and the value is calculated as (Bit0 + 2*Bit1 + 4*Bit2 + 8*Bit3 + 16*Bit4). Valid Bit options are:

    Bit0

    Consider general holes. Valid values are:

    0 - Do not consider general holes

    1 - Consider general holes

    Bit1

    Consider circular holes. Valid values are:

    0 - Do not consider circular holes

    1 - Consider circular holes

    Circular holes: The distance from any of its nodes to the calculated center must not differ from the calculated radius by more than max_geom_dev_percent and max_geom_dev_abs (if enabled). Also, no edge must make an angle greater than max_smooth_edge_angle with either adjoining edge.

    Bit2

    Consider rounded holes. Valid values are:

    0 - Do not consider rounded holes.

    1 - Consider rounded holes.

    Rounded holes: The distance from any of the nodes on the rounded ends to the respective calculated centers must not differ from the calculated radii by more than max_geom_dev_percent and max_geom_dev_abs (if enabled). The radii must be within max_geom_dev_percent of each other. Also, no edge must make an angle greater than max_smooth_edge_angle with either adjoining edge. Opposite straight sides must have lengths within max_geom_dev_percent of each other.

    Bit3

    Consider square holes. Valid values are:

    0 - Do not consider square holes.

    1 - Consider square holes.

    Square holes: At every node except four, no edge must make an angle greater than max_smooth_edge_angle. At those four nodes, the measured angle is within max_geom_dev_percent and max_geom_angle_dev_abs (if enabled) of 90 degrees. And, all four sides must have lengths within max_geom_dev_percent and max_geom_dev_abs (if enabled) of their average. The sides must have a relative deviation from straight lines of not more than max_straightness_dev_percent.

    Bit4

    Consider rectangular holes. Valid values are:

    0 - Do not consider rectangular holes.

    1 - Consider rectangular holes.

    Rectangular holes: At every node except four, no edge must make an angle greater than max_smooth_edge_angle. At those four nodes, the measured angle is within max_geom_dev_percent and max_geom_angle_dev_abs (if enabled) of 90 degrees. Opposite pairs of sides must have lengths within max_geom_dev_percent and max_geom_dev_abs (if enabled) of each other. The sides must have a relative deviation from straight lines of not more than max_straightness_dev_percent.

    Show Bit value calculator
    Radio Button Table
    Option Name Value
    Consider general hole (Bit0)
    Consider circular holes (Bit1)
    Consider rounded holes (Bit2)
    Consider square holes (Bit3)
    Consider rectangular holes (Bit4)
    Calculated argument value: 0

  • hole_type (int) –

    The hole type to consider. If 0 (default), the holes type check is skipped.

    Bit values are used and the value is calculated as (Bit0 + 2*Bit1 + 4*Bit2 + 8*Bit3). Valid Bit options are:

    Bit0

    Consider surface holes. Valid values are:

    0 - Do not consider surface holes.

    1 - Consider surface holes.

    Surface holes: Holes with small angle deviation of axis of adjacent surface normals.

    Bit1

    Consider flanged surface holes. Valid values are:

    0 - Do not consider flanged surface holes

    1 - Consider flanged surface holes

    Flanged surface holes: Holes with bent edges (stiffness ring rib).

    Bit2

    Consider cylindrical holes. Valid values are:

    0 - Do not consider cylindrical holes.

    1 - Consider cylindrical holes.

    Cylindrical holes: Free edge loops of cylinders.

    Bit3

    Consider conical holes. Valid values are:

    0 - Do not consider conical holes.

    1 - Consider conical holes. Conical holes: Free edge loops of cones.

    Show Bit value calculator
    Radio Button Table
    Option Name Value
    Consider surface holes (Bit0)
    Consider flanged surface holes (Bit1)
    Consider cylindrical holes (Bit2)
    Consider conical holes (Bit3)
    Calculated argument value: 0

  • min_planar_dim (double) – The minimum width of the hole must exceed this value. If less than or equal to 0.0, this check is skipped. Default value 0.0.

  • max_planar_dim (double) – The maximum width of the hole cannot exceed this value. If less than or equal to 0.0, this check is skipped. Default value 0.0.

  • max_big_planar_dim (double) – This threshold applies to the rounded (elongated) and rectangular holes. The maximum planar dimension of the hole cannot exceed this value. If less than or equal to 0.0, this check is skipped. Default value 0.0.

  • max_offset_plane_dev (double) – No node on the perimeter of a hole must exceed this distance from the mean plane. If less than or equal to 0.0, this check is skipped. Default value 0.0.

  • max_geom_dev_percent (double) – Sets the relative threshold for hole linear and angle shape deviation, see hole_shape. Acceptable values are [0.0, 100.0], otherwise the closer extreme is used. If less than 0.0, this check is skipped. Default value -1.

  • max_smooth_edge_angle (double) – See hole_shape. Acceptable values are [0.0, 90.0], otherwise the closer extreme is used. If less than 0.0, this check is skipped. Default value -1.

  • max_geom_dev_abs (double) – Sets the absolute threshold for linear hole shape deviation, see hole_shape. If less than 0.0, this check is skipped. Default value -1.

  • max_geom_angle_dev_abs (double) – Sets the absolute angle threshold for deviation of corner angles of rectangular from right angle, see hole_shape. Acceptable values are [0.0, 90.0], otherwise the closer extreme is used. If less than 0.0, this check is skipped. Default value -1.

  • max_straightness_dev_percent (double) – Sets the relative threshold for the chordal deviation of the sides of rectangular holes of straight lines, see hole shape. Acceptable values are [0.0, 100.0], otherwise the closer extreme is used. If less than 0.0, this check is skipped. Default value -1.

  • max_avg_adj_surf_angle (double) – Maximum average angle deviation of holes axial direction of adjacent surfaces normals. Acceptable values are [0.0, 90.0]. If less than 0.0, this check is skipped. Default value 45 degrees.

  • max_geom_dist (double) – Reserved for future development

  • break_angle (double) – Reserved for future development

  • inspect_non_manifold_loops (double) – Reserved for future development

Example#

Detect holes of any shape in all surfaces in the model and write the hole details shape_type, center, radius, and entities_list to a text file.#
import hm
import hm.entities as ent

model = hm.Model()

with open("C:/temp/holes.txt", "w") as holesfile:

    surf_collection = hm.Collection(model, ent.Surface)

    model.hm_holedetectioninit()
    model.hm_holedetectionsetentities(collection=surf_collection)
    model.hm_holedetectionsetholeparams(hole_shape=31)
    model.hm_holedetectionfindholes(find=1)  # For holes we need to set find=1

    _, result = model.hm_holedetectiongetnumberofholes()
    num_holes = result.numberOfHoles

    if num_holes > 0:

        holesfile.write(f"Number of holes = {num_holes}\n\n")

        for n in range(num_holes):

            holesfile.write(f"Queried data details of hole {n+1}\n")

            _, result = model.hm_holedetectiongetholedetailsdata(
                index=n, query_key="shape_type"
            )
            holesfile.write(f"shape-type = {result.queryValue}\n")

            _, result = model.hm_holedetectiongetholedetailsdata(
                index=n, query_key="center"
            )
            holesfile.write(f"center = {result.queryValue}\n")

            _, result = model.hm_holedetectiongetholedetailsdata(
                index=n, query_key="radius"
            )
            holesfile.write(f"radius = {result.queryValue}\n")

            _, result = model.hm_holedetectiongetholedetailsdata(
                index=n, query_key="entities_list"
            )
            holesfile.write(f"entities_list = {result.queryValue}\n\n")

    else:

        holesfile.write("Holes not detected.\n")

    model.hm_holedetectionend()

    holesfile.close()