Model.hm_comparegetcomparea#

Model.hm_comparegetcomparea(match_type, match_location, component_id=0, transformation_index=0)#

Calculates the area values for a specific component. This must be preceded by a call to a relevant hm_compareentities function. Model.hm_comparesetflags() should also be set to 1.

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

  • component_id (int) – The ID of the component to query. If not specified, or given as 0, then the area for the entire source or target is calculated (same behavior as Model.hm_comparegetarea()). Ensure that the specified ID matches with the requested match_location.

  • 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#

Compare elements from components with IDs 1 and 2 and query the area of component 10#
import hm
import hm.entities as ent

model = hm.Model()

comps1 = hm.Collection(model, ent.Component,[1])
filter1 = hm.FilterByCollection(ent.Element, ent.Component)
elems1 = hm.Collection(model, filter1, comps1)

comps2 = hm.Collection(model, ent.Component,[2])
filter2 = hm.FilterByCollection(ent.Element, ent.Component)
elems2 = hm.Collection(model, filter2, comps2)

model.hm_compareinit()

model.hm_comparesetflags(flag=1)

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

_, result = model.hm_comparegetcomparea(match_type=4, match_location=1, component_id=10)

print("areaPercent", result.areaPercent)

model.hm_compareend()