Model.hm_holedetectionfindholes#
- Model.hm_holedetectionfindholes(find)#
Runs the hole detection functions for finding holes and tubes based on input entities and parameters. This must be preceded by calls to
Model.hm_holedetectioninit(),hm_holedetectionsetentities(), andhm_holedetectionsetholeparams()orhm_holedetectionsettubeparams().- Parameters:
find (int) –
Bit value defining the types of holes and tubes to find (Bit0 + 2*Bit1 + 4*Bit2). Valid Bit options are:
Bit0
Find holes. Valid values are:
0 - Do not find holes
1 - Find holes
Bit1
Find 2D tubes. Valid values are:
0 - Do not find 2D tubes
1 - Find 2D tubes
Bit2
Find 3D tubes. Valid values are:
0 - Do not find 3D tubes
1 - Find 3D tubes
Show Bit value calculator
Radio Button Table Option Name Value Find holes (Bit0) Find 2D tubes (Bit1) Find 3D tubes (Bit2) Calculated argument value: 0 - Returns:
hwReturnStatus- Status object
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()