Model.map_symmetric_mesh#
- Model.map_symmetric_mesh(source_collection, target_collection, param_strs)#
Maps the mesh from source surfaces to target surfaces with an optionally supplied transformation. The transformation can be supplied as a translation, a rotation, or a 4x4 transformation matrix. If not supplied, the transformation is computed internally. The tolerance for associating the mapped mesh to the underlying surface can also be supplied. If not given, the global node tolerance is used instead.
The output information is logged into two global arguments: “g_hw_argc” and “g_hw_argv”. These can be accessed after the execution of the function.
If a transformation was not supplied to the function, the internally computed transformation is logged in terms of translation and rotation. It also contains the general status of the function (whether the surfaces are symmetric or not).
- Parameters:
source_collection (Collection) – The collection containing the source entities. Valid only supported entities are surfaces.
target_collection (Collection) – The collection containing the target entities. Valid only supported entities are surfaces.
param_strs (hwStringList) –
The object defining the string list that contains the additional input parameters. Valid parameters and their syntax are:
rotation
angle: <angle in degrees>
axis: <axis, x component> <axis, y component > <axis, z component >
base: <base, x component> < base, y component > < base, z component >
Syntax:
"rotation: angle :<angle> axis : <axis, x component> <axis, y component > <axis, z component > base: <base, x component> < base, y component > < base, z component >"tolerance
Syntax:
"tolerance: <value>"transformation
If not defined the auto-detecting transformation is applied.
Syntax:
"transformation: <tr11> <tr12> <tr13> <tr14> <tr21> <tr22> <tr23> <tr24> <tr31> <tr32> <tr33> <tr34> <tr41> <tr42> <tr43> <tr44>"translation
Syntax:
"translation: <x component> <y component > <z component>"ElementMappingAsLists
If present, element lists 1 and 2 are populated with source and corresponding target elements, respectively. This is useful for determining the source-to-target element mapping. Case insensitive.
Syntax:
ElementMappingAsListsNodeMappingAsLists
If present, node lists 1 and 2 are populated with source and corresponding target nodes, respectively. This is useful for determining the source-to-target node mapping. Case insensitive.
Syntax:
NodeMappingAsListsPreferReflection
If present, reflective symmetry is preferred. Otherwise, other symmetries get preference over reflective symmetry. Case insensitive.
Syntax:
PreferReflection
Examples#
Map the mesh from surface with ID 10 to surface with ID 20 ( surfaces are symmetric ) with a translation along the y direction , and a rotation of 90 degrees along the global y - axis#import hm import hm.entities as ent import hw model = hm.Model() src_collection = hm.Collection(model, ent.Surface, [10]) tgt_collection = hm.Collection(model, ent.Surface, [20]) stringList = ["translation: 0 1 0", "rotation: angle :90 axis : 0 1 0 base: 0 0 0"] model.map_symmetric_mesh( source_collection=src_collection, target_collection=tgt_collection, param_strs=stringList, ) # Query the output information hw.evalTcl("return $g_hw_argc") # length of output string list hw.evalTcl("return $g_hw_argv")
Map the mesh from surface with ID 10 to surface with ID 20 , auto detect the transformation#import hm import hm.entities as ent import hw model = hm.Model() src_collection = hm.Collection(model, ent.Surface, [10]) tgt_collection = hm.Collection(model, ent.Surface, [20]) model.map_symmetric_mesh( source_collection=src_collection, target_collection=tgt_collection, param_strs=hm.hwStringList() )
Map the mesh from surface with ID 10 to surface with ID 20 , auto detect the transformation , and get the source to target node and element mappings#import hm import hm.entities as ent import hw model = hm.Model() src_collection = hm.Collection(model, ent.Surface, [10]) tgt_collection = hm.Collection(model, ent.Surface, [20]) stringList = ["NodeMappingAsLists", "ElementMappingAsLists"] model.map_symmetric_mesh( source_collection=src_collection, target_collection=tgt_collection, param_strs=stringList, ) # Query the output information hw.evalTcl("return $[hm_getlist nodes 1]") hw.evalTcl("return $[hm_getlist nodes 2]") hw.evalTcl("return $[hm_getlist elements 1]") hw.evalTcl("return $[hm_getlist elements 2]")
Do the mapping use a custom tolerance and transformation matrix#import hm import hm.entities as ent import hw model = hm.Model() src_collection = hm.Collection(model, ent.Surface, [10]) tgt_collection = hm.Collection(model, ent.Surface, [20]) stringList = ["transformation: 0 0 1 0 0 1 0 0 -1 0 0 0 2.5 0 12.5 1", "tolerance: 0.1"] model.map_symmetric_mesh( source_collection=src_collection, target_collection=tgt_collection, param_strs=stringList, ) # Query the output information hw.evalTcl("return $[hm_getlist nodes 1]") hw.evalTcl("return $[hm_getlist nodes 2]") hw.evalTcl("return $[hm_getlist elements 1]") hw.evalTcl("return $[hm_getlist elements 2]")
Do the mapping by auto - detect the transformation , and associate the mesh with the given tolerance#import hm import hm.entities as ent import hw model = hm.Model() src_collection = hm.Collection(model, ent.Surface, [10]) tgt_collection = hm.Collection(model, ent.Surface, [20]) stringList = ["tolerance: 0.1"] model.map_symmetric_mesh( source_collection=src_collection, target_collection=tgt_collection, param_strs=stringList, ) # Query the output information hw.evalTcl("return $[hm_getlist nodes 1]") hw.evalTcl("return $[hm_getlist nodes 2]") hw.evalTcl("return $[hm_getlist elements 1]") hw.evalTcl("return $[hm_getlist elements 2]")