Searching Attributes

Discussion in 'AutoCAD' started by Scott, Aug 22, 2003.

  1. Scott

    Scott Guest

    Hi everybody!

    I was wondering if it is possible to search for a specific attribute in an
    open drawing by creating a table of all the attributes contained in the
    drawing and then using the member function to search the table?

    This is what I have so far:

    (WHILE (SETQ ALIST (TBLNEXT "ATTRIBUTE" (NULL ALIST)))
    (SETQ ANLIST (CONS (CDR (ASSOC 2 ALIST)) ANLIST))
    )

    (REVERSE ANLIST)

    (SETQ ALSEARCH (MEMBER "DWGNO" ANLIST))

    This doesn't seem to work, "attribute" isn't a valid table function.

    Thanks for the help
     
    Scott, Aug 22, 2003
    #1
  2. Scott

    Mark Propst Guest

    You may want to rethink exactly what you want to do.
    In other words what does "a specific attribute" mean?
    "attributes" or "attribute references" which is what I think you really
    mean, are not in the 'drawing' they are in 'block references' which are in
    the 'drawing'.
    And as you discovered by trying (good for you), there is no 'attributes'
    table.
    (you would have discovered that also by reading the help file on "tables")

    my guess is that you have a specific block which has a specific attribute
    tag in which you're interested, possibly to extract the 'value' contained in
    that tag or who knows what you want to do with it exactly, once you've
    'found' it.

    you can collect the blockreferences from the drawing with a filtered
    selection set or iteration then step though those with entnext or vla
    methods to get the specific attribute tag you're looking for and then do
    'what ever' with them..

    hth
    Mark

    why collect *all* attributes if it's only certain ones you want?
    eg: select only the block names you're looking for etc
    as your code demonstrates you know, member searches a list not a table
    kudos to you for making an effort !!!
     
    Mark Propst, Aug 22, 2003
    #2
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.