Command to zoom the view to fit all visible entities.

This command adjusts the view's zoom level and position to show all visible entities in the current drawing within the viewport. It's equivalent to the "Zoom Extents" or "Fit to Window" functionality found in most CAD applications.

The command calculates the bounding box of all visible entities and adjusts the camera to show them all with appropriate padding.

const zoomCommand = new AcApZoomCmd();
zoomCommand.globalName = 'ZOOM';
zoomCommand.localName = 'Zoom to Fit';

// Execute the command to fit all entities in view
zoomCommand.trigger(docManager.context);

Hierarchy (View Summary)

Constructors

Properties

Accessors

Methods

Constructors

Properties

events: {
    commandEnded: AcCmEventManager<AcEdCommandEventArgs>;
    commandWillStart: AcCmEventManager<AcEdCommandEventArgs>;
} = ...

Events fired during command execution lifecycle

Type declaration

Accessors

  • get globalName(): string

    Gets the global (untranslated) name of the command.

    The global name is typically used for programmatic access and should remain consistent across different language localizations.

    Returns string

    The global command name

  • set globalName(value: string): void

    Sets the global (untranslated) name of the command.

    Parameters

    • value: string

      The global command name (e.g., 'LINE', 'CIRCLE', 'ZOOM')

    Returns void

Methods

  • Triggers the command execution with proper event handling.

    This method should not be overridden by subclasses as it handles the event notification workflow. Subclasses should implement the execute() method instead.

    The execution flow:

    1. Fires commandWillStart event
    2. Calls the execute() method
    3. Fires commandEnded event

    Parameters

    • context: AcApContext

      The current application context containing view and document

    Returns void

    const command = new MyCommand();
    command.trigger(docManager.context);