How to read ViewPort ??
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
I having some questions on paper space records/layout's.
Can we read ViewPort geometry entities.? Is it possible to get whatever data present inside the ViewPort. ?
Can we get scale value for multiple viewports ?
I have written some sample code, to read all the layouts from dwg file. I am trying to read each layout, in that I am able to read other entities like Circle/polyline/Line etc but I am not able to read Viewport.
Can you please have a look on below sample code.
Thanks in advance ‼!
Regards,
Dinesh
dinesh.gavsane@vaal-triangle.com
DBDictionary layoutListRecord = transaction.GetObject(this.database.LayoutDictionaryId, OpenMode.ForRead) as DBDictionary;
if (layoutListRecord != null)
{
// Step through and list each named layout and Model
foreach (DBDictionaryEntry item in this.layoutListRecord)
{
string layoutName = item.Key;
// Get the layout and block objects from the external drawing
Layout layEx = this.layoutListRecord.GetAt(layoutName).GetObject(OpenMode.ForRead) as Layout;
BlockTableRecord blkBlkRecEx = transaction.GetObject(layEx.BlockTableRecordId, OpenMode.ForRead) as BlockTableRecord;
foreach (ObjectId id in blkBlkRecEx)
{
var entity = transaction.GetObject(id, OpenMode.ForRead) as Entity;
if (null == entity)
continue;
if (entity is Viewport)
{
// How to use this viewport
//I want to read the geometry entities from viewport
Viewport vPort = entity as Viewport;
}
}
}
}