Saturday, October 13, 2007

More on the Zero Text Height Saga..

There is obviously more to this than meets the eye....If you insert a drawing into another drawing that has a STANDARD dimstyle, apparently it changes that drawings settings. This has to be a good reason not to use this style at all. Maybe you need one that is unique to yourself-that way you would always be sure it would not get messed up.

I also neglected to say that my example is METRIC - ie 3 means 3mm which is 1/8 ".

The use of annotation scale adds another layer of complexity to it all.
Maybe I should retire now before it becomes all too hard!

Friday, October 12, 2007

Zero Height Text

Formatting default text in autocad is easy: You go format, then text. Choose your style name and font.

Now comes the funny part: if you leave the height of the text at 0, then when you issue the text command, it asks
you what you want the height to be. If you chose acadiso.dwg as your starting drawing, then this comes up with a
default of 2.5mm. Fine. The you are asked for the rotation. Ok. Then you key in the text.

This is the default (I believe) of Autocad, and as such, 99% of users go down this road.

If you now go and place a dimension, it will default at a dimscale of 1. Then if you type dimscale and set it to say 5,
and update that dimension, it scales both the text and arrowheads and so on to be bigger. Thats OK.

Many years ago, I obviously did not go down this track. I made the mistake(?) of setting my text height to a value-
for instance if my drawing was to be plotted at 1:1, I made it 3. For 1:5 I made it 3x5=15. I used lisp routines to accomplish this and all was well. To get my dimensions to scale nicely at the same time, I used a lisp routine to do this as well.
This worked well, and I drafted on. Then other people had to use my drawings. Oops...big problems....when they dragged a dimension
it would suddenly develop bigger text.

So, after hours of puzzlement, I came to realise that there was something wrong, and I tracked it down to the fact that zero height text should always be used. Then I came upon a system variable called textsize.

Talk about confusing....but all it means is that the default text height is controlled by this variable.

I quite liked my old way, as I could just go text and pick a point and start typing (2 keystrokes avoided!). I will most likely now go out of my way to redo the text commands to get rid of this annoying default behaviour.

I had put dimensions on someone elses drawings recently, and found they had about 5 dimension styles on the go,
and I was not particularly keen on any of them.

So in the end I redeveloped my lisp routine for setting drawing scale, and offer them here.

The idea is you run skn.lsp, which sets the style to STANDARD (every drg has a style called that) and massages the variables
to be correct(?!). After that you purge all the old ones out. Then you use DS.lsp to set the dimscale and text.(It is shorter)
;This routine sets up for dims and text
;By Bill Le Couteur

(defun c:SKN(/ texht skale lnscale)
(setvar "cmdecho" 0)
(command "-dimstyle" "r" "STANDARD")
(setq skale (getreal "Please enter the plotted scale: "))
;(setq skale 0.1)
(setq texht (* skale 3))
(setvar "lunits" 2)
(setvar "luprec" 2)
(setvar "auprec" 2)
(setvar "coords" 2)
(setvar "ltscale" 4)
(setvar "psltscale" 1)
(setvar "mirrtext" 0)
(setvar "pdmode" 0)
(setvar "pdsize" -2.0)
(setvar "sketchinc" 0.5)
(setvar "skpoly" 1)
(setvar "snapunit" (list 10 10))
(setvar "tracewid" 1.0)
(command "viewres" "" 20000)
(command "units" "2" "1" "1" "2" "0" "n")
(setvar "dimaltd" 4)
(setvar "dimaltf" 0.03937)
(setvar "dimassoc" 2)
(setvar "dimasz" 2.0)
(command "dimcen" "2" "dimclrd" "256" "dimclre" "256"
"dimclrt" "2" "dimdle" "0.0" "dimdli" "6.0"
"dimlunit" "2" "dimalt" "0"
"dimexe" "1.0" "dimexo" "1.0" "dimgap" "1.0"
"dimlfac" "1" "dimscale" skale "dimsoxd" "0"
"dimtih" "0" "dimtix" "0"
"dimtofl" "1" "dimtoh" "0" "dimtsz" "0.0"
"dimtvp" "1.0" "dimzin" "8" "dimtxt" "3"
"dimtxsty" "STANDARD" "dimtad" "1"
"dimdec" "0" "dimrnd" "1" "dimdsep" "." "dimpost" "." "dimfit" "3")

(command "-style" "STANDARD" "ROMANS.SHX"
"0" "1" "0" "" "" "")
(setvar "textSIZE" TEXHT)
(command "-dimstyle" "S" "STANDARD" "Y")

(prompt "Drawing scaling successfully reset to: ")

(princ (getvar "dimscale"))

(setvar "cmdecho" 1)

;This routine sets up for dims and text
;By Bill Le Couteur

(defun c:DS()
(setq skale (getreal "Please enter the plotted scale: "))
(setq the_textsize (* skale 3))
(setvar "textsize" the_textsize)