New Dimscale LISP

New Dimscale LISP

Anonymous
Not applicable
1,447 Views
4 Replies
Message 1 of 5

New Dimscale LISP

Anonymous
Not applicable

Newish to AutoCAD and trying to create a LISP to set the dimscale so my mtext shows up at the correct size and keep getting errors not sure what to do.

 

Thanks!! 

 

 

0 Likes
1,448 Views
4 Replies
Replies (4)
Message 2 of 5

ВeekeeCZ
Consultant
Consultant

For the newones.

(setvar 'textsize (getvar 'dimscale))

 

Or to change to change selected...

 

(vl-load-com)

(defun c:TextbyDimScale ( / hg ss i obj)

  (if (setq hg (getvar 'DIMSCALE)
	    ss (ssget '((0 . "*TEXT"))))
    (repeat (setq i (sslength ss))
      (setq obj (vlax-ename->vla-object (ssname ss (setq i (1- i)))))
      (vlax-put-property  obj 'Height hg)))
  (princ)
)

 

Message 3 of 5

Anonymous
Not applicable
Look into annotative text and let AutoCAD do the heavy lifting. All you need do is set the scale before inserting an annotation or dimension.
Message 4 of 5

Kent1Cooper
Consultant
Consultant

What are you trying, and what are the errors?  And what version are you using [annotative text sizing has not always been available]?

Kent Cooper, AIA
Message 5 of 5

Kent1Cooper
Consultant
Consultant

@ВeekeeCZ wrote:

....

(setvar 'textsize (getvar 'dimscale))

.... 


That would be appropriate only if you want the Text to print at one drawing unit high.  [For instance, at 1/4" = 1'-0" scale, my DIMSCALE would be 48, and Text with that as its height would print out at 1" high!]  Try using a multiplier of the height you want on that:

(setvar 'textsize (* (getvar 'dimscale) YourDesiredPrintedTextHeight))

 

Also, it would work right only for Text Styles with zero defined height, which will take that System Variable as the default height if you don't specify otherwise -- Styles with a non-zero defined height will ignore the TEXTSIZE value if it differs.  Consider instead using a value like that in a Style definition, rather than as the TEXTSIZE System Variable.

Kent Cooper, AIA