Model.hm_comparefinddistances#

Model.hm_comparefinddistances(max_distance, review_results=True)#

Calculates the distance between all source and target entities. This must be preceded by a call to a relevant hm_compareentities function. Only the distances for the target entities are calculated. The results can be contoured or queried.

Parameters:
  • max_distance (double) – The maximum distance to use in the calculation. A smaller value results in faster computation time.

  • 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 Model.hm_compareend().

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)

model.hm_comparesetreview(type=2)

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

model.hm_compareend()