Represents the stored characteristics of each paperspace layout.

Layout objects are stored in an AcDbDictionary object with an ACAD_LAYOUT key, allowing easy iteration and indexing. Each layout represents a paperspace configuration that can be used for printing or plotting.

const layout = new AcDbLayout();
layout.layoutName = 'A4 Landscape';
layout.tabOrder = 1;
layout.limits = new AcGeBox2d();

Hierarchy (View Summary)

Constructors

Accessors

  • get blockTableRecordId(): string
  • Gets the associated block table record ID of this layout.

    Returns string

    The block table record ID

    const blockId = layout.blockTableRecordId;
    
  • set blockTableRecordId(value: string): void
  • Sets the associated block table record ID of this layout.

    Parameters

    • value: string

      The new block table record ID

    Returns void

    layout.blockTableRecordId = 'some-block-id';
    
  • get database(): AcDbDatabase
  • Gets the database in which this object is resident.

    When an object isn't added to a database, this property returns the current working database. After it is added to a database, it will be set automatically. You should never set this value manually.

    Returns AcDbDatabase

    The database this object belongs to

    const db = obj.database;
    
  • set database(db: AcDbDatabase): void
  • Sets the database for this object.

    This is typically set automatically when the object is added to a database. Manual setting should be avoided unless you know what you're doing.

    Parameters

    Returns void

    obj.database = myDatabase;
    
  • get extents(): AcGeBox3d
  • Gets the current extents setting of the layout.

    This value may not be the actual extents of the geometry in the layout, it is just the value last saved in the layout.

    Returns AcGeBox3d

    The layout extents as a 3D bounding box

    const extents = layout.extents;
    console.log('Layout extents:', extents);
  • set extents(value: AcGeBox3d): void
  • Sets the current extents setting of the layout.

    Parameters

    • value: AcGeBox3d

      The new layout extents as a 3D bounding box

    Returns void

    layout.extents = new AcGeBox3d();
    
  • get layoutName(): string
  • Gets the user-friendly layout name that is displayed in the tab control.

    Currently there is no restriction on the name except that the length is limited to 256 characters.

    Returns string

    The layout name

    const name = layout.layoutName;
    console.log('Layout name:', name);
  • set layoutName(value: string): void
  • Sets the user-friendly layout name that is displayed in the tab control.

    Parameters

    • value: string

      The new layout name (limited to 256 characters)

    Returns void

    layout.layoutName = 'A4 Landscape';
    
  • get objectId(): string
  • Gets the object ID.

    AutoCAD uses 64-bit integers to represent handles, which exceed the maximum integer value of JavaScript. Therefore, strings are used to represent object handles.

    Returns string

    The object ID as a string

    const id = obj.objectId;
    console.log(`Object ID: ${id}`);
  • set objectId(value: string): void
  • Sets the object ID.

    Parameters

    • value: string

      The new object ID

    Returns void

    obj.objectId = 'new-object-id';
    
  • get ownerId(): string
  • Gets the object ID of the owner of this object.

    Returns string

    The owner object ID

    const ownerId = obj.ownerId;
    
  • set ownerId(value: string): void
  • Sets the object ID of the owner of this object.

    Parameters

    • value: string

      The new owner object ID

    Returns void

    obj.ownerId = 'parent-object-id';
    
  • get tabOrder(): number
  • Gets the tab order field, which controls the order in which layouts are displayed.

    The tab order should be unique and sequential for each layout in the database.

    Returns number

    The tab order value

    const order = layout.tabOrder;
    
  • set tabOrder(value: number): void
  • Sets the tab order field, which controls the order in which layouts are displayed.

    Parameters

    • value: number

      The new tab order value

    Returns void

    layout.tabOrder = 1;
    
  • get tabSelected(): boolean
  • Gets whether the layout tab is included in the selection set for operations.

    This flag indicates whether the layout tab is included in the selection set for operations that affect multiple tabs. The user can perform multiple selection via the user interface using shift-click.

    Returns boolean

    True if the tab is selected, false otherwise

    const isSelected = layout.tabSelected;
    
  • set tabSelected(value: boolean): void
  • Sets whether the layout tab is included in the selection set for operations.

    Parameters

    • value: boolean

      True to select the tab, false to deselect it

    Returns void

    layout.tabSelected = true;
    

Methods

  • Closes the object.

    All changes made to the object since it was opened are committed to the database, and a "closed" notification is sent. This method can be overridden by subclasses to provide specific cleanup behavior.

    Returns void

    obj.close();
    
  • Gets the value of the specified attribute.

    This method will throw an exception if the specified attribute doesn't exist. Use getAttrWithoutException() if you want to handle missing attributes gracefully.

    Parameters

    • attrName: string

      The name of the attribute to retrieve

    Returns any

    The value of the specified attribute

    When the specified attribute doesn't exist

    try {
    const value = obj.getAttr('objectId');
    } catch (error) {
    console.error('Attribute not found');
    }
  • Gets the value of the specified attribute without throwing an exception.

    This method returns undefined if the specified attribute doesn't exist, making it safer for optional attributes.

    Parameters

    • attrName: string

      The name of the attribute to retrieve

    Returns any

    The value of the specified attribute, or undefined if it doesn't exist

    const value = obj.getAttrWithoutException('optionalAttribute');
    if (value !== undefined) {
    // Use the value
    }