- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi All,
We have to add a ton of attributes to all of our blocks.
I found code that was originally written by Lee Mac, but it was designed to type in the block name that you wanted.
I just want to be able to select all the blocks that I want and then have it insert the tags into all of the blocks that are selected.
I tried to change the "name enter box" to a select command but the program comes back with no blocks found.
Sorry I am new to this and may as well be trying to learn another language.
(defun c:addattribs ( / blk def )
; Get Entities
(while (not blk)
(princ "\nSelect Blocks to Update:")
(setq blk (ssget '((-4 . "<NOT") (0 . "INSERT,POLYLINE,VIEWPORT") (-4 . "NOT>"))))
) ;_ end while
)
(if (/= "" blk)
(progn
(setq def (vla-item (vla-get-blocks (vla-get-activedocument (vlax-get-acad-object))) blk))
(vla-addattribute def
(getvar 'textsize)
acattributemodelockposition
"New Attribute 1"
(vlax-3D-point 0 0)
"NEW_TAG1"
"New Value 1"
)
(vla-addattribute def
(getvar 'textsize)
acattributemodelockposition
"New Attribute 2"
(vlax-3D-point 0 (- (* 1.5 (getvar 'textsize))))
"NEW_TAG2"
"New Value 2"
)
(command "_.attsync" "_N" blk)
)
)
(princ)
)
(vl-load-com) (princ)
Thanks.
Solved! Go to Solution.