The AcDbHostApplicationServices class provides various services to host applications at runtime.

This class implements the singleton pattern and manages:

  • Working database reference
  • Layout manager instance
  • Other application-wide services
const services = acdbHostApplicationServices();
services.workingDatabase = new AcDbDatabase();
const layoutManager = services.layoutManager;

Properties

The singleton instance of AcDbHostApplicationServices

Accessors

  • get layoutManager(): AcDbLayoutManager
  • Gets the layout manager instance.

    The layout manager is responsible for managing layout objects in the application. This is a singleton instance that is created when the AcDbHostApplicationServices is instantiated.

    Returns AcDbLayoutManager

    The layout manager instance

    const services = acdbHostApplicationServices();
    const layoutManager = services.layoutManager;
    // Use the layout manager
  • get workingDatabase(): AcDbDatabase
  • Gets the current working database.

    The working database is the primary database that the application is currently operating on. This must be set before it can be accessed.

    Returns AcDbDatabase

    The current working database

    When the working database has not been set

    const services = acdbHostApplicationServices();
    try {
    const db = services.workingDatabase;
    // Use the database
    } catch (error) {
    console.error('Working database not set');
    }
  • set workingDatabase(database: AcDbDatabase): void
  • Sets the working database.

    This method sets the database that will be used as the current working database for the application. This database will be returned by the workingDatabase getter.

    Parameters

    • database: AcDbDatabase

      The database to make the new working database

    Returns void

    const services = acdbHostApplicationServices();
    const db = new AcDbDatabase();
    services.workingDatabase = db;