modify text height dimension style

modify text height dimension style

Anonymous
Not applicable
1,008 Views
2 Replies
Message 1 of 3

modify text height dimension style

Anonymous
Not applicable

hi
i want to know if someone find a way to make a something like a ratio between text height of dimension style and specific length?

for example if i have a line and its length 1000 i want to be dimension text height about 20% from its length this mean the text height will 200
and thanks

0 Likes
1,009 Views
2 Replies
Replies (2)
Message 2 of 3

DannyNL
Advisor
Advisor

See the code below.

 

I think you'll have more use to change the scale than to change the text height alone. If you change the scale all dimension style settings will be scaled including i.e. the arrows, so it will give you a much better result.

 

Test1 only changes the text height to 20% of the measured length as requested. Test2 will change the scale factor to 5% of the measured length.

To test use two separate dimensions; so do not use Test2 on the same dimension after you used Test1 unless you did an undo first.

 

Just some food for thought; if you are unfamiliar with annotation scaling, you might need to take a look at that as well, since this scales your texts, dimensions, etc. automatically to the used viewport/drawing scale if setup and used correctly.

 

(defun c:Test1 (/ T_Object)
   (if
      (and
         (setq T_Object (car (entsel)))
         (wcmatch (vla-get-ObjectName (setq T_Object (vlax-ename->vla-object T_Object))) "*Dimension")
      )      
      (vla-put-TextHeight T_Object (* (vla-get-Measurement T_Object) 0.2))
   )
   (princ)
)

(defun c:Test2 (/ T_Object)
   (if
      (and
         (setq T_Object (car (entsel)))
         (wcmatch (vla-get-ObjectName (setq T_Object (vlax-ename->vla-object T_Object))) "*Dimension")
      )      
      (vla-put-ScaleFactor T_Object (* (vla-get-Measurement T_Object) 0.05))
   )
   (princ)
)
Message 3 of 3

Anonymous
Not applicable

thanks my friend

0 Likes