PDA

View Full Version : Set DText height according to Dimstyle



Robert.Hall
2007-03-20, 01:06 PM
I want my users to have the ability to choose a dimstyle
while having the correspoding dtext height already set.

Is there a way to set up a reactor that will set the height automatically
each time the dimstyle is changed?

I could team it up with this routine that places text at the current
text height:



(defun c:write ()
(command ".dtext" pause "" "0")
(PRINC)
)


The idea is to assure myself that everyone is always using the
correct Dtext heights.

kennet.sjoberg
2007-03-20, 11:41 PM
almost one year later . . LINK (http://forums.augi.com/showthread.php?t=45263#post546743) do the reverse.

:?:

kennet

Robert.Hall
2007-03-21, 12:22 PM
Thanks, I forgot about that one.
I haven't had to set it up in awhile and the user
I did it for is long gone.

Robert.Hall
2007-03-21, 01:06 PM
I created a reactor.lsp file as described in the post.
Appload the file and it works great!

Robert.Hall
2007-06-15, 03:07 PM
Update..........It is not working in 2008.
I have it loaded as a lisp file.
Suggestions?

This is what I have:



;;; 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" ) "Met0.375" ) (setvar "TEXTSIZE" 0.8437 ) ) ;; or whatever
((= (getvar "DIMSTYLE" ) "Met0.50" ) (setvar "TEXTSIZE" 1.1250 ) )
((= (getvar "DIMSTYLE" ) "Met0.75" ) (setvar "TEXTSIZE" 1.6875 ) )
((= (getvar "DIMSTYLE" ) "Met1.00" ) (setvar "TEXTSIZE" 2.2500 ) )
((= (getvar "DIMSTYLE" ) "Met1.25" ) (setvar "TEXTSIZE" 2.8125 ) )
((= (getvar "DIMSTYLE" ) "Met1.50" ) (setvar "TEXTSIZE" 3.3750 ) )
((= (getvar "DIMSTYLE" ) "Eng0.375" ) (setvar "TEXTSIZE" 0.8437 ) )
((= (getvar "DIMSTYLE" ) "Eng0.50" ) (setvar "TEXTSIZE" 1.1250 ) )
((= (getvar "DIMSTYLE" ) "Eng0.75" ) (setvar "TEXTSIZE" 1.6875 ) )
((= (getvar "DIMSTYLE" ) "Eng1.00" ) (setvar "TEXTSIZE" 2.2500 ) )
((= (getvar "DIMSTYLE" ) "Eng1.25" ) (setvar "TEXTSIZE" 2.8125 ) )
((= (getvar "DIMSTYLE" ) "Eng1.50" ) (setvar "TEXTSIZE" 3.3750 ) )
(T (setvar "TEXTSIZE" 2.25 ) ) ;; else
)
)
( )
)
)

;;; The regret
;;; (vlr-remove SysVarChangeReactor ) ;; Remove the reactor
;;; (setq SysVarChangeReactorFunction nil SysVarChangeReactor nil ) ;; Clear the function and the reactor

CAB2k
2007-06-15, 08:53 PM
This is not addressing your problem but here is another way to code it.

;;; The function
(defun SysVarChangeReactorFunction (ObjReactor Responce /)
(if (= (car Responce) "DIMSTYLE")
(setvar "TEXTSIZE"
(cond
((cadr (assoc (getvar "DIMSTYLE")
'(("Met0.375" 0.8437)
("Met0.50" 1.1250)
("Met0.75" 1.6875)
("Met1.00" 2.2500)
("Met1.25" 2.8125)
("Met1.50" 3.3750)
("Eng0.375" 0.8437)
("Eng0.50" 1.1250)
("Eng0.75" 1.6875)
("Eng1.00" 2.2500)
("Eng1.25" 2.8125)
("Eng1.50" 3.3750)
))))
(2.25)
)
)
)
)

abdulhuck
2007-06-16, 06:51 PM
Update..........It is not working in 2008.

Hi,

Is it really required with the new annotation scales in 2008? Just a thought...

Regards,
Abdul Huck

Robert.Hall
2007-06-18, 01:24 PM
Hi,

Is it really required with the new annotation scales in 2008? Just a thought...

Regards,
Abdul Huck

I am not using layouts. I do not have a need for layouts.

Robert.Hall
2007-06-18, 01:29 PM
This is not addressing your problem but here is another way to code it.


That doesn't work in 2008. I did notice there are some additional text features in the
updated dashpanel. Maybe there is a new setting interfering with the routine?

fixo
2007-06-18, 01:42 PM
Try another one


(setvar "TEXTSIZE" (getvar "DIMTXT" ) )

not sure about A2008 though

~'J'~

Robert.Hall
2007-06-18, 02:39 PM
I have found the answer with the help of an AutoDesk support tech.

In the help file:

Note: If this or any other vlr-* command fails with a “no function definition” message, you may have forgotten to call vl-load-com, the function that loads AutoLISP reactor support functions.

All I had to add to the routine was "(vl-load-com)" and it worked!