Skip to content

Latest commit

 

History

History
51 lines (38 loc) · 1.37 KB

File metadata and controls

51 lines (38 loc) · 1.37 KB

ViewportTable Class

Overview

The ViewportTable class is a symbol table that contains viewport configurations in an AutoCAD drawing.

Namespace

Autodesk.AutoCAD.DatabaseServices

Inheritance Hierarchy

System.Object
  └─ RXObject
      └─ DBObject
          └─ SymbolTable
              └─ ViewportTable

Key Methods

Method Return Type Description
Has(string) bool Checks if a viewport config exists by name
this[string] ObjectId Gets viewport ObjectId by name (indexer)

Code Examples

Example 1: Accessing Viewport Table

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();
}

Related Objects

  • Database - Contains ViewportTableId
  • ViewportTableRecord - Viewport configuration

References