「Vlr-command-reactor」の版間の差分
編集の要約なし |
編集の要約なし |
||
| (同じ利用者による、間の3版が非表示) | |||
| 1行目: | 1行目: | ||
{{AutoLISP}} | |||
; 構文 | ; 構文 | ||
: (vlr-command-reactor ''data'' ''callbacks'') | : (vlr-command-reactor ''data'' ''callbacks'') | ||
| 5行目: | 6行目: | ||
; 機能 | ; 機能 | ||
: コマンド イベントを通知する編集リアクタを作成する。 | : コマンド イベントを通知する編集リアクタを作成する。 | ||
; 引数 | ; 引数 | ||
| 13行目: | 15行目: | ||
:::* reactor_object : コールバック関数を呼び出した VLR オブジェクト。 | :::* reactor_object : コールバック関数を呼び出した VLR オブジェクト。 | ||
:::* list : 単一の要素(コマンドを示す文字列)を含んだリスト。 | :::* list : 単一の要素(コマンドを示す文字列)を含んだリスト。 | ||
; 戻り値 | ; 戻り値 | ||
| 23行目: | 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 コマンドが失敗したとき | ||
|} | |} | ||
| 48行目: | 51行目: | ||
) | ) | ||
) | ) | ||
(defun startCommand () | |||
;... | |||
) | |||
(defun endCommand () | |||
;... | |||
) | |||
(defun cancelCommand () | |||
;... | |||
) | |||
(defun failedCommand () | |||
;... | |||
) | |||
</pre> | </pre> | ||
----- | ----- | ||
関連事項 | |||
* [[vl-load-com]] 関数 | |||
* [[リアクタ関数]] | |||
[[Category:AutoLISP]] | [[Category:AutoLISP]] | ||
2023年11月3日 (金) 11:24時点における最新版
- 構文
- (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 ()
;...
)
関連事項