Model.hm_comparegettransformationmatchentitycount#

Model.hm_comparegettransformationmatchentitycount(transformation_index, match_index, match_location)#

Returns the number of entities associated with a specific transformation and match. This must be preceded by a call to a relevant hm_compareentities function.

Parameters:
  • transformation_index (int) – The index of the transformation to query, starting with 0. The number of transformations can be found using Model.hm_comparegettransformationcount().

  • match_index (int) – The index of the match corresponding to the transformation_index to query, starting with 0. The number of matches can be found using Model.hm_comparegettransformationmatchcount().

  • match_location (int) –

    The location of the match to query. Valid values are:

    1 - Source entities

    2 - Target entities

Returns:

Example#

Find the number of source entitie for transformation 0 for the recursive comparison of surfaces 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_comparegettransformationmatchentitycount(
    transformation_index=0, match_index=5, match_location=1
)

num_source_entities = result.numberOfEntities
print("num_source_entities", num_source_entities)

model.hm_compareend()