MLightCAD
    Preparing search index...

    Command for exporting the current CAD drawing to PNG format.

    This command creates a PNG converter and initiates the conversion process to export the current drawing as a PNG file. The command:

    • Creates a new PNG converter instance
    • Prompts for an export bounding box
    • Prompts for optional long side pixel value (or press Enter for default)
    • Converts the current view to PNG format
    • Automatically downloads the PNG file

    This is useful for exporting drawings to a raster image format that can be displayed in browsers or used in other applications.

    const convertCmd = new AcApConvertToPngCmd();
    convertCmd.execute(context); // User prompted for bounds and longside

    Hierarchy (View Summary)

    Index

    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

    • 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);