I have an object that I draw in AutoCAD from my program. After the object is drawn, I have a camera installed, so that it scales to the wall, looking down from the top view. What I want to do then is turn 45 degrees down towards the front and 45 degrees left to left. This essentially simulates the selection of an object in AutoCAD, and then click 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 this is what 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 go to the middle of the wall object, it rotates the camera so that it is very far away (at the top, top left of the review somewhere)
Does anyone have the ability to easily navigate around a selected object in AutoCAD through C #? Thanks in advance!
source share