leonucadomi Posted December 13, 2023 Posted December 13, 2023 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 Quote
leonucadomi Posted December 13, 2023 Author Posted December 13, 2023 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) ) Quote
EnM4st3r Posted December 13, 2023 Posted December 13, 2023 you could cycle trough the attributes with entnext until you have all attributes then appl the changes to them Quote
pkenewell Posted December 13, 2023 Posted December 13, 2023 (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 December 13, 2023 by pkenewell Corrections 1 Quote
pkenewell Posted December 13, 2023 Posted December 13, 2023 18 minutes ago, leonucadomi said: thanks @leonucadomi Just did an update for corrections. Please re-copy and try it. 1 Quote
Recommended Posts
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.