I have a routine that where i get the block (statically named) and update some attributes. I would like to add the ability to check for the first empty attribute from a selection of (IS1,IS2,IS3,IS4,IS5,IS6) then update the emtpy attributes with the rest of my routine. here's what I have - i have tried a foreach but really don't know what to do next.
(defun c:AttRenList ( / strRevLet strRevNo doc new tagLst strIS strDesc)
(setq strRevLet (getstring T "What is the revision letter? ")) ; Get the revision Letter from user eg A B C etc
(setq strRevNo (getstring T "What is the revision number? ")) ; get the revision number from user 1 2 3 4 etc
(setq strDesc (getstring T "What is the revision Description? ")) ; get the revision description from user
(setq tagLst ; All tags must be upper case.
(list
; OLD TAG NEW TAG PROMPT VALUE
(list (strcat "IS" strRevNo) (strcat "IS" strRevNo) (strcat "Issue #" strRevNo) (strcat strRevLet strRevNo))
(list (strcat "DESC" strRevNo) (strcat "DESC" strRevNo) (strcat "Issue Description #" strRevNo) strDesc)
(list (strcat "BY" strRevNo) (strcat "BY" strRevNo) "Drawn By (INITIAL)" "WR")
(list (strcat "CH" strRevNo) (strcat "CH" strRevNo) "Checked By (INITIAL)" "DL")
(list (strcat "APP" strRevNo) (strcat "APP" strRevNo) "Approver" "DL")
(list (strcat "REG" strRevNo) (strcat "REG" strRevNo) "Registration Type & No." "CPEng 1012053")
(list (strcat "COM" strRevNo) (strcat "COM" strRevNo) "Company" "ETK")
)
)
(setq doc (vla-get-activedocument (vlax-get-acad-object)))
(vla-endundomark doc)
(vla-startundomark doc)
(vlax-for blk (vla-get-blocks doc)
(if (= :vlax-false (vla-get-isxref blk))
(vlax-for obj blk
(cond
((= "AcDbBlockReference" (vla-get-objectname obj))
(if (= :vlax-true (vla-get-hasattributes obj))
(foreach att (vlax-invoke obj 'getattributes)
(if (setq new (assoc (vla-get-tagstring att) tagLst))
(progn
(vla-put-tagstring att (cadr new))
(vla-put-textstring att (cadddr new))
)
)
)
)
)
((= "AcDbAttributeDefinition" (vla-get-objectname obj))
(if (setq new (assoc (vla-get-tagstring obj) tagLst))
(progn
(vla-put-tagstring obj (cadr new))
(vla-put-textstring obj (cadddr new))
(vla-put-promptstring obj (caddr new))
)
)
)
)
)
)
)
(vla-endundomark doc)
(princ)
)
So need to find the empty att - strip its number off "IS" which will then feed in the list to update e.g if "IS3" is empty then I want then use that as the strRevNo = 3 I can adjust the user input for what the revision will be.
thanks
I cant get a foreach to work through the block attributes with filter for ISx and know how to stop when i get the empty att and then update the List accordingly.