LISP that autoruns on BOTH drawing creation and '+New Layout' creation

LISP that autoruns on BOTH drawing creation and '+New Layout' creation

Anonymous
Not applicable
914 Views
6 Replies
Message 1 of 7

LISP that autoruns on BOTH drawing creation and '+New Layout' creation

Anonymous
Not applicable

My issue is the setting 'ANNOALLVISIBLE' keeps defaulting to '0' and causing issues. 

 

Not a big deal for a new drawing cause we use a template, but when I click + to create a new layout, it sets the ANNOALLVISIBLE back to '0'. I cannot seems to find a way to get this to set to '1' by default. Hoping a LISP that autoruns upon layout creation was possible

0 Likes
Accepted solutions (1)
915 Views
6 Replies
Replies (6)
Message 2 of 7

SeeMSixty7
Advisor
Advisor

Using an editor reactor you can monitor when the Layout Changes. Then you can check the setting and change if needed. Here is a quick sample. Yo may want to update to only do on certain circumstances, but here you go.

(defun CTABChanged(ReactorObjectID ReactorArgument)
   (if (= (car ReactorArgument) "CLAYOUT")
     (progn
     	(if (= (getvar "ANNOALLVISIBLE") 0)
     	    (progn 
     	        (princ "\nSetting ANNOALLVISIBLE to On")
     	        (setvar "ANNOALLVISIBLE" 1)
     	    )
     	)
     )
    )
)
(defun MyEditorReactor ()
   (if (= CTABEditorReactor nil)
       (setq CTABEditorReactor
           (VLR-Editor-Reactor nil '((:vlr-sysVarChanged . CTABChanged)))
       )
   )
)

 Good Luck,

Message 3 of 7

Anonymous
Not applicable

Thank you I m not familiar with reactors. Do I just load it like a normal LISP? I cant seem to get this to work, anything special I need to do?

0 Likes
Message 4 of 7

SeeMSixty7
Advisor
Advisor
Accepted solution

After you load it into AutoCAD you will need to run the MyEditorReactor Function.

If you add it to your ACADDOC.LSP file or some other file that autoloads, then you just need to add a call to the function.

 

(myEditorReactor)

 

You can also add it to the code I sent you and save to a file. Included here with the call to the function.

(defun CTABChanged(ReactorObjectID ReactorArgument)
   (if (= (car ReactorArgument) "CLAYOUT")
     (progn
     	(if (= (getvar "ANNOALLVISIBLE") 0)
     	    (progn 
     	        (princ "\nSetting ANNOALLVISIBLE to On")
     	        (setvar "ANNOALLVISIBLE" 1)
     	    )
     	)
     )
    )
)
(defun MyEditorReactor ()
   (if (= CTABEditorReactor nil)
       (setq CTABEditorReactor
           (VLR-Editor-Reactor nil '((:vlr-sysVarChanged . CTABChanged)))
       )
   )
)
(MyEditorReactor)

 

 

 

Good luck,

 

Message 5 of 7

Anonymous
Not applicable

Ah, was able to get it to run by adding "c:" before the 'myeditorreactor' function

0 Likes
Message 6 of 7

Anonymous
Not applicable

Added to startup suite and works like a charm, thank you!!!

Message 7 of 7

SeeMSixty7
Advisor
Advisor

Glad that worked out for you!

0 Likes