Command that measures the length of an arc on an existing circle or arc entity.

Uses a two-phase pick flow that mirrors AutoCAD's arc-length measurement:

  1. Phase 1 — entity snap: The user hovers over a circle or arc in the drawing. A square snap indicator appears on the circumference and the entity geometry is captured. Clicking confirms the start point.

  2. Phase 2 — end point: The same square indicator follows the cursor, always locked to the captured circle. A canvas overlay draws the shorter arc between the start and current position in real time, together with a live badge showing the arc length.

Both the construction-phase canvas and live badge are removed before this method returns. After the second click a measurement-added event is emitted so the useMeasurements composable in cad-viewer renders the persistent DOM overlay (arc canvas + badge + endpoint dots) that tracks zoom and pan.

Hierarchy (View Summary)

Constructors

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

  • get userData(): TUserData

    Gets the custom user-defined data associated with this command.

    userData is a generic, strongly-typed container that allows consumers of the command to attach arbitrary metadata without modifying the command class itself.

    The shape of userData is defined by the generic parameter TUserData when the command is declared:

    Returns TUserData

    The user-defined data object associated with this command

    interface MyCommandData {
    sourceLayerId: string
    isPreview: boolean
    }

    class MyCommand extends AcEdCommand<MyCommandData> {}

    const cmd = new MyCommand()
    cmd.userData.sourceLayerId = 'Layer-01'
    cmd.userData.isPreview = true

    This design provides flexibility similar to THREE.Object3D.userData while preserving full compile-time type safety.

Methods

  • Executes the command logic.

    This abstract method must be implemented by subclasses to define the specific behavior of the command. The method receives the current application context providing access to the view and document.

    Parameters

    Returns Promise<void>

    execute(context: AcApContext) {
    const view = context.view;
    const doc = context.doc;

    // Get user input
    const point = await view.editor.getPoint();

    // Create entity in document
    const entity = new SomeEntity(point);
    doc.database.addEntity(entity);
    }
  • 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 Promise<void>

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