inserting blks from attribute values

Discussion in 'AutoCAD' started by molokaiboy, Jul 14, 2004.

  1. molokaiboy

    molokaiboy Guest

    Is it possible to insert a block based on a attribute value? I have a set of drawings with attributed blocks. I want to insert block 123456-2 if the attribute tag "name" = 123456. Can this be done?

    TIA

    Collin
     
    molokaiboy, Jul 14, 2004
    #1
  2. molokaiboy

    ECCAD Guest

    Questions first:
    What version of Acad ?
    How to make up the 'insert' blockname (i.e. (strcat tagname "-2") ?
    Do you want to 'pick' a block, find the 'tagname' and then insert the block with a pause to pick insertion point ?

    Bob
     
    ECCAD, Jul 14, 2004
    #2
  3. molokaiboy

    molokaiboy Guest

    Bob,

    This is going along with the previous project to assisted me with.

    I am using MDT 2004/ACAD 2004.

    I want to create a command that will search for all blocks inserted in the drawing. If block 1 is inserted, the attribute tag "name" should have a value assigned. If the value = 123456, then I want to insert block 123456-2 in at 0,10,0 from the 123456 blocks insertion point. Does this make sense?

    TIA

    Collin
     
    molokaiboy, Jul 14, 2004
    #3
  4. molokaiboy

    ECCAD Guest

    Starting to make more sense. Next question:
    What is the 'tagname' to search for ? And, is it a constant ?

    Bob
     
    ECCAD, Jul 14, 2004
    #4
  5. molokaiboy

    molokaiboy Guest

    Bob,

    The tag name is not constant. I have created a generic block for a part. The tag name will contain the specific part number. I guess I will need to list all of the possible part numbers in the routine.

    Collin
     
    molokaiboy, Jul 14, 2004
    #5
  6. molokaiboy

    ECCAD Guest

    Collin,
    I suggest having at least (2) attrib's for your 'generic' part.
    Attrib 1 = tag 'part#', with value part number
    Attrib 2 = tag 'blockname', with blockname as value.
    Then, we can scan for 'tag' blockname, get the value as a
    'block name' string, and a function to insert it....

    Bob
     
    ECCAD, Jul 14, 2004
    #6
  7. molokaiboy

    molokaiboy Guest

    Bob,

    The block name would be the same for the "family" of parts. For now, I'll call the two block names "block1", "block2" with the tagnames "001", "002" respectively. I would still need to validate the 'part number' tag field and insert the block based on the value.

    Collin
     
    molokaiboy, Jul 14, 2004
    #7
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.