jaminth Posted October 28, 2008 Posted October 28, 2008 how to autoload a Persistent Reactors and it's callbak-function? thanks. Quote
ASMI Posted October 29, 2008 Posted October 29, 2008 Persistent reactors remain in drawing them it is not necessary to load repeatedly. However callback function should be loaded from a file, therefore at carrying over on other computer there are inconveniences. Unfortunately callback function cannot be transferred with а *.dwg file. Certainly callback function can be transfered as text in a User Defined Dictionary, but on other computer should be a function which will read and load this code. Quote
jaminth Posted October 29, 2008 Author Posted October 29, 2008 A reactor is only a link between an event and a callback function. While this link remains, the callback function itself is not part of the reactor, and is normally not part of the drawing. The reactors saved in the drawing are only usable if their associated callback functions are loaded in AutoCAD. You can cause this to occur automatically when a drawing is opened if you define the reactor and callback functions in a separate-namespace VLX. (extract from "AutoLISP Developer's Guide") how make them work?!if you define the reactor and callback functions in a separate-namespace VLX. Quote
ASMI Posted October 29, 2008 Posted October 29, 2008 how make them work?!if you define the reactor and callback functions in a separate-namespace VLX. I can be mistaken, but is assured that here what that a mistake. You certainly can compile the reactor and callback function into *.vlx with separate namespace and to check up. Quote
jaminth Posted November 2, 2008 Author Posted November 2, 2008 (setq myCircle (progn (setq ctrPt (getpoint "\nSpecify center point for circle: ") radius (distance ctrPt (getpoint ctrpt "\nSpecify radius of circle: ")) ) (vla-addCircle (vla-get-ModelSpace (vla-get-ActiveDocument (vlax-get-acad-object))) (vlax-3d-point ctrPt) radius ) ) ) ;;Persistent reactors (setq circleReactor (vlr-pers (vlr-object-reactor (list myCircle) "Circle Reactor" '((:vlr-modified . print-radius))))) ;;callback function (defun print-radius (notifier-object reactor-object parameter-list) (vl-load-com) (cond ((vlax-property-available-p notifier-object "Radius") (princ "the radius of circle is:") (princ (vla-get-radius notifier-object)) ) ) ) ;------------------- how to autoload the Persistent Reactors "circleReactor" and it's callbak-function "print-radius" when open a dwg-file that load the lisp-code above? Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.