Model.hm_findnarrowsurfaces#

Model.hm_findnarrowsurfaces(collection, width_threshold, output_surfs_flag=0, sharp_angle_threshold=10, reserved=0)#

Returns a list of narrow surfaces, including large surfaces with narrow tails or local narrow neck regions. If output_surfs_flag is set to 1, the result object will contain a list of surface entities and a list of flags indicating the type of narrow surface.

Each flag represents a bit-wise flags mask:

1 - Sliver surface

2 - Surface containing a narrow neck region

4 - Surface containing a narrow tail region

8 - Surface containing both a narrow neck and a narrow tail region

Parameters:
  • collection (Collection) – The collection containing the entities to query. Valid entities are surfaces, solids, and components.

  • width_threshold (double) – Positive value defining the maximal width of a narrow surface, or maximal gap for a surface narrow tail or neck region.

  • output_surfs_flag (int) –

    Parameter defining the output mode.

    0 - Output contains only list of surface entities (default)

    1 - Output contains an additional list of flags for narrow surfaces

  • sharp_angle_threshold (double) – An angle, in degrees, that represents a corner angle above which the area nearby a surface corner is not considered as a narrow region. (default 10.0)

  • reserved (int) – Reserved for future use. Must be set to 0.

Returns:

  • hwReturnStatus - Status object

  • HmQueryResult - Result object containing the output values:

    • surfaces (list) - List of surface entities that are considered narrow surfaces.

    • flags (list) - List of flags for each narrow surface. The output is available if output_surfs_flag is set to 1. Each flag is a bit-wise mask indicating the type of narrow surface.

Examples#

Find narrow surfaces with width below 0.2 for component “main_body”#
import hm
import hm.entities as ent

model = hm.Model()

comp_col = hm.Collection(model, ent.Component, "name=main_body")

_, result = model.hm_findnarrowsurfaces(collection=comp_col, width_threshold=0.2)

for surf in result.surfaces:
    print("Surface ID: ",surf.id)
Find narrow surfaces with width below 0.2 for component “main_body” and additionally get list of flags for each narrow surface#
import hm
import hm.entities as ent

model = hm.Model()

comp_col = hm.Collection(model, ent.Component, "name=main_body")

_, result = model.hm_findnarrowsurfaces(
    collection=comp_col,
    width_threshold=0.2,
    output_surfs_flag=1
)

for surf, flag in zip(result.surfaces, result.flags):
    print("Surface ID: ",surf.id)
    print("Flag: ", flag)