Hi i use ASRM lisp to replace values in multiple block attribiute. I want to do a change in this code. This code ask me to select all the blocks i want to do the change. I want to pick only one block (spesific block) and then automatic select all same blocks in the drawing. I use multiple attribute blocks and sometimes I want to change to spesific type of block and not to all blocks in the drawing.
;; Get Attribute Values - Lee Mac
;; Returns an association list of attributes present in the supplied block.
;; blk - [ent] Block (Insert) Entity Name
;; Returns: [lst] Association list of ((<tag> . <value>) ... )
;; http://www.lee-mac.com/attributefunctions.html#algetattributevaluerc
(defun LM:getattributevalues
( blk
/ enx
) )
(LM:getattributevalues blk)
)
)
)
;; Set Attribute Value - Lee Mac
;; Sets the value of the first attribute with the given tag found within the block, if present.
;; blk - [vla] VLA Block Reference Object
;; tag - [str] Attribute TagString
;; val - [str] Attribute Value
;; Returns: [str] Attribute value if successful, else nil.
(defun LM:vl
-setattributevalue
( blk tag val
) )
)
)
)
;;;;;;;;;;;;;
;; ASR for Attribute String Replace
(defun c:ASR
( / from to ss i atts blk a tag val newval
) ;;(setq from "AZERTY")
;;(setq to "QUERTY")
(setq atts
(LM:getattributevalues blk
)) ;; substitute the attribute
(LM:vl
-setattributevalue
(vlax
-ename
->vla-object blk
) tag newval
) ))
)
)
)
;; ASRM for Attribute String Replace Multiple.
;; Same as ASR, except it changes multiple instances of the the "from" to "to"
(defun c:ASRM
( / from to ss i atts blk a tag val newval
) ;;(setq from "AZERTY")
;;(setq to "QUERTY")
(setq atts
(LM:getattributevalues blk
)) ;; substitute the attribute
(LM:vl
-setattributevalue
(vlax
-ename
->vla-object blk
) tag newval
) ))
)
)
)
Thanks