hm_mapelementstoplane
Fast unfolding of a given set of connected shell elements onto a plane.
Syntax
hm_mapelementstoplane mark_id
Type
HyperMesh Tcl Query Command
Description
This command performs fast unfolding of a given set of connected shell elements onto a plane, while minimizing deformation for each element. The result is returned as a list with a number of entries equal to the number of nodes in the set of selected elements: { { id1 u1 v1 } { id2 u2 v2} ... }. Each entry in the list consists of the node ID and mapped node u-v coordinates onto the plane.
Inputs
- mark_id
- The ID of the mark containing the shell elements to map. Valid values are 1 and 2.
Example
To get the mapping for all elements to a plane, and to translate the nodes to that plane:
*createmark elems 1 all
set node_map2d [ hm_mapelementstoplane 1 ]
# Move each node to its 2D position (flatten the mesh)
foreach node $node_map2d {
# Node id, and calculated u, v on a plane
set node_id [ lindex $node 0 ]
set node_u [ lindex $node 1 ]
set node_v [ lindex $node 2 ]
# Current coordinates
set node_x [ hm_getvalue nodes id=$node_id dataname=globalx]
set node_y [ hm_getvalue nodes id=$node_id dataname=globaly]
set node_z [ hm_getvalue nodes id=$node_id dataname=globalz]
# u will be new node's x, v will be new node's y, new z will be 0
set vector_x [ expr $node_u - $node_x ]
set vector_y [ expr $node_v - $node_y ]
set vector_z [ expr - $node_z ]
*createvector 1 $vector_x $vector_y $vector_z
# Calculate translation distance used by 'translatemark' (vector magnitude is ignored there)
set dist [expr sqrt( $vector_x * $vector_x + $vector_y * $vector_y + $vector_z * $vector_z )]
# Select and translate the node
*createmark nodes 1 $node_id
*translatemark nodes 1 1 $dist
}
Errors
Incorrect usage results in a Tcl error. To detect
errors, you can use the catch
command:
if { [ catch {command_name...} ] } {
# Handle error
}
Version History
2023 - Deprecated argument panel_sensitive.