railbuff Posted September 29, 2010 Share Posted September 29, 2010 I have 100's of wblocks to which I need to add attributes. Does anyone know of a batch program that will do this? Quote Link to comment Share on other sites More sharing options...
NBC Posted September 29, 2010 Share Posted September 29, 2010 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 Quote Link to comment Share on other sites More sharing options...
irneb Posted September 29, 2010 Share Posted September 29, 2010 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. Quote Link to comment Share on other sites More sharing options...
railbuff Posted September 29, 2010 Author Share Posted September 29, 2010 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. Quote Link to comment Share on other sites More sharing options...
irneb Posted September 30, 2010 Share Posted September 30, 2010 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 -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). Quote Link to comment Share on other sites More sharing options...
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.