Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Cannot figure out how the Transform.CreateRotationAtPoint() works! Help

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
redskyrc
2429 Views, 2 Replies

Cannot figure out how the Transform.CreateRotationAtPoint() works! Help

I am trying to take an XYZ point and rotate it 1Pi (180 degrees) around another base point. I think I got the correct method but I cannot figure out how to use it. See image attached

 

Base point = XYZ Origin? Is the base point considered the origin? I think so...

How do I define the AXIS using an XYZ? Does anyone have an image to explain this? I couldn't find any documentation. I want to rotate the point along the XY plane (in plan orientation).

The angle is in Radians, I got that one.

 

Transform transf = Transform.CreateRotationAtPoint(new XYZ(Origin.X,Origin.Y,Origin.Z +1), Math.Pi, Origin);

 

transf.whatMethodHereToGetNewXYZLocationOfPoint?

 

Once I get the transform, how do I get the new XYZ location of my rotated point?

 

thanks.

2 REPLIES 2
Message 2 of 3
jeremytammik
in reply to: redskyrc

Dear Redsky,

 

Transform.CreateRotation

creates a rotation transformation given just two arguments, the rotation axis and angle.

 

CreateRotationAtPoint takes three arguments: the axis, rotation angle and base point.

 

Here is one short description of how not to use CreateRotationAtPoint  🙂

 

http://thebuildingcoder.typepad.com/blog/2014/02/different-revit-api-aspects-and-features.html#5.2

 

To define an axis by an XYZ, simply cnsider the XYZ a vector instead of a point.

 

In your case, to determine the rotation of the point pOld to the result pNew by 180 degrees around the base point base_point in the XY plane, i.e., around the Z axis, you can do this:

 

  XYZ axis = XYZ.BasisZ;
  double angle = Math.PI;
  Transform t = Transform.CreateRotationAtPoint(
    axis, angle, base_point );
  XYZ pNew = t.OfPoint( pOld );

 

Cheers,

 

Jeremy



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 3 of 3
jeremytammik
in reply to: jeremytammik

Added it to The Building Coder:

 

http://thebuildingcoder.typepad.com/blog/2015/06/create-duct-pipe-and-point-transform.html#3

 

Cheers,

 

Jeremy



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Rail Community