Model.hm_comparereadfile#

Model.hm_comparereadfile(filename, overwrite)#

Reads comparison data (transformations, match types, match entities, etc…) from a file into the comparison database. This must be preceded by a call to Model.hm_compareinit().

This is useful for large comparisons that take a lot of time to generate. The data can be saved to a file and reloaded in a new session to save time.

Parameters:
  • filename (hwString) – The full name and path of the file to read the data from.

  • overwrite (bool) –

    0 - Do not overwrite existing comparison results

    1 - Overwrite existing comparison results

Returns:

Examples#

Write the detailed comparison results file to “ C:/temp / my_compare.txt “ for the same side comparison of surfaces 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_compareentitiessameside(
    source_entities=surfs1,
    target_entities=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()
Read the comparison data file from C:/temp / my_compare.txt and review the distances#
import hm
import hm.entities as ent

model = hm.Model()

model.hm_compareinit()

model.hm_comparereadfile(filename="C:/temp/my_compare.txt", overwrite=1)

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

model.hm_comparesetreview(type=2)

model.hm_compareend()