Model.hm_comparegettransformationcount#

Model.hm_comparegettransformationcount()#

Returns the number of transformations found. This must be preceded by a call to a relevant hm_compareentities function.

Multiple transformations can be found by Model.hm_compareentitiesrecursive(), Model.hm_compareentitiesrotate() and Model.hm_compareentitiestranslate(). Other hm_compareentities functions only find a single transformation between source and target entities.

Returns:

Example#

Find the number of transformations for the recursive comparison of surfs with IDs 1 - 20 and 101 - 120#
import hm
import hm.entities as ent

model = hm.Model()

surf1 = hm.Collection(model, ent.Surface, list(range(1, 21)))
surf2 = hm.Collection(model, ent.Surface, list(range(101, 121)))

model.hm_compareinit()

model.hm_compareentitiesrecursive(
    source_surfaces=surf1,
    target_surfaces=surf2,
    tolerance=0.1,
    result_type=2,
    review_results=False,
)

_, result = model.hm_comparegettransformationcount()

num_transformations = result.numberOfTransformations
print("num_transformations", num_transformations)

model.hm_compareend()