p7q Posted 7 hours ago Posted 7 hours ago (edited) 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. edit: ı'm adding to dwg for trydinamic block text.dwg Edited 5 hours ago by p7q Quote
Saxlle Posted 2 hours ago Posted 2 hours ago Hi @p7q, You can try with this several options from image below. From the last lines of code, you will get something like this. Try to play with this. Also, you can get from Lee Mac website about Attribute Functions. Best regards. 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.