我有一个对象,我从我的程序中在AutoCAD中绘制。在对象被绘制后,我设置相机以便它缩放到从俯视图望向墙壁的位置。然后我想让它向前视图旋转45度并向左视图旋转45度。这本质上模仿了在AutoCAD中选择对象然后单击视图立方体的操作。
这是我的轨道方法。
问题在于当我传递墙对象的中点时,它会绕摄像机轨道运动,以至于它非常远(在视图的左上部分)。
有人知道如何通过C#轻松地围绕AutoCAD中选择的对象进行旋转吗?谢谢!
/// <summary>
/// Orbit the angle around a passed axis
/// </summary>
public static void Orbit(Vector3d axis, Point3d pivotPoint, Angle angle)
{
Editor activeEditor = AcadApp.DocumentManager.MdiActiveDocument.Editor; //Get editor for current document
ViewTableRecord activeView = activeEditor.GetCurrentView(); //Get current view table
activeView.ViewDirection = activeView.ViewDirection.TransformBy(Matrix3d.Rotation(angle.Radians, axis, pivotPoint)); //Adjust the ViewTableRecord
activeEditor.SetCurrentView(activeView); //Set it as the current view
}
这是我调用轨道方法的方式
CameraMethods.Orbit(Vector3d.XAxis, GeometryAdapter.ClearspanPointToAcadPoint(wallToZoomTo.FrontLine.MidPoint), new Angle(AngleType.Radian, Math.PI / 4));
CameraMethods.Orbit(Vector3d.ZAxis, GeometryAdapter.ClearspanPointToAcadPoint(wallToZoomTo.FrontLine.MidPoint), new Angle(AngleType.Radian, Math.PI / 4));
问题在于当我传递墙对象的中点时,它会绕摄像机轨道运动,以至于它非常远(在视图的左上部分)。
有人知道如何通过C#轻松地围绕AutoCAD中选择的对象进行旋转吗?谢谢!