Hello Forum,
I have a drawing with a paperspace (AutoCAD 2016). In the paperspace I draw a rectangle. I use the command MVIEW to create a viewport of the rectangle (option OBJECT of the command MVIEW). Now the paperspace has 2 objects, the polyline and the viewport.
However, if I run the following code, it finds 3 objects. 1 polyline and 2 viewports:
// Get the BTR of the layout (paperspace). objBlockTableRecord = objTransaction.GetObject(objLayout.BlockTableRecordId, OpenMode.ForRead) as BlockTableRecord; oidcLayout = new ObjectIdCollection(); foreach (ObjectId oidItem in objBlockTableRecord) { oidcLayout.Add(oidItem); } // oidcLayouts[0] = polyline. // oidcLayouts[1] = viewport. // oidcLayouts[2] = viewport.
Can anyone explain where the second viewport comes from? It does not exist in the drawing.
Thank you.
Solved! Go to Solution.
Solved by ActivistInvestor. Go to Solution.
Solved by _gile. Go to Solution.
@Ertqwa wrote:Hello Forum,
I have a drawing with a paperspace (AutoCAD 2016). In the paperspace I draw a rectangle. I use the command MVIEW to create a viewport of the rectangle (option OBJECT of the command MVIEW). Now the paperspace has 2 objects, the polyline and the viewport.
However, if I run the following code, it finds 3 objects. 1 polyline and 2 viewports:
Can anyone explain where the second viewport comes from? It does not exist in the drawing.
Thank you.
Each Layout is itself, like a Viewport. Commonly called the paper space viewport. That viewport displays the contents of paper space (e.g., the contents of the layout's block). When a paper space layout is active and you are in paper space, that paper space viewport is the active viewport. You can't see it's border because it is coincident with the client rectangle of the document window,.
Thank you for the answers. Just what I needed.
The following code filters out the viewport associated with the paperspace.
if (!dbActive.GetViewports(true).Contains(oidItem) || dbActive.GetViewports(false).Contains(oidItem)) { // Process oidItem. }
Can't find what you're looking for? Ask the community or share your knowledge.