77marco77
Guest
Good morning.
in a drawing (which is used as a source of blocks for new designs) with over 6000 blocks I would like to replace the default value of the attribute tag with the already inserted value manually in the block.
I found this code of lee mac:
that does what I need but I have to enter the block name (I cannot select), the tag name and the new default value of the tag, but they are many blocks and each has between 12 and 20 attributes.. .
is it possible faster to make the block selection (or multiple blocks), the attribute (or multiple attributes), which reads the value already inserted and let it enter as a new default?
in a drawing (which is used as a source of blocks for new designs) with over 6000 blocks I would like to replace the default value of the attribute tag with the already inserted value manually in the block.
I found this code of lee mac:
Code:
;; lee-mac - 2017
(defun c:defatt ( / bln def tag )
(if (= "" (setq bln (strcase (getstring t "\nspecify block name filter (use * for all) <*>: "))))
(setq bln "*")
)
(if (= "" (setq tag (strcase (getstring "\nspecify tag name filter (use * for all) <*>: "))))
(setq tag "*")
)
(setq def (getstring t "\nspecify new default value: "))
(vlax-for blk (vla-get-blocks (vla-get-activedocument (vlax-get-acad-object)))
(if (and (= :vlax-false (vla-get-islayout blk) (vla-get-isxref blk)) (wcmatch (strcase (vla-get-name blk)) bln))
(vlax-for obj blk
(if (and (= "acdbattributedefinition" (vla-get-objectname obj))
(wcmatch (strcase (vla-get-tagstring obj)) tag)
(vlax-write-enabled-p obj)
)
(vla-put-textstring obj def)
)
)
)
)
(princ)
)
(vl-load-com) (princ)
is it possible faster to make the block selection (or multiple blocks), the attribute (or multiple attributes), which reads the value already inserted and let it enter as a new default?