Jump to content

how to autoload a Persistent Reactors an it's callbak-function


Recommended Posts

Posted

how to autoload a Persistent Reactors and it's callbak-function?

 

thanks.

Posted

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.

Posted

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.

Posted
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.

Posted

(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?

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...