「Vlr-command-reactor」の版間の差分
細編集の要約なし |
編集の要約なし |
||
| 26行目: | 26行目: | ||
! イベント名 || 説 明 | ! イベント名 || 説 明 | ||
|- | |- | ||
| :vlr-unknownCommand || 不明なコマンドを | | :vlr-unknownCommand || 不明なコマンドを CAD が実行しようとしたとき | ||
|- | |- | ||
| :vlr-commandWillStart || | | :vlr-commandWillStart || CAD コマンドが呼び出された直後 | ||
|- | |- | ||
| :vlr-commandEnded || | | :vlr-commandEnded || CAD コマンドが完了した直後 | ||
|- | |- | ||
| :vlr-commandCancelled || | | :vlr-commandCancelled || CAD コマンドがキャンセルされた直後 | ||
|- | |- | ||
| :vlr-commandFailed || | | :vlr-commandFailed || CAD コマンドが失敗したとき | ||
|} | |} | ||
2023年11月3日 (金) 11:21時点における版
- 構文
- (vlr-command-reactor data callbacks)
- 機能
- コマンド イベントを通知する編集リアクタを作成する。
- 引数
-
- data : リアクタ オブジェクトに関連付ける任意の AutoLISP データ。または、リアクタに関連付けるデータが存在しない場合は nil。
- callbacks : 次の形式のペアのリスト。
- (event-name . callback_function)
- event-name は、次の「コマンド リアクタ イベント」の表にあるシンボルの 1 つ。callback_function は、イベントが発生したときに呼び出される関数を示すシンボル。 各コールバック関数は、次の 2 つの引数を受け入れる。
- reactor_object : コールバック関数を呼び出した VLR オブジェクト。
- list : 単一の要素(コマンドを示す文字列)を含んだリスト。
- 戻り値
- reactor_object 引数。
| コマンド リアクタ イベント | |
|---|---|
| イベント名 | 説 明 |
| :vlr-unknownCommand | 不明なコマンドを CAD が実行しようとしたとき |
| :vlr-commandWillStart | CAD コマンドが呼び出された直後 |
| :vlr-commandEnded | CAD コマンドが完了した直後 |
| :vlr-commandCancelled | CAD コマンドがキャンセルされた直後 |
| :vlr-commandFailed | CAD コマンドが失敗したとき |
サンプル
(if (not *myCommandRectors*)
(setq *myCommandRectors*
(vlr-command-reactor
nil
'((:vlr-commandWillStart . startCommand)
(:vlr-commandEnded . endCommand)
(:vlr-commandCancelled . cancelCommand)
(:vlr-commandFailed . failedCommand)
)
)
)
)
(defun startCommand ()
;...
)
(defun endCommand ()
;...
)
(defun cancelCommand ()
;...
)
(defun failedCommand ()
;...
)