How rotations are really applied ?

How rotations are really applied ?

Anonymous
Not applicable
681 Views
3 Replies
Message 1 of 4

How rotations are really applied ?

Anonymous
Not applicable

Hi,

I've calculated translation parameters and rotation parameters by a least squares method to move a family to a wanted location. The problem is the folowing : as a french land surveyor, the coordinates system I used are very far from the point (0,0,0). Yet, the parameters I calculated are supposed to be applied from this point. To try to solve this problem I've created a project in which the survey point is (1000,5000,100) and the project base point is (1000,5000,0). All in meters. All my families are close to that point. My rotations angles are : close to 0 around axis X, close to 0 around axis Y, 45° around axis Z so around -0.78 radians. When I apply those, my family barely moves. But the orientation is right so I guess it does not apply those rotations from (0,0,0). This is how i do it :

ElementTransformUtils.RotateElement(doc, gr, axeX, X2[3, 0]);
ElementTransformUtils.RotateElement(doc, gr, axeY, X2[4, 0]);
ElementTransformUtils.RotateElement(doc, gr, axeZ, X2[5,0]);

(my paremeters are in double[,] X2)

The problem is that my translations parameters are HUGE since my family is supposed to be moved very far. So I guess I have two choices:

 

Either I can manage to apply my transformation from the point (0,0,0) and problem solved (unless Revit does not allow too extended-in-space projects),

Or if I could retrieve from which point the rotation is applied (maybe the SP or the PBP ? I don't know) I could just translate all my coordinates of my data before the least squares and calculate the parameters corresponding to a rotation applied from said point.

 

Anyone knows how to do either/both ?

 

Thanks in advance,

 

Jordi

0 Likes
Accepted solutions (1)
682 Views
3 Replies
Replies (3)
Message 2 of 4

Anonymous
Not applicable

I just tried changing my coordinates by substracting the survey point coordinates to all my coordinates prior to my least square calculation. I get good rotation parameters (the family seems to be oriented like it should) but I still got translations problems. They are not huge anymore but my Y translation is around -1.39 meters while it should be 0. X and Z translation seems fine. Either the survey point is not the point I'm looking for, or it is somehow related to the view (or the workplane like PickPoint does) I'm in and that'd be bad for me. I still could use the (0,0,0) point if I  knew how.

 

Jordi

0 Likes
Message 3 of 4

Anonymous
Not applicable

No one knows ?

Maybe I'm doing something wrong with my axis definition ?

 

Line axeX=Line.CreateBound(new XYZ(0,0,0),new XYZ(1,0,0));
Line axeY = Line.CreateBound(new XYZ(0, 0, 0), new XYZ(0, 1, 0));
Line axeZ = Line.CreateBound(new XYZ(0, 0, 0), new XYZ(0, 0, 1));

 

Jordi

0 Likes
Message 4 of 4

Anonymous
Not applicable
Accepted solution

If anyone's wondering, I found a workaround.

My hypothesis is that rotations are applied from a point in the window, so depending how you visualize your project, it's not the same.

What I did was, prior to the calculation of my rotations angle, substract to all my coordinates the coordinates of my survey point. That allows me to calculate the rotation parameters as if my 3D object was close to the origin. That way translation stay small. But it doesnt move the object to the right position since the survey point is not the base point of the rotation. However, the angle is right : the family is well oriented, just not at the right position. To fix this you just need to calculate new translation parameters, and only translation. Since translation are not depending on a particular point, it works just fine and your family is placedjust right.

 

Jordi

0 Likes