The ViewportTable class is a symbol table that contains viewport configurations in an AutoCAD drawing.
Autodesk.AutoCAD.DatabaseServices
System.Object
└─ RXObject
└─ DBObject
└─ SymbolTable
└─ ViewportTable
| Method | Return Type | Description |
|---|---|---|
Has(string) |
bool |
Checks if a viewport config exists by name |
this[string] |
ObjectId |
Gets viewport ObjectId by name (indexer) |
using (Transaction tr = db.TransactionManager.StartTransaction())
{
ViewportTable vpt = tr.GetObject(db.ViewportTableId, OpenMode.ForRead) as ViewportTable;
ed.WriteMessage("\nViewport configurations:");
foreach (ObjectId vpId in vpt)
{
ViewportTableRecord vptr = tr.GetObject(vpId, OpenMode.ForRead) as ViewportTableRecord;
ed.WriteMessage($"\n {vptr.Name}");
}
tr.Commit();
}- Database - Contains ViewportTableId
- ViewportTableRecord - Viewport configuration