オブジェクトが修正されるとメッセージを表示するオブジェクト リアクタを作成します。
; Define the callback function to use for the reactor ; The following function prints a message with the circle’s radius (defun print-radius (notifier-object reactor-object parameter-list) (vl-load-com) (cond ( (vlax-property-available-p notifier-object "Radius" ) (princ "The radius is ") (princ (vla-get-radius notifier-object)) ) ) ) ; Create a variable to hold the circle object that ; will be used as the owner of the reactor (setq myCircle ; Prompt for the center point and radius: (progn (setq ctrPt (getpoint "\nCircle center point: ") radius (distance ctrPt (getpoint ctrpt "\nRadius: ")) ) ; Add a circle to the drawing model space. Nest the function ; calls to obtain the path to the current drawing's model ; space: AcadObject > ActiveDocument > ModelSpace (vla-addCircle (vla-get-ModelSpace (vla-get-ActiveDocument (vlax-get-acad-object)) ) (vlax-3d-point ctrPt) radius ) ) ) ; Create the reactor and pass it the circle object, ; application-specific data, and callback function. (if (= circleReactor nil) (setq circleReactor (vlr-object-reactor (list myCircle) "Circle Reactor" '((:vlr-modified . print-radius)))) )
STRETCH[ストレッチ]コマンドのオプションのプロンプトの後に、次のようなメッセージが表示されるはずです。
ストレッチ点を指定 または [基点(B)/複写(C)/元に戻す(U)/終了(X)]: 半径は 3.75803