View Full Version : Looking at user reactors for dtext
Robert.Hall
2006-08-21, 02:05 PM
I am looking at user reactors for dtext.
How would I setup a reactor that changes the dtext height when a
partiular dimstyle has been selected?
T.Willey
2006-08-21, 04:37 PM
I don't think it would be to hard to do, but you have to do this one correctly since you are going to be watching the system variable changed event, and then changing a system variable. You can't use commands in reactors (FYI). I would just make sure to check for that one system variable that you want to watch, and put everything in an if statement. I think it should work, but I haven't not done any reactors on system variables.
pnorman
2006-08-21, 10:32 PM
Hi Robert,
I had a quick play with the following. It seems ot do what you want using the dimscale. I tried using "dimstyle" as a triger but for various reasons that didn't work. Dimscale seemed to give better results. I haven't tested it for all situations or cad versions. I ahve ADT 2005.
Put the code in your acaddoc.lsp or as I do it save to a file called reactors.lsp and use (load "reactors.lsp") in your acaddoc....
;;;----------------------------------------------- ---------------
(if (not *ppn:vlr_dimdtext*)
(setq *ppn:vlr_dimdtext* (vlr-sysvar-reactor nil '((:vlr-sysvarchanged . PPN_REACTOR_DTEXT))))
)
;;;----------------------------------------------------- ---------
(defun PPN_REACTOR_DTEXT (ppn_reactor_name ppn_sysvar_name)
(if (= (car ppn_sysvar_name) "DIMSCALE")
(progn
(setvar "TEXTSIZE" (* (getvar "DIMSCALE") (/ 3.0 32)))
)
)
)
Regards
Phill
kennet.sjoberg
2006-08-22, 11:17 AM
. . . changes the dtext height when a partiular dimstyle has been selected?
Hi Robert, you can play with this
;;; The trigger
(setq SysVarChangeReactor (vlr-sysvar-reactor nil '((:vlr-sysVarChanged . SysVarChangeReactorFunction ))) )
;;; The function
(defun SysVarChangeReactorFunction (ObjReactor Responce / )
(if (= (car Responce ) "DIMSTYLE" )
(progn
(cond
((= (getvar "DIMSTYLE" ) "MyDimStyle_1" ) (setvar "TEXTSIZE" 1.0 ) ) ;; or whatever
((= (getvar "DIMSTYLE" ) "MyDimStyle_2" ) (setvar "TEXTSIZE" 10.0 ) )
((= (getvar "DIMSTYLE" ) "MyDimStyle_3" ) (setvar "TEXTSIZE" 20.0 ) )
((= (getvar "DIMSTYLE" ) "MyDimStyle_4" ) (setvar "TEXTSIZE" 50.0 ) )
(T (setvar "TEXTSIZE" 1.0 ) ) ;; else
)
)
( )
)
)
;;; The regret
;;; (vlr-remove SysVarChangeReactor ) ;; Remove the reactor
;;; (setq SysVarChangeReactorFunction nil SysVarChangeReactor nil ) ;; Clear the function and the reactor
: ) Happy Computing !
kennet
pnorman
2006-08-22, 02:38 PM
Use Kennet's method. I tried "dimstyle" again as the trigger and it seems to be working ok now.
Powered by vBulletin® Version 4.1.11 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.