*transformmark

Transforms a selection of entities using a transformation matrix.

Syntax

*transformmark entity_type mark_id r1c1 r1c2 r1c3 r1c4 r2c1 r2c2 r2c3 r2c4 r3c1 r3c2 r3c3 r3c4 r4c1 r4c2 r4c3 r4c4

Type

HyperMesh Tcl Modify Command

Description

This command translates a selection of entities along a vector.

Inputs

entity_type
The type of entity to transform.
mark_id
The ID of the mark containing the entities. Valid values are 1 and 2.
r1c1-r4c4
The 4x4 transformation matrix, in row-column order. This matrix defines the reflection, rotation, scaling and translation applied to the entities.
The scaling is in r1c1(x), r2c2(y), and r3r3(z).
The translation is in r4c1 (x), r4c2 (y), and r4c3 (z).
The rotation is in the upper 3x3 matrix.
The last column is for reflection.
The steps to use to calculate the matrix are as follows:
  1. Calculate the angle in radians.
  2. Construct a matrix to translate from the rotation point to (0,0,0).
  3. Construct a second matrix to handle the actual rotation.
  4. Multiply matrix(step2) X matrix(step3).
  5. Construct a third matrix to translate back to the rotation point.
  6. Multiply matrix(step4) X matrix(step5).

Example

To rotate all displayed nodes 30 degrees about the x-axis through the point (0,0,0):

1 0 0 0
0 0.86603 0.5 0
0 -0.5 0.86603 0
0 0 0 1
*createmark nodes 1 displayed
*transformmark nodes 1 1 0 0 0 0 0.86603 0.5 0 0 -0.5 0.86603 0 0 0 0 1

To rotate all elements 30 degrees about the x-axis through the point (5,10,6):

1 0 0 0
0 1 0 0
0 0 1 0
-5 -10 6 1

x

1 0 0 0
0 0.86603 0.5 0
0 -0.5 0.86603 0
0 0 0 1

=

1 0 0 0
0 0.86603 0.5 0
0 -0.5 0.86603 0
-5 -5.6603 -10.1962 1

x

1 0 0 0
0 1 0 0
0 0 1 0
5 10 6 1

=

1 0 0 0
0 1 0 0
0 0 1 0
5 10 6 1
*createmark elems 1 all
*transformmark elems 1 1 0 0 0 0 0.86603 0.5 0 0 -0.5 0.86603 0 0 4.3397 -4.1962 1

Errors

Incorrect usage results in a Tcl error. To detect errors, you can use the catch command:
if { [ catch {command_name...} ] } {
   # Handle error
}