(defun c:copy2cable ( / ss xitflg x tag en ix slen) ; Pick on parent or child device and copy the tag-ID ; value to all windowed cable marker symbols. For ; example, pick on a motor symbol then pick on the ; cable markers that tie to the wiring going to the ; motor. Cable tag-ID takes on the motor's tag-ID. (setq xitflg nil) (while (not xitflg) (setq xitflg T) (setq x (entsel "\nSelect motor or switch device:")) (if x (progn (setq xitflg nil) ; flag to stay in the loop ; Get TAG1/TAG2 from picked parent/child component or ; TAGSTRIP tag-ID from picked terminal symbol. (setq mtr_en (car x)) ; strip out the entity name ; of the picked motor or switch (setq tag (c:wd_getattrval mtr_en "TAG1*,TAG2,TAGSTRIP")) (if (AND tag (/= tag "")) (progn (princ "\nSelect cable markers (parent/children):") ; Build selection set of windowed or picked cable ; marker symbols (block names are HW01,HW02,VW01,VW02) (setq ss (ssget '((-4 . "")))) (if (/= ss nil) (progn (setq slen (sslength ss)) ; number of inserts (setq ix 0) ; used as index (while (< ix slen) ; loop through (setq en (ssname ss ix)) ; next entity (setq ix (1+ ix)) ; increment index ; Try to write the motor or switch TAG-ID value ; out to this cable marker symbol on its ; tag-ID attribute (could be TAG1, TAG2, or ; TAGSTRIP). (c:wd_modattrval en "TAG1*,TAG2*,TAGSTRIP" tag 1) ) (setq ss nil) ; release the selection set ) ) ) ) ) ) ) (princ) )