Jump to content

change block text size...help


Recommended Posts

Posted

hello friends:

I have a routine to change the texts in these blocks.

The problem is that I have to click on each one of them.

I would like to make a selection in the window

 

and change text size to 20.

any recommendation is welcome.

WELD.dwg

Posted

sure 

(defun C:test ( / e)
(setq e (vlax-ename->vla-object (car (nentsel "\n Select an attribute to change:"))))
(vla-put-height e 20)
(princ)
)

 

Posted

you could cycle trough the attributes with entnext until you have all attributes then appl the changes to them
 

Posted (edited)

Something like this? Quickly written and tested and no minimal error handling: EDIT: Added an option to enter the text height or default to 20.

(defun c:foo (/ at dc ht i n obj ss)
  (vl-load-com)
  (vla-startundomark (setq dc (vla-get-activedocument (vlax-get-acad-object))))
  (if (and (setq ss (ssget '((0 . "INSERT"))))
           (setq ht (getreal "\nEnter Height Value <20.0>: ")
                 ht (if ht ht 20.0)
           )
      )
     (repeat (setq i (sslength ss))
        (setq obj (vlax-ename->vla-object (ssname ss (setq i (1- i))))
              at  (vla-getattributes obj)
              at  (if at (vlax-variant-value  at))
              n 0
        )
        (while (and at (>= (vlax-safearray-get-u-bound at 1) n))
           (vla-put-height (vlax-safearray-get-element at n) ht)
           (setq n (1+ n))
        )
     )
  )
  (vla-endundomark dc)
  (princ)
)

 

Edited by pkenewell
Corrections
  • Thanks 1
Posted
18 minutes ago, leonucadomi said:

thanks

@leonucadomi Just did an update for corrections. Please re-copy and try it.

  • Thanks 1

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...