I have an object which I draw in AutoCAD from my program. After the object is drawn I have the camera set so that it zooms to the wall looking down from the top view. What I then want it to do is to orbit 45 degrees down toward front view and 45 degrees left toward left view. This essentially mimics selecting the object in AutoCAD and then clicking the view cube.
Here is my orbit method.
/// <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
}
And here is how I call the orbit method
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));
The problem is that when I pass in the midpoint of the wall object it orbits the camera so that it is very far away (way up in the upper left part of the view somewhere)
Does anyone have a way to easily orbit around a chosen object in AutoCAD via C#? Thanks in advance!