PDA

View Full Version : Global scale variable in metric and imperial


rolibolibo
2006-02-21, 01:10 AM
Hello all,

I would like to have your comments about the proper way of setting/creating a global variable to represent my dwg scale when dealing with metric or imperial units. This is what I use now..

in a detail w/ metric units and scale of 1:50, my
DIMSCALE = 50 and a global variable say
#dwgsc also set to 50.
So for my lisp for changing a text height that I'd like to be 2.5mm, I have a line like this

(setq ht (* 2.5 #dwgsc)) -> the actual text height is 125

now this is the part which I'm not really sure if my approach is correct..

for imperial units w/ a scale of 1/4"=1'-0" (which is closest to 1:50), I use the following settings
for DIMSCALE = 48 and for
#dwgsc = dimscale or 48 x (/ 10 254) = 1.89 where (/ 10 254) is a conversion of inch to mm
so, for the same code above for changing text height, it'll still read the same

(setq ht (* 2.5 #dwgsc)) -> but this time the actual height is 4.725" which is roughly 120mm close enough to the above 125mm

Is this how you typically do your coding too? I can't exactly pinpoint what's weird expecially for imperial's, it's just that I have a feeling that there's another ways to go about this. Thanks for the replies in advance!!

rts
2006-02-23, 10:56 PM
This is the code I have used

(setvar "TEXTSIZE" (* (expt (if (zerop (getvar "DIMSCALE")) 1.0 (getvar "DIMSCALE")) (getvar "TILEMODE")) (* 0.1 (expt 2.5 (getvar "MEASUREMENT")))))

This gives the results 0.1 being the plotted text size for imperial units
and 2.5 being the plotted text size for metric units it also accounts for Model or Paper Space. The code can be used in conjunction with a paperspace/modelspace reactor.

My preference is not to assign a global variable as the scale often changes between drawings. The AutoCAD system variables are saved inside each drawing file.

Regards,
Ronso
A2k2

jwanstaett
2006-02-24, 05:57 PM
in imperial units you are print at 1/4" = 1' or 1:48 not 1:50
so 120mm / 48 = text at 2.5mm on your print
the same text size in imperial units and metric units on your print.
so you have it right just not the same text size in the drawing.