Jump to content

Get Tags and Prompts from dynamic block


rog1n

Recommended Posts

Hello,

 

As said in title how I get the TAGs and Prompts from a dynamic block, but I want to get from a block is only inside the "insert block " not inserted on Model/Layouts. Is possible to do this or I can get TAGs and Prompts only from a entity?

Link to comment
Share on other sites

1st step would be to use lee-mac dynamic block properties lsp, to a block that is inserted, second would be if I understand correct you have not inserted the block, if correct insert it get properties and then erase.

 

 

 

  • Like 1
Link to comment
Share on other sites

1 hour ago, BIGAL said:

1st step would be to use lee-mac dynamic block properties lsp, to a block that is inserted, second would be if I understand correct you have not inserted the block, if correct insert it get properties and then erase.

 

 

 

 

I understood your idea. Thank you

Anyaway, so is not possible get the properties of a block only in the "library of blocks" (block insert)? 

Link to comment
Share on other sites

10 hours ago, Tor2o said:

You can edit an attribute definition only before it is saved as part of a block definition.

With Lisp you certainly can.

  • Like 1
Link to comment
Share on other sites

7 hours ago, Roy_043 said:

Is this about dynamic block property values, attribute values, or attribute tags and prompts?

 

It's about attribute TAGs and prompts from a dynamic block,  my question is if possible to get the attribute TAGs and prompts from a block is only inside here:
 

exemplo.png

Link to comment
Share on other sites

13 hours ago, Roy_043 said:

With Lisp you certainly can.

 

My understanding from re-reading several times is the tags and prompts? from a block nested inside a dynamic block. :huh:

  • Like 1
Link to comment
Share on other sites

8 minutes ago, dlanorh said:

 

My understanding from re-reading several times is the tags and prompts? from a block nested inside a dynamic block. :huh:

 

I think what he's asking is something like (getstring T "\nSpecify tag name: ") and then list all the blocks with that specific tag name. Unfortunately of all the posts I've done here and with my knowledge, I don't have a idea how to do that :(

  • Like 1
Link to comment
Share on other sites

2 minutes ago, Jonathan Handojo said:

 

I think what he's asking is something like (getstring T "\nSpecify tag name: ") and then list all the blocks with that specific tag name. Unfortunately of all the posts I've done here and with my knowledge, I don't have a idea how to do that :(

 

I think he needs to post a sample dwg.

 

Quote

how I get the TAGs and Prompts from a dynamic block, but I want to get from a block is only inside the "insert block " not inserted on Model/Layouts. Is possible to do this or I can get TAGs and Prompts only from a entity?

 

I'm confident i'm in the same ballpark, but I don't understand the prompts as opposed to the tagstring. If it is the prompt you're going to have to access either the attribute definitions entity data (code 3) or attribute definitions object 'promptstring property

 

Select the Block and loop through the entities to find the nested block or nentsel the nested block. Find its name or effectivename the get that block definitions from the block table/collection get the attributes and loop through extracting what you want.

  • Like 1
Link to comment
Share on other sites

I will try explain better,

 

I have a block in other DWG, this block have attributes. So I will use the Lee Mac steal from DWG to get this block to my present DWG. the Block is now in the list of blocks here:

exemplo.png.d5666af43257e9c3ee94d27f18bfa787.png

 

If you insert the block in the Model/Paperspace and double click show the "Attribute Editor" 

 exemplo2.png.b75d4066a12cb63f9ccfe9804f866e6e.png

 

Now I can get the list of Tags and values from the block inserted, my questions are:
1- How I get the list of Prompts?
2-The suggestion of BIGAL works I inserted the block in coordinates 0,0 then extract that informations (only the Prompts I didn't get), but is possible to get the list of Tag, Prompt and Value without insert the block in Model/Paperspace? 

 

 

Edited by rog1n
Link to comment
Share on other sites

Not sure how you want to use it, but try this. It includes constant attributes that have no prompt string.

 

(defun c:getblkpmpts ( / ent bname elst typ lst msg)

  (while (not ent)
    (setq bname (getstring "\nEnter Block Name "))
    (if (tblsearch "block" bname) (setq ent (tblobjname "block" bname)))
  )

  (setq elst (entget ent) typ (cdr (assoc 0 elst)) msg "")
  (while ent
    (if (= typ "ATTDEF") (setq lst (cons (list (cdr (assoc 2 elst)) (cdr (assoc 3 elst))) lst)))
    (setq ent (entnext ent))
    (if ent (setq elst (entget ent) typ (cdr (assoc 0 elst))))
  )
  (foreach x (reverse lst) (setq msg (strcat msg "TAG :  " (car x) "\U+0009 Prompt :  " (cadr x) "\n")))
  (alert msg)
  (princ)
)

 

  • Thanks 1
Link to comment
Share on other sites

12 minutes ago, dlanorh said:

Not sure how you want to use it, but try this. It includes constant attributes that have no prompt string.

 


(defun c:getblkpmpts ( / ent bname elst typ lst msg)

  (while (not ent)
    (setq bname (getstring "\nEnter Block Name "))
    (if (tblsearch "block" bname) (setq ent (tblobjname "block" bname)))
  )

  (setq elst (entget ent) typ (cdr (assoc 0 elst)) msg "")
  (while ent
    (if (= typ "ATTDEF") (setq lst (cons (list (cdr (assoc 2 elst)) (cdr (assoc 3 elst))) lst)))
    (setq ent (entnext ent))
    (if ent (setq elst (entget ent) typ (cdr (assoc 0 elst))))
  )
  (foreach x (reverse lst) (setq msg (strcat msg "TAG :  " (car x) "\U+0009 Prompt :  " (cadr x) "\n")))
  (alert msg)
  (princ)
)

 

 

 

Exactly this! Now I can adapt to my need.

 

Thank you  dlanorh.

  • Like 1
Link to comment
Share on other sites

7 minutes ago, rog1n said:

 

 

Exactly this! Now I can adapt to my need.

 

Thank you  dlanorh.

 

No problem, glad I could help.

Link to comment
Share on other sites

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