Model.hm_holedetectiongetmatedetails#
- Model.hm_holedetectiongetmatedetails(index)#
Returns details about a specific hole/tube mating ‘group’. This must be preceded by a call to
Model.hm_holedetectionfindmates().- Parameters:
index (int) – The index of the mate to get details for, starting from 0 up to the number of found mating groups minus 1.
- Returns:
hwReturnStatus- Status objectHmQueryResult- Result object containing the output values:totalLength (double) - The complete length of the hole/tube chain, measured from hole-to-hole and including the depth of any tubes
centerTopCoordinates (numpy.ndarray)
centerBottomCoordinates (numpy.ndarray)
centerCoordinates (numpy.ndarray)
numberOfIndeces (int)
listOfIndeces (numpy.ndarray)
Note
The center values correspond to center is the center of the hole/tube chain which lies on the center-line connecting holes/tubes.
Example#
Detect mating holes of any shape in all surfaces in the model and write the mate details to a text file.#import hm import hm.entities as ent model = hm.Model() with open("C:/temp/mates.txt", "w") as matesfile: 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 model.hm_holedetectionfindmates() _, result = model.hm_holedetectiongetnumberofmates() num_mates = result.numberofMates if num_mates > 0: matesfile.write(f"Number of mates = {num_mates}\n") for n in range(num_mates): _, result = model.hm_holedetectiongetmatedetails(index=n) matesfile.write(f"Queried data details of mate {n+1}\n") matesfile.write(f"totalLength = {result.totalLength}\n") matesfile.write(f"centerTopCoordinates = {result.centerTopCoordinates}\n") matesfile.write(f"centerBottomCoordinates = {result.centerBottomCoordinates}\n") matesfile.write(f"centerCoordinates = {result.centerCoordinates}\n") matesfile.write(f"numberOfIndeces = {result.numberOfIndeces}\n") matesfile.write(f"listOfIndeces = {result.listOfIndeces}\n") else: matesfile.write("Mates not detected.\n") model.hm_holedetectionend() matesfile.close()