Try this change to Emmanuel Delay - though he might have better ideas of course
The tags to change are in 2 lists - bit there is no checking that the 2 lists are the same length or valid attribute tags. As BigAl above, a more versatile approach might be select source, select tags, select destination, select tags - though that would need a bit more work to reduce user errors
(vl-load-com)
;; To copy/paste from fixed attributes, source tag: "SIGLA", destination tag: "NAME"
;; TTC Block
(defun c:ttcb ( / sText)
;;ADDED SOURCE and DESTINATION
(setq source_list (list "SIGLA" "SIGLA1"))
(setq final_destination (list "NAME" "NAME1"))
(defun TCC_copyAttribute (source blk / )
; (if (setq blk (entsel "\nSelect source block: ")) ;;REMOVED THIS LINE
(setq sText (LM:vl-getattributevalue (vlax-ename->vla-object (car blk)) source))
; ) ;; REMOVED THIS
)
(defun TCC_pasteAttribute (dest blk / )
; (if (setq blk (entsel "\nSelect destination block: ")) ;; REMOVED THIS LINE
(LM:vl-setattributevalues (vlax-ename->vla-object (car blk)) (list (cons dest sText)) )
; ) ;;REMOVED THIS
)
(setq Source_blk (entsel "\nSelect source block: "))
(setq Destination_blk (entsel "\nSelect destination block: "))
(setq acount 0)
(while (< acount (length source_list))
; (while (TCC_copyAttribute "SIGLA") ;;REMOVED THIS LINE
; (TCC_pasteAttribute "NAME") ;;REMOVED THIS LINE
(TCC_copyAttribute (nth acount source_list) Source_blk )
(TCC_pasteAttribute (nth acount final_destination) Destination_blk)
; ) ; end while ;;REMOVED THIS LINE
(setq acount (+ acount 1))
) ; end while
)
;; Get Attribute Value - Lee Mac
;; Returns the value held by the specified tag within the supplied block, if present.
;; blk - [vla] VLA Block Reference Object
;; tag - [str] Attribute TagString
;; Returns: [str] Attribute value, else nil if tag is not found.
(defun LM:vl-getattributevalue ( blk tag )
(setq tag (strcase tag))
(vl-some '(lambda ( att ) (if (= tag (strcase (vla-get-tagstring att))) (vla-get-textstring att))) (vlax-invoke blk 'getattributes))
)
;; Set Attribute Values - Lee Mac
;; Sets attributes with tags found in the association list to their associated values.
;; blk - [vla] VLA Block Reference Object
;; lst - [lst] Association list of ((<tag> . <value>) ... )
;; Returns: nil
(defun LM:vl-setattributevalues ( blk lst / itm )
(foreach att (vlax-invoke blk 'getattributes)
(if (setq itm (assoc (vla-get-tagstring att) lst))
(vla-put-textstring att (cdr itm))
)
)
)