Time is not my friend at the moment. Sadly, the help file was not as helpful as I had hoped.
I wrote a TEST routine, and the object reactor appears to load successfully (see code below).
However, I keep getting an error at the command line, when attempting to test my reactor.
(I manually change the Drawing Setup Horizontal Scale, PROJECTS > DRAWING SETUP)
Attempts to replace My_Data with Nil simply vary in the number of times "too many arguments" is repeated.
Code:
Command: test
#<VLR-Object-Reactor>
Command:
too many arguments
Command: too many argumentstoo many arguments
I suspect that the trouble I am experiencing lies with my callback function? Hopefully there is something that stands out to you as being an obvious error on my part.
Here is my TEST routine:
Code:
;;;--------------------------------------------------------------------;
;;; Z_Test.lsp, 2010-03-09, © 2010, by Mathew Kirkland, WM ;
;;;--------------------------------------------------------------------;
;;;--------------------------------------------------------------------;
;;; Function: c:STOP ;
;;;--------------------------------------------------------------------;
;;; Description: Stop all reactors. ;
;;;--------------------------------------------------------------------;
(defun c:STOP ()
(vlr-remove-all)
(prompt "\n...All Reactors Have Been Removed. ")
(princ)
) ;_end defun
;;;--------------------------------------------------------------------;
;;; Function: My_Function ;
;;;--------------------------------------------------------------------;
;;; Description: Callback function for reactor statement. ;
;;;--------------------------------------------------------------------;
(defun My_Function ()
(prompt "\nACADD_ZZ Block Has Changed, Check Drawing Setup.")
(princ)
) ;_end defun
;;;********************************************************************;
;;; Function: c:TEST ;
;;;********************************************************************;
;;; Description: Test object reactor, to monitor changes in ;
;;; ADCADD_ZZ block. ;
;;;********************************************************************;
(defun c:TEST (/ ENAME My_Object VERT HORZ My_Data My_Reactor )
;; Load visual lisp command extensions
(vl-load-com)
;; Reset all current reactors
(if *commandReactor*
(progn
(setq *commandReactor* nil)
(vlr-remove-all :VLR-Command-Reactor)
) ;_end progn
) ;_end if
;; Name of block to monitor
(setq ENAME (ssname (ssget "x" '((2 . "adcadd_zz"))) 0))
(setq My_Object (vlax-ename->vla-object ENAME))
;; Object data to be associated with the reactor object
(setq VERT (rtos (zz_getxd 341) 2 2))
(setq HORZ (rtos (zz_getxd 342) 2 2))
(setq My_Data (list VERT HORZ))
;; Object Reactor
(setq My_Reactor
(vlr-object-reactor (list My_Object) My_Data '((:vlr-modifiedXData . My_Function)))
) ;_end setq
) ;_end defun
(c:TEST)