RobotStudio event

Program displacement



Hi All,
I have a problem making a program displacement. Let me try to explain:
I have a robtarget with a rot of [0,-1,0,0]. On a main computer a displacement is made of -90 degrees on Y-ax this position. with a posemult this rot is changed. So far so good; if a make the displacement -80 everything goes well; when the displacemend <-83 it all goes wrong. The robot goes to a different position. Confused
Here is a part of the code:

! - Get XYZ translations opposite to the current position

Xpp:=pPositions{OffsetPosition}.trans.x;

Ypp:=pPositions{OffsetPosition}.trans.y;

Zpp:=pPositions{OffsetPosition}.trans.z;

! - Get the wanted rotation opposite to the current rotation

Point.rot:=pPositions{OffsetPosition}.rot;

! - Get the current rotation of the used robtarget

BasePos.rot:=ORIENTZYX(EulerZYX(,basePosition.rot),EulerZYX(Y,basePosition.rot),EulerZYX(X,basePosition.rot));

! -Calculate the final rotation

FinalPos:=PoseMult(BasePos,Point);

! - Build the final robtarget

Position:=Offs(basePosition,Xpp,Ypp,Zpp);

Position.rot:=FinalPos.rot;

Please let me know your thoughts