Represents a CAD document that manages a drawing database and associated metadata.

This class handles:

  • Opening CAD files from URIs or file content (DWG/DXF formats)
  • Managing document properties (title, access mode)
  • Providing access to the underlying database
  • Handling file loading errors through event emission

Constructors

Accessors

  • get docTitle(): string

    Gets the display title of the document.

    Returns string

    The title of the document

  • set docTitle(value: string): void

    Sets the display title of the document.

    Notes: The browser tab title isn't updated on purpose because users may use it as one component and don't want to the browser tab title changed. So if you want to change the browser tab title, you can listen events AcApDocManager.events.documentActivated to change it in your event listener.

    Parameters

    • value: string

      The new document title

    Returns void

Methods

  • Opens a CAD document from file content.

    Parameters

    • fileName: string

      The name of the file (used to determine file type from extension)

    • content: ArrayBuffer

      The file content as string or ArrayBuffer

    • options: AcApOpenDatabaseOptions

      Options for opening the database

    Returns Promise<boolean>

    Promise resolving to true if successful, false if failed

    const fileContent = await fetch('drawing.dwg').then(r => r.arrayBuffer());
    const success = await document.openDocument('drawing.dwg', fileContent, {
    mode: AcEdOpenMode.Write
    });