dimension txt size lisp

dimension txt size lisp

Anonymous
Not applicable
3,023 Views
1 Reply
Message 1 of 2

dimension txt size lisp

Anonymous
Not applicable

hello guys. I have a dimtxt height lisp. but changed dimtxt too small.

I want, change dimtxt according to input figure(number) ... thank you

;;  DimTextHeightReset.lsp [command name = DTHR]
;;  To remove any text height overrides on existing Dimensions so that
;;  they take their text height from their Style definition.
;;  [modified by Kent Cooper, April 2016, from one for Dimension Text Color
;;    with elements contributed by pbejse & Kent1Cooper, June 2012]

(Defun C:DTHR (/ ss n ent 3data 3dataEnd edata 3dataRev)
  (if (setq ss (ssget '((0 . "DIMENSION"))))
    (repeat (setq n (sslength ss))
      (setq ent (ssname ss (setq n (1- n))))
      (if
        (and
          (setq 3data (cadr (assoc -3 (entget ent '("ACAD"))))); it has eXtended data
          (setq 3dataEnd (member '(1070 . 140) 3data))
            ; it has a text-height override [saved in following 1040 entry]
        ); and
        (progn ; then
          (setq
            edata (entget ent); "base" entity data without Xdata
            3dataRev (reverse 3data); reverse to take end entries off with (cdr) below
          ); setq
          (repeat (length 3dataEnd); strip back to Xdata prior to text-height override
            (setq 3dataRev (cdr 3dataRev))
          ); repeat
          (entmod ; update Dimension to take text height from Style definition
            (append ; put entity data together with Xdata stripped of text-height override
              edata ; without Xdata
              (list
                (cons
                  -3 ; for Xdata
                  (list (append
                    (reverse 3dataRev); re-reversed 3data without text height & beyond
                    (cddr 3dataEnd); add remainder stripped of text-height entries
                  )); append & list
                ); cons
              ); list
            ); append
          ); entmod
        ); progn
      ); if
    ); repeat
  ); if [any Dimensions found]
  (princ)
); defun - DTHR
(prompt "\nType DTHR for Dimension Text Height Reset.")

0 Likes
Accepted solutions (1)
3,024 Views
1 Reply
Reply (1)
Message 2 of 2

Kent1Cooper
Consultant
Consultant
Accepted solution

@Anonymous wrote:

hello guys. I have a dimtxt height lisp. but changed dimtxt too small.

I want, change dimtxt according to input figure(number) ... thank you

....


You can just select the Dimension(s) and change their Text Height in the Properties box [assuming the Text Style used in the Dimension Style is not of a fixed height].

 

But if your "input figure" is something you want to build into a routine, rather than ask the User with a prompt, so as to run automatically or something, one way is as a function with an argument:

 

(defun DTHO (height / ss n); = Dimension Text Height Override
  (if (setq ss (ssget '((0 . "DIMENSION"))))
    (repeat (setq n (sslength ss))
      (vla-put-TextHeight (vlax-ename->vla-object (ssname ss (setq n (1- n)))) height)
    ); repeat
  ); if
); defun

 

Usage:  to give selected Dimension(s) a text height of 6.5, do this:

 

(dtho 6.5)

 

Or, if you have a specific height you always want to apply, make a command:

 

(defun C:DTH15 (/ ss n); = Dimension Text Height 15 units
  (if (setq ss (ssget '((0 . "DIMENSION"))))
    (repeat (setq n (sslength ss))
      (vla-put-TextHeight (vlax-ename->vla-object (ssname ss (setq n (1- n)))) 15)
    ); repeat
  ); if
); defun

 

If, in either of those, you want to do all Dimensions in the drawing, rather than have the User select them, add the "_X" selection mode in the (ssget) function:

 

(if (setq ss (ssget "_X" '((0 . "DIMENSION"))))

 

Kent Cooper, AIA