Skip to main content
1-Visitor
March 7, 2011
Question

Can someone explain the 3d transform command for Cad Process?

  • March 7, 2011
  • 1 reply
  • 2960 views

I'm wondering how you use the 3d transform command within macros.

I want to let users set a rotation angle and then click on x, y or z icons to rotate that amount on a 3d drawing.

Problem is that macro help doesn't explain how it's used.

The syntax is just:

3D TRANSFORM 3d-matrix

and the example is:

#stretching the drawing to double size

#along the y-axis
3D TRANSFORM 1 0 0 0 0 2 0 0 0 0 1 0 0 0 0 0

I can't find any reference to this 3d-matrix - how are we to know what each number represents?

I've recorded some macros setting the Y angle rotation to 90 degrees but this hasn't helped me understand the matrix any better as it comes up with:

3D Transform 0 0 (-1) 0 0 1 0 0 1 0 0 0 0 0 0 1

No record of 90 degrees in that matrix, so I guess one of the numbers - "1" or "(-1)" must refer to the 90 degrees.

    1 reply

    1-Visitor
    March 15, 2011

    You can read the 16 values as the four rows of a 4x4 transformation matrix.
    Here you can find a nice short description how to get such a matrix from rotation values:

    http://planning.cs.uiuc.edu/node104.html


    E.g.:

    Macro Rotate_3d_y
    Define beta as Float
    beta = Get Float "Rotation angle around y "
    3D Transform \
    cos(beta) 0 sin(beta) 0 \
    0 1 0 0 \
    (-sin(beta)) 0 cos(beta) 0 \
    0 0 0 1
    End Macro

    TimSharp1-VisitorAuthor
    1-Visitor
    March 16, 2011

    Thanks for that.

    I won't pretend to understand it, but at least it explains that the numbers all represent something and I'll work on your example - much appreciated.