Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

need Lisp routine for setting text height in paperspace layouts

199 views
Skip to first unread message

Mark Sulzbach

unread,
Apr 15, 2004, 8:33:39 AM4/15/04
to
To anyone who can help

I have a very simple lisp routine to set text layer, color & height to 1/8"
when paperspace
layouts are not used & dimscale is set to a variable such as "48".

(DEFUN C:DT()
(COMMAND "LAYER" "M" "M-TEXT" "")
(COMMAND "COLOR" "BYLAYER")
(SETVAR "TEXTSIZE" (* 0.125 (GETVAR "DIMSCALE")))
(COMMAND "DTEXT"))

However once you set "scale dimensions to paperspace (layout)" in the
"dimension style manager", the dimscale becomes "zero" and this no longer
works.

When using paperspace layouts all dims & text are in modelspace with
objects. Dimensions are scaled automatically by AutoCAD, but I have to
remember text size & switch for every viewport on the dwg. (1/4"=1'-0" = 6"
text, etc...)

I can't figure out the system variable (if any) for the active viewport so I
can automatically scale text.

"textsize" "'spacetrans" "1/8" works only if you type it but does not seem
to wouk in a lisp routine. Apparently you can not use commands
transparently in Auto Lisp.

I WAS TRYING:

(DEFUN C:PT()
(COMMAND "LAYER" "M" "M-TEXT" "")
(COMMAND "COLOR" "BYLAYER")
(COMMAND "TEXTSIZE" "'SPACETRANS" ".125")) ;COMMAND OR SETVAR
(COMMAND "DTEXT"))

HOWEVER THIS WILL NOT ACCEPT " 'SPACETRANS "

I can't be the only person to ever run into this, although most people
"solve" this problem by simply putting all text on layout with title block.
This is not a desired solutions since the object & dims (modelspace) will
then be separate from all leaders & text (paperspace).

Please advise.

Mark

--

Mark Sulzbach
Designer

ATSI, Inc.
415 Commerce Dr.
Amherst, NY 14228
Phone: 716-691-9200 ext 266
FAX: 716-691-7221
email: msul...@atsiinc.com

Website: www.atsiinc.com


Jamie Duncan

unread,
Apr 15, 2004, 8:50:19 AM4/15/04
to
(SETVAR "TEXTSIZE" (* 0.125 (if (= (GETVAR "DIMSCALE") 0) 1 (getvar
"dimscale"))))


like this?

--
Jamie Duncan

"How wrong it is for a woman to expect the man to build the world she wants,
rather than to create it herself."
- Anais Nin (1903-1977)
"Mark Sulzbach" <msul...@atsiinc.com> wrote in message
news:407e80ce$1_3@newsprd01...

jclaidler

unread,
Apr 15, 2004, 8:41:22 AM4/15/04
to
Do you have a height set for the text style in the Text Style Manager ??

Mark Sulzbach

unread,
Apr 15, 2004, 9:29:14 AM4/15/04
to
This will help with text on the paperspace layout itself but I'm looking to
write a lisp routing that will
take the scale of the active viewport (say 1/4"=1'-0" or 1:48) and set text
height to plot height of 1/8" in model space
(example: 6" for 1/4"=1'-0")


"Jamie Duncan" <dagnyt...@thejohngaltline.com> wrote in message
news:407e84bf_2@newsprd01...

jclaidler

unread,
Apr 15, 2004, 9:57:06 AM4/15/04
to
try this: I use this when switching to model space.

(setq Fac (/ 12 (* 12 (caddr (trans '(0 0 1) 2 3)))))
(command "pspace")(setvar "tilemode" 1)
(setvar "dimscale" Fac)(setvar "ltscale" (/ Fac 2.0))
(SETVAR "TEXTSIZE" (* 0.09375 (if (= GETVAR "DIMSCALE") 0) 1 (getvar "dimscale"))))
(princ "\nDIMSCALE: ")(princ Fac)
(princ " LTSCALE: ")(princ (getvar "ltscale"))
(command "regenall")
(setvar "cmdecho" 1)
(princ)

Herman Mayfarth

unread,
Apr 15, 2004, 9:51:22 AM4/15/04
to
(defun getscl( / sf)
(cond ((= 1 (getvar "TILEMODE")) (setq sf (getvar "DIMSCALE")));tiled
space
((= 1 (getvar "CVPORT")) (setq sf 1.0));in paper space
;; in a viewport - method attributed to Ian Bryant
(T
(setq sf (last (trans '(0 0 1.0) 3 2)));calc scale factor
)
);cond
sf
)


;; handle nonsense case of zero dimscale in tiled space
(if(and(= 0 (getvar "DIMSCALE"))(= 1 (getvar "TILEMODE")))
(progn((alert " Zero Dimension Scale\n Set Tilemode = 0 or
Use a Non-Zero Dimension Scale")(exit))))

Note: I don't presently like using (exit) this way, but this was lifted
from an old routine which I haven't changed. There are cleaner ways to
do this check.

Then just

(setvar "TEXTSIZE" (* 0.125 (getscl)))

or maybe

(setvar "TEXTSIZE" (* (getvar "DIMTXT") (getscl)))

Jamie Duncan (remove lock to reply)

unread,
Apr 15, 2004, 1:05:59 PM4/15/04
to
you need to get the scale property of the active viewport and apply that to
your text height

--


Jamie Duncan

Consulting - If you're not part of the solution, there's good money in
prolonging the problem.


"Mark Sulzbach" <msul...@atsiinc.com> wrote in message

news:407e8ddc$1_3@newsprd01...

0 new messages