Custom Commands LiteCAD API

- Register custom command events with the lcEventSetProc functions.
- When LiteCAD fires the LC_EVENT_ADDCMD event, create your custom commands objects with the lcCreateCommand function.
- Call your command with the lcWndExeCommand function.
- During the command execution, LiteCAD will fire LC_EVENT_CCMD events
- In order to finish the command, call lcCmdExit function from event procedure.

Events generated during a command execution:

Event type Meaning
LC_EVENT_ADDCMD LiteCAD initializes commands. Use this event to add custom commands.
LC_EVENT_CCMD Custom commands interface

The following functions can be used only inside of command event procedures.

Function Meaning
lcCmdExit Finishes active command
lcCmdCursorText Command prompt near cursor
lcCmdMessage Displays message box

Properties of a command object:

Property Type Access Meaning
LC_PROP_CMD_ID int R Command identifier (LC_CMD_CUSTOM + n)
LC_PROP_CMD_PARAM int R parameter passed by lcWndExeCommand
LC_PROP_CMD_STEP int RW Step of execution
LC_PROP_CMD_LCWND handle R Handle to graphics window
LC_PROP_CMD_HWND handle R Handle to a window (HWND)
LC_PROP_CMD_DRW handle R Handle to a drawing
LC_PROP_CMD_BLOCK handle R Handle to a block
LC_PROP_CMD_CURSORCROSS bool RW Enable/disable crosshair cursor
 . . .

int RW Command-specific integer variables
 . . .

float RW Command-specific float variables
 . . .

handle RW Command-specific HANDLE variables
LC_PROP_CMD_STR string RW Command-specific string variable (max 1023 symbols)

See also

  Code sample