cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

How to use Euler sequences

dhancock
Newbie

How to use Euler sequences

I'm trying to write a LISP function to let me add Coordinate Systems with Body Euler Sequences using Pitch, Yaw, Roll.

So far I can create a coordinate system and set an offset it, but I can't seem to rotate it using LISP calls.

Is this even close or is there a something completely different that does the same thing?

Thanks,

Damion

(use-package :oli)

(defun create-cs-pyr (frame-name owner-path parent-cs x y z pitch yaw roll)

(let ( (frame-path nil) (frame-obj nil)(origin nil) (x-dir nil) (y-dir nil) (z-dir nil))

(pos_create_coordinate_system :owner owner-path :name frame-name :u_name "x" :v_name "y"

:w_name "z" :by_ref_coord_sys :ref_coord_sys parent-cs :offset_u x :offset_v y :offset_w z

:done)

(complete)

(setq frame-path (concatenate 'string owner-path "/" frame-name))

(setq frame-obj (sd-pathname-to-obj frame-path))

(setq origin (getf (sd-inq-coord-sys-elem-value frame-obj :origin t ) :origin))

(setq y-dir (getf (sd-inq-coord-sys-elem-value frame-obj :y-axis t ) :y-axis))

;; How to get this to work or something similar? Once the coordinate system is rotated about the y-axis (Pitch), I'd like to query the new orientation and

;; do the yaw and roll?

(pos_create_coordinate_system :action :position :coord_sys frame-obj :rotate :axis :pt_dir origin (second y-dir) :rotation_angle (sd-deg-to-rad pitch) complete)

(setq z-dir (getf (sd-inq-coord-sys-elem-value frame-obj :z-axis t ) :z-axis ))

(setq x-dir (getf (sd-inq-coord-sys-elem-value frame-obj :x-axis t ) :x-axis ))

)

)


This thread is inactive and closed by the PTC Community Management Team. If you would like to provide a reply and re-open this thread, please notify the moderator and reference the thread. You may also use "Start a topic" button to ask a new question. Please be sure to include what version of the PTC product you are using so another community member knowledgeable about your version may be able to assist.
2 REPLIES 2

Re: How to use Euler sequences

I'm having a similar problem in regular Pro/TOOLKIT. The functions to get transformations between coordinate systems (ProAsmcomppathTrfGet) return in transformatrices, not in angles... but the feature element tree for angles require rotations in degrees. Could use any input if someone has background or advice.

President & Founder
CadActive Technologies - www.cadactive.com

Re: How to use Euler sequences

Hi,

this is my function to convert a transformation to three angles......

Hope this helps.

Andreas

ProError tools_angles_from_transformation_get (ProMatrix hTransform, double *dRotX, double *dRotY, double *dRotZ)
{
double dX, dY, dZ;
long lY;

// calculate "Euler angles" from transformation:
if (hTransform[0][2]>1 || hTransform[0][2]<-1)
{
  lY = (long)(-hTransform[0][2]*10000);
  dY = asin ((double)(lY/10000));
}
else
  dY = asin (-hTransform[0][2]);

if (fabs (dY) < (2*PI/4.0 - 0.0008))
{
   dX = atan2 (hTransform[1][2], hTransform[2][2]);
   dZ = atan2 (hTransform[0][1], hTransform[0][0]);
}
else
{
   dX = 0.0;
   dZ = atan2(-hTransform[1][0], hTransform[1][1]);
}

// rad to deg
dX = dX*180.0 / (6*asin(0.5));
dY = dY*180.0 / (6*asin(0.5));
dZ = dZ*180.0 / (6*asin(0.5));

*dRotX = dX;
*dRotY = dY;
*dRotZ = dZ;


return (PRO_TK_NO_ERROR);
}

Announcements