Model.hm_finddeviation#

Model.hm_finddeviation(source_collection, target_collection, tolerance_value)#

Finds and returns the deviating component pairs data for a given set of selected components.

Parameters:
  • source_collection (Collection) – The collection containing the source entities. Currently supported for components only.

  • target_collection (Collection) – The collection containing the target entities. Currently supported for components only.

  • tolerance_value (double) – The tolerance value.

Returns:

  • hwReturnStatus - Status object

  • HmQueryResult - Result object containing the output values:

    • sourceString (str)

    • sourceComponent (Entity) - The source component entity.

    • targetString (str)

    • targetComponent (Entity) - The target component entity.

    • unmatchString (str)

    • unmatch (double) - The approximate percentage of unmatched area between the two components.

    • deviationdataString (str)

    • deviationdata (HmQueryResultList)-Result list object containing HmQueryResult objects with the following output data:

      • sourcePointCoordinates (numpy.ndarray) - The coordinates of the point on the source component where the deviation occurs.

      • targetPointCoordinates (numpy.ndarray) - The coordinates of the point on the target component where the deviation occurs.

      • sourceSurface (Entity) The surface entity on the source component that contains the source point.

      • targetSurface (Entity) - The surface entity on the target component that contains the target point.

      • deviationDistance (double) - The distance between the source point and the target point.

Example#

Get the deviation information between components with IDs 81 and 88 use a tolerance of 0.01#
import hm
import hm.entities as ent

model = hm.Model()

_ , result = model.hm_finddeviation(
  source_collection=hm.Collection(model, ent.Component, [81]),
  target_collection=hm.Collection(model, ent.Component, [88]),
  tolerance_value=0.01
)

print("sourceString", result.sourceString)
print("sourceComponent", result.sourceComponent)
print("targetString", result.targetString)
print("targetComponent", result.targetComponent)
print("unmatchString", result.unmatchString)
print("unmatch", result.unmatch)
print("deviationdataString", result.deviationdataString)

deviationdata = result.deviationdata

for data in deviationdata:
  print(sourcePointCoordinates, data.sourcePointCoordinates)
  print(targetPointCoordinates, data.targetPointCoordinates)
  print(sourceSurface, data.sourceSurface)
  print(targetSurface, data.targetSurface)
  print(deviationDistance, data.deviationDistance)