Model.hm_comparewriteresults#

Model.hm_comparewriteresults(filename, source_component_id=0, target_component_id=0)#

Writes the current comparison results to a file. This must be preceded by a call to a relevant hm_compareentities function.

If Model.hm_comparesetflags() is set to 1, the pairwise data can be seen in the output file, otherwise the legacy output will be generated. The optional arguments are only valid when Model.hm_comparesetflags() is set to 1.

Parameters:
  • filename (hwString) – The full name and path of the file to write the results to.

  • source_component_id (int) – If ignored, or set to 0, all the compared data corresponding to all source components will be generated. If a valid source ID is given, the compared data for the corresponding source component is generated.

  • target_component_id (int) – If ignored, or set to 0, all the compared data corresponding to all target components will be generated. If a valid target ID is given, the compared data for the corresponding target component is generated.

Returns:

Example#

Compare elements from components with IDs 1 and 2 and write the pairwise results for source component with ID 10 and target component with ID 20 to “ C:/temp / pairwise_compare.txt “#
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,
)

model.hm_comparewriteresults(
    filename="C:/temp/pairwise_compare.txt", source_component_id=10, target_component_id=20
)

model.hm_compareend()