[c#]代码库
Autodesk.Revit.DB.Location columnLocation = familyComponent.Location;
// get the location object
Autodesk.Revit.DB.LocationPoint pointLocation = columnLocation as Autodesk.Revit.DB.LocationPoint;
Autodesk.Revit.DB.XYZ insertPoint = pointLocation.Point;
// get the location point
double temp = pointLocation.Rotation;
//existing rotation
XYZ directionPoint = m_doc.Document.Application.Create.NewXYZ(0, 0, 1);
// define the vector of axis
Autodesk.Revit.DB.Line rotateAxis = m_doc.Document.Application.Create.NewLineUnbound(insertPoint, directionPoint);
double rotateDegree = m_receiveRotationTextBox * Math.PI / 180;
// rotate column by rotate method
if (m_isAbsoluteChecked)
{
rotateDegree -= temp;
}
bool rotateResult = pointLocation.Rotate(rotateAxis, rotateDegree);
if (rotateResult == false)
{
MessageBox.Show("Rotate Failed.");
}