Jump to content

Recommended Posts

Posted

Hi everyone,

I’m trying to get the text from an Attribute Definition (ATTDEF) inside a dynamic block using AutoLISP, and then change that text. Unfortunately, I haven’t been able to make it work.

Here is what I tried:

(defun getblockentities (blk / ent enx rtn)
  (if (setq ent (tblobjname "block" blk))
    (while (setq ent (entnext ent))
      (setq enx (entget ent))
      (if (= "INSERT" (cdr (assoc 0 enx)))
        (getblockentities (cdr (assoc 2 enx)))
        (progn
          (setq text (vlax-ename->vla-object ent))
          (if (car text)
            (setq tlist (append tlist (list text)))
          )
        )
      )
    )
  )
)

And then I tried to collect attributes like this:
 

(setq attlist (vlax-invoke textObj 'GetAttributes))
(foreach att attlist
  (if (not (eq (vla-get-tagstring att) nil))
    (progn
      (setq text (vla-get-tagstring att))
      (setq tlist (append tlist (list text)))
    )
  )
)

But with this approach I couldn’t retrieve the attribute text. Is there another method to get (and later modify) the text string of an attribute inside a dynamic block?

Thanks in advance for any guidance.

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