Creates a new command instance.
Initializes the command with empty names. Subclasses should set appropriate global and local names in their constructors.
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.
The global command name
Sets the global (untranslated) name of the command.
The global command name (e.g., 'LINE', 'CIRCLE', 'ZOOM')
Gets the local (translated) name of the command.
The local name is displayed to users and should be localized to the current language/region.
The localized command name
Sets the local (translated) name of the command.
The localized command name (e.g., 'Draw Line', 'Zoom In')
Gets the minimum access mode required to execute this command.
Commands with higher mode requirements can only be executed when the document is opened in a compatible mode. Higher value modes are compatible with lower value modes.
The minimum access mode required
Sets the minimum access mode required to execute this command.
The minimum access mode (Read, Review, or Write)
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:
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.
Executes the regen command to redraw the current drawing
ProtectedonCalled after the command has finished executing.
This lifecycle hook is intended for cleanup or follow-up logic, such as:
The default implementation does nothing.
The current application context
ProtectedonCalled right before the command starts executing.
This lifecycle hook is intended for subclasses that need to perform
setup work before execute() runs, such as:
The default implementation does nothing.
The current application context
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:
commandWillStart eventexecute() methodcommandEnded eventThe current application context containing view and document
Command to redraw the current drawing in the CAD viewer.
This command redraws the current drawing. It can be used after users set font mapping for missed fonts so that the current drawing can display texts with correct fonts.
Example