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.
Solved! Go to Solution.
Solved by jeremytammik. Go to Solution.
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
Added it to The Building Coder:
http://thebuildingcoder.typepad.com/blog/2015/06/create-duct-pipe-and-point-transform.html#3
Cheers,
Jeremy