Manipulate Viewport In Side Database

Manipulate Viewport In Side Database

drew_dewit
Advocate Advocate
174 Views
1 Reply
Message 1 of 2

Manipulate Viewport In Side Database

drew_dewit
Advocate
Advocate

I currently have a program making a new sheet and inserting a viewport in a side database. I am trying to figure out how I can switch to model space and zoom to a window in the side database. I can do this with the following code with the drawing open using the editor but would prefer not to.

 

//Activate model space in the viewport
doc.Editor.SwitchToModelSpace();

//Zoom to object
ZoomWindow(ed, viewminPt, viewmaxPt);

//Switch to Paper space
doc.Editor.SwitchToPaperSpace();

 

private static void ZoomWindow(Editor ed, Point3d min, Point3d max)
{
Point2d min2d = new Point2d(min.X, min.Y);
Point2d max2d = new Point2d(max.X, max.Y);
ViewTableRecord view = new ViewTableRecord();
view.CenterPoint = min2d + ((max2d - min2d) / 2.0);
view.Height = max2d.Y - min2d.Y;
view.Width = max2d.X - min2d.X;
ed.SetCurrentView(view);
}

 

Any help is appreciated.

0 Likes
175 Views
1 Reply
Reply (1)
Message 2 of 2

ActivistInvestor
Mentor
Mentor

The Editor.SetCurrentView() method applies only to the active document in the drawing editor. 

 

To change the view in a Viewport in a sideloaded database, you modify the Viewport object.

 

See these search results for numerous posts showing how to do that.

0 Likes