Model.hm_geomfindsymmetry#
- Model.hm_geomfindsymmetry(collection1, collection2, tolerance=0.000000, transformation=hwMatrix44(1.0))#
Finds and returns the symmetry transformation matrix and matched/unmatched surfaces between two selections.
- Parameters:
collection1 (Collection) – The collection containing the first input set of entities to find symmetry for.
collection2 (Collection) – The collection containing the second input set of entities to find symmetry for.
tolerance (double) – This value is used as the tolerance for comparison. If not supplied, the default geometry cleanup tolerance will be used. If the tolerance and transformation are not supplied, the best possible transformation is reported along with the calculated deviation.
transformation (hwMatrix44) – This is a list of 16 float values, a11-a44, which are the components of the 4x4 transformation matrix that maps the first selection of entities (
collection1) to the second (collection2). This argument is optional for surfaces entities. If not supplied, the transformation will be computed automatically if possible.
- Returns:
hwReturnStatus- Status objectHmQueryResult- Result object containing the output values:transformationMatrix (numpy.ndarray) - An array of 16 float values defining the transformation matrix (either computed automatically or supplied by the user)
matchedPairs (
HmQueryResultList) - Result list object containingHmQueryResultobjects with the following output data:sourceEntity (Entity) - Source entity in matched pair, the entity type is the same with
collection1,collection2.targetEntity (Entity) - Target entity in matched pair, the entity type is the same with
collection1,collection2.
unmatchedSourceEntities (EntityList) - The list of of unmatched entities from
collection1unmatchedTargetEntities (EntityList) - The list of of unmatched entities from
collection2maxDeviation (double) - The maximum deviation between source and target matched entities
maxDeviationCoords (
HmQueryResult) - Result object containing the output values:sourceCoord (numpy.ndarray) - The coordinate array on source matched entities where the maximum deviation occcurs
targetCoord (numpy.ndarray) - The coordinate array on target matched entities where the maximum deviation occcurs
Examples#
Find the symmetry between the surfaces in components named “a” and “b” , use automatic calculations.#import hm import hm.entities as ent model = hm.Model() component_collection_a = hm.Collection(model, ent.Component, "name=a") component_collection_b = hm.Collection(model, ent.Component, "name=b") _, result = model.hm_geomfindsymmetry( collection1=component_collection_a, collection2=component_collection_b ) print("transformationMatrix:", result.transformationMatrix) # Matched pairs for me in result.matchedPairs: print("Matched Pair - sourceEntity:", me.sourceEntity) print("Matched Pair - targetEntity:", me.targetEntity) print("unmatchedSourceEntities:", [e.id for e in result.unmatchedSourceEntities]) print("unmatchedTargetEntities:", [e.id for e in result.unmatchedTargetEntities]) print("maxDeviation:", result.maxDeviation) # Max Deviation coordinates for mc in result.maxDeviationCoords: print("Max deviation - sourceCoord:", mc.sourceCoord) print("Max deviation - targetCoord:", mc.targetCoord)
Find the symmetry between the surfaces in components named “a” and “b” , usetolerance=10**(-5), use automatic calculations.#import hm import hm.entities as ent model = hm.Model() component_collection_a = hm.Collection(model, ent.Component, "name=a") component_collection_b = hm.Collection(model, ent.Component, "name=b") _, result = model.hm_geomfindsymmetry( collection1=component_collection_a, collection2=component_collection_b, tolerance=10**(-5), ) print("transformationMatrix:", result.transformationMatrix) # Matched pairs for me in result.matchedPairs: print("Matched Pair - sourceEntity:", me.sourceEntity) print("Matched Pair - targetEntity:", me.targetEntity) print("unmatchedSourceEntities:", [e.id for e in result.unmatchedSourceEntities]) print("unmatchedTargetEntities:", [e.id for e in result.unmatchedTargetEntities]) print("maxDeviation:", result.maxDeviation) # Max Deviation coordinates for mc in result.maxDeviationCoords: print("Max deviation - sourceCoord:", mc.sourceCoord) print("Max deviation - targetCoord:", mc.targetCoord)
Find the symmetry between the surfaces in components named “a” and “b”, usetolerance=1e-5and specify the transformation manually.#import hm import hm.entities as ent model = hm.Model() component_collection_a = hm.Collection(model, ent.Component, "name=a") component_collection_b = hm.Collection(model, ent.Component, "name=b") _, result = model.hm_geomfindsymmetry( collection1=component_collection_a, collection2=component_collection_b, tolerance=1e-5, transformation=[1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 7, 1], ) print("transformationMatrix:", result.transformationMatrix) # Matched pairs for me in result.matchedPairs: print("Matched Pair - sourceEntity:", me.sourceEntity) print("Matched Pair - targetEntity:", me.targetEntity) print("unmatchedSourceEntities:", [e.id for e in result.unmatchedSourceEntities]) print("unmatchedTargetEntities:", [e.id for e in result.unmatchedTargetEntities]) print("maxDeviation:", result.maxDeviation) # Max Deviation coordinates for mc in result.maxDeviationCoords: print("Max deviation - sourceCoord:", mc.sourceCoord) print("Max deviation - targetCoord:", mc.targetCoord)