Model.hm_compareentitiesrecursive#

Model.hm_compareentitiesrecursive(source_surfaces, target_surfaces, tolerance, result_type=1, review_results=True)#

Generates recursive comparison results for entities positioned at any location. Multiple matches can be found for each source entity (a source entity may match more than one target entity positioned at a different location). This must be preceded by a call to Model.hm_compareinit().

These results can then be queried using hm_compareget* APIs, or written to a file using hm_comparewrite* APIs.

Parameters:
  • source_surfaces (Collection) – The collection containing the source entities. Valid entities are surfaces or elements.

  • target_surfaces (Collection) – The collection containing the target entities. Valid entities are surfaces or elements.

  • tolerance (double) – The tolerance value to use for the comparison.

  • result_type (int) –

    SURFS to SURFS

    0 - Basic

    Matched (paired)

    Unmatched

    1 - Full (default)

    Matched (paired)

    Overlapped

    Intersected

    Unmatched

    2 - Detailed

    Matched (paired)

    Overlapped (paired)

    Intersected (paired)

    Unmatched

  • review_results (bool) –

    False - Do not automatically show the graphical comparison results after execution.

    True - Automatically show the graphical comparison results after execution (default). This is cleared upon a call to hm_compareend.

Returns:

Example#

Write the detailed comparison results file to “ C:/temp / my_compare.txt “ for the recursive comparison of surfs with IDs 1 - 20 and 101 - 120#
import hm
import hm.entities as ent

model = hm.Model()

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

model.hm_compareinit()

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

model.hm_comparewriteresults(
    filename="C:/temp/my_compare.txt", source_component_id=0, target_component_id=0
)

model.hm_compareend()