admin管理员组文章数量:1334957
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.
本文标签: filterautoLISP routine to search through and find attributes in order to update themStack Overflow
版权声明:本文标题:filter - autoLISP routine to search through and find attributes in order to update them - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742378754a2463691.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论