mousho Posted May 30, 2022 Posted May 30, 2022 hi friends i search the entire web with no success I'm looking for lisp that will extract specific block tag value as field that i could use it in my program. THX for the help Quote
BIGAL Posted May 30, 2022 Posted May 30, 2022 The problem is that objid is for that attribute in just 1 block, the next block attribute will have a different objid value. If that is ok say select block get objid and make the correct string to use in say mtext. You need to use something like this, where att is the attribute (strcat "%<\\AcObjProp Object(%<\\_ObjId " (vlax-invoke-method (vla-get-Utility (vla-get-activedocument (vlax-get-acad-object))) 'GetObjectIdString att :vlax-false) ">%).Textstring>%" ) lst )) ) Quote
mousho Posted May 31, 2022 Author Posted May 31, 2022 thx bigal but its not working i have this lisp from lee mac that give me great start but i couldnt to change it to work as a field Quote (defun LM:GetAttributeValue ( block tag ) (vl-some (function (lambda ( attrib ) (if (eq tag (vla-get-Tagstring attrib)) (vla-get-TextString attrib) ) ) ) (vlax-invoke block 'GetAttributes) ) ) (defun c:test1 ( / ent ) (if (setq ent (car (entsel "\nSelect Attributed Block: "))) (setq space_ex (LM:GetAttributeValue (vlax-ename->vla-object ent) (strcase "space"))) ) (princ) ) Quote
mhupp Posted May 31, 2022 Posted May 31, 2022 Pretty sure its case sensitive. so number wouldn't work but NUMBER will same with SPACE. NM see their using strcase to uppercase everything Also its a good idea to keep the authors notes/headers. Are you wanting the object id (2419762663504) or the value (20)? Quote
mousho Posted June 1, 2022 Author Posted June 1, 2022 12 hours ago, mhupp said: Pretty sure its case sensitive. so number wouldn't work but NUMBER will same with SPACE. NM see their using strcase to uppercase everything Also its a good idea to keep the authors notes/headers. Are you wanting the object id (2419762663504) or the value (20)? hi mhupp i want the number but as a field. In case anyone changes it then it will affect other block. Quote
mousho Posted June 6, 2022 Author Posted June 6, 2022 THX To Bigal i found old post of him and solve the problem Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.