Simple Reactor on Document Became Current
Not applicable
02-27-2017
06:20 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello community, I've been trying to avoid reactors thus far, but I came across a condition that I believe requires it.
The goal is to use ACAD 2017's COLORTHEME as an indicator for the user to know which text size they are using (1/8" v 3/32"). I'm able to use USERI1 to store a variable in the drawing to indicate to CAD which drawing is using which text size by adding the code below to the ACADDOC startup.
(if (and (= (getvar 'measurement) 0)(= (getvar 'useri1) 0)) (setvar 'useri1 96)); sets user integer variable 1 to 1/8" text size for imperial drawings (if (and (= (getvar 'measurement) 0)(= (getvar 'useri1) 96)) (setvar 'colortheme 1)); sets colortheme to light if 1/8" text size for imperial drawings (if (and (= (getvar 'measurement) 0)(= (getvar 'useri1) 128)) (setvar 'colortheme 0)); sets colortheme to dark for 3/32" text size for imperial drawings (cond ((and (= (getvar 'measurement) 0)(= (getvar 'useri1) 96)) ;overwrites dependent files for 1/8" text size (foreach blk blks (vl-file-rename (strcat @blk96 blk)(strcat @blk blk))) (foreach dwg dwgs (vl-file-rename (strcat @dwg96 dwg) (strcat @dwg dwg))) ) ((and (= (getvar 'measurement) 0)(= (getvar 'useri1) 128)) ;overwrites dependent files for 3/32" text size (foreach blk blks (vl-file-rename (strcat @blk128 blk)(strcat @blk blk))) (foreach dwg dwgs (vl-file-rename (strcat @dwg128 dwg) (strcat @dwg dwg))) ) )
However, I have a problem when switching between open documents and truly understanding reactors. I want this reactor to behave with what is placed in the callback, see below.
(vlr-docmanager-reactor nil (:vlr-documentBecameCurrent . (if (= (getvar 'useri1) 128) (setvar 'colortheme 0) (setvar 'colortheme 1))))
Any help on this is greatly appreciated. Thank you community,
Link copied