Model.hm_comparegetarea#

Model.hm_comparegetarea(match_type, match_location, transformation_index=0)#

Calculates the area values for all source and target entities. This must be preceded by a call to a relevant hm_compareentities function.

Parameters:
  • match_type (int) –

    The type of match to query for the area. Valid values are:

    0 - Unmatched

    1 - Topological

    2 - Intersected

    3 - Overlapped

    4 - Matched

  • match_location (int) –

    The location of the entities to query for the area. Valid values are:

    1 - Source entities

    2 - Target entities

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

Returns:

Example#

Generate a contour of the distance results for a same side comparison of elements with IDs 1-20 and 101-120#
import hm
import hm.entities as ent

model = hm.Model()

elems1 = hm.Collection(model, ent.Element, list(range(1, 21)))

elems2 = hm.Collection(model, ent.Element, list(range(101, 121)))

model.hm_compareinit()

model.hm_compareentitiessameside(
    source_entities=elems1,
    target_entities=elems2,
    tolerance=0.1,
    result_type=2,
    review_results=False,
)

model.hm_comparefinddistances(max_distance=1.0, review_results=True)

_, result = model.hm_comparegetarea(match_type=0, match_location=1)

unmatched_source = result.areaPercent
print("unmatched_source", unmatched_source)

_, result = model.hm_comparegetarea(match_type=0, match_location=2)

unmatched_target = result.areaPercent
print("unmatched_target", unmatched_target)

model.hm_compareend()