Jump to content

Recommended Posts

Posted

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

Screenshot 2022-05-30 090624.png

Posted

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 ))
)

 

Posted

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)
)

 

Posted

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)?

 

 

Posted
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.

Posted

THX To Bigal

i found old post of him and solve the problem

 

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...