+ Reply to Thread
Results 1 to 5 of 5
  1. #1
    Forum Newbie
    Using
    AutoCAD 2011
    Join Date
    Aug 2010
    Posts
    2

    Default Adding Atributes

    Registered forum members do not see this ad.

    I have 100's of wblocks to which I need to add attributes. Does anyone know of a batch program that will do this?

  2. #2
    Forum Deity NBC's Avatar
    Using
    AutoCAD 2009
    Join Date
    Aug 2007
    Location
    Manchester, UK
    Posts
    2,109

    Default

    Can you give us a little more information?
    Are the values of the attributes (i.e. the tag, prompt, and final value) all the same across the blocks ?
    Is the location of the attribute to be the same in the blocks ?
    etc etc
    Life's constantly changing - keep up or get left behind

  3. #3
    Super Member irneb's Avatar
    Computer Details
    irneb's Computer Details
    Operating System:
    Win7 Pro 64bit
    Computer:
    Antec One Hundred
    Motherboard:
    ASUS P8P67-Pro P67
    CPU:
    Intel i7 2600 @ 3.4GHz
    RAM:
    16GB-1600MHz
    Graphics:
    GeForce GT 430 (1GB)
    Primary Storage:
    Seagate1TB SATA2 - 7200rpm
    Monitor:
    Samsung 2333TN 23" 1920 x 1080 Full HD LCD Monitor2GW
    Discipline
    Architectural
    irneb's Discipline Details
    Occupation
    Architectural Technician and Programmer
    Discipline
    Architectural
    Using
    AutoCAD 2013
    Join Date
    Sep 2010
    Location
    Jo'burg SA
    Posts
    1,666

    Default

    Also, are these WBlocks usually used by insert & then explode so the text could be edited? I.e. do you want to replace the normal MText/DText with AttDefs?

    If your answers to NBC's questions are Yes in all instances, you best bet is using scripting. If mine as well, you'll need some lisp on top of the scripting. If there's differences between any 2 WBlocks then it's probably not as simple, and you'd possibly need to do some manual wangling. BTW, you can open a WBlock (it's nothing more than just a normal drawing) - and then you can easily use Copy-n-Paste to make duplicates of AttDefs then move them to their intended positions, double click to edit their tag names, etc.

    Once you've got these setup correctly, what's your intention? Do you want to update them to existing DWG's? Be careful with that since you may loose text data.

  4. #4
    Forum Newbie
    Using
    AutoCAD 2011
    Join Date
    Aug 2010
    Posts
    2

    Default

    These wblocks are used to aid the production of typically, electrical schematics. I need to add the attributes so that a bill of material can be generated. Information like: Item #, Description, Part #, Manufacturer, & Cost would be needed. The attributes do not have to be visible on the drawing.

  5. #5
    Super Member irneb's Avatar
    Computer Details
    irneb's Computer Details
    Operating System:
    Win7 Pro 64bit
    Computer:
    Antec One Hundred
    Motherboard:
    ASUS P8P67-Pro P67
    CPU:
    Intel i7 2600 @ 3.4GHz
    RAM:
    16GB-1600MHz
    Graphics:
    GeForce GT 430 (1GB)
    Primary Storage:
    Seagate1TB SATA2 - 7200rpm
    Monitor:
    Samsung 2333TN 23" 1920 x 1080 Full HD LCD Monitor2GW
    Discipline
    Architectural
    irneb's Discipline Details
    Occupation
    Architectural Technician and Programmer
    Discipline
    Architectural
    Using
    AutoCAD 2013
    Join Date
    Sep 2010
    Location
    Jo'burg SA
    Posts
    1,666

    Default

    Registered forum members do not see this ad.

    In that case you could simply have a script (i.e. the keystrokes you'd have typed saved into a text file with SCR extension). Since you're not displaying the attribute, you shouldn't be too worried about stuff like font, height, etc. E.g. to place one new attribute
    Code:
    -ATTDEF
    Invisible
    
    Name
    Prompt
    Value
    0,-2,0
    1
    0
    Note in a SCR file you can't have mouse input, so you need the command-line version of any command an no dialogs.

    This basically starts the command line version of AttDef, sets it to Invisible, gives the TagName, Prompt & Default value. Places the attribute @0,-2,0, height=1, rotation=0. To see what else you could do to the attribute type -AttDef (notice the minus / hyphen prefix) and press F1 to see the various different command-line options.

    Rinse-n-repeat for each attribute you need in the block. Then add a QSave.

    Now for the batch thingy, either use ADesk's ScriptPro (note only works on 32bit systems), or (my favorite) get the free AutoScript to have it run on 32/64bit from directly inside ACad. Or search for any other batch addons - such as BatchLisp. Basically you'd select the DWG's on which you want the SCR applied - it then opens each and runs the SCR Script file.

    Now to the drawings where you already have these blocks inserted. You could run a similar SCR which would insert from file and overwrite the blocks' definitions. Then run the AttSync command to match the existing block reference's attributes to that of the definition.

    Automatically filling in the values is a whole different matter. Which may-or-may-not be possible through some intricate lisping (depending on how complex the values are).

Similar Threads

  1. automatic numbering of block atributes.. is it possible??
    By ottoatom in forum AutoCAD General
    Replies: 11
    Last Post: 12th Nov 2012, 11:43 pm
  2. Adding Blocks
    By nicbazwilly in forum AutoCAD General
    Replies: 20
    Last Post: 15th Jun 2010, 01:19 pm
  3. VBA Atributes
    By Eklips in forum AutoLISP, Visual LISP & DCL
    Replies: 2
    Last Post: 18th Sep 2009, 08:19 pm
  4. Formula Fields and Atributes
    By RickyD302 in forum AutoLISP, Visual LISP & DCL
    Replies: 3
    Last Post: 3rd Sep 2009, 06:09 pm
  5. adding printer
    By abo maab in forum AutoCAD General
    Replies: 4
    Last Post: 24th Apr 2007, 12:25 pm

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts