Jump to content

Recommended Posts

Posted

Hello all,

 

 

I am attempting to extract a list of all blocks and their attributed text into excel (from which to build a BOM). Using the dataextraction commands works, but there are a lot of button clicks (aka places where users could get confused or click the wrong thing).

 

 

I tried using -dataextraction, but for some reason using the command line version does not let me search for objects in the current drawing. Opening the extraction wizard confirms this - whenever I load a template, even if I selected "also search in current drawing" when making it, it's unchecked by default.

 

 

 

 

Something like Lee Mac's program MacAtt might work, but it doesn't have a command line version.

 

 

I've also tried using the code from this thread http://www.cadtutor.net/forum/showthread.php?50663-Data-Extraction

but upon running it, I get "error: quit / exit abort"

 

 

I'm thinking there is a way to do what I want through the "ATTEXT" command, but every time I try to use it, it says "0 records in extract file" and the output file is blank.

 

 

Anyone have ideas about what else I can try?

Posted

Update:

 

 

I think I have a working solution. First I save the workbook to the dxf format, then I use autolisp to open a macro-enabled excel sheet and execute a macro, then I use VBA within excel to open the dxf and look for lines that say "AcDbBlockReference" and extract the data two lines below that, then delete everything else I don't need and save the workbook.

 

 

It's very slow and very crude but it gets the job done. If possible, I would like to know more about the AcDbBlockReference in the dxf format... Does anyone know if this is a reliable way of finding block names?

 

 

Again, if anyone has suggestions on a better way of doing this, I'm all ears. All I want it a list of block names in the current drawing, yet this ugly mess is the only was I've been able to do it :/

Posted

ATTEXT should work, providing your blocks do contain attributes, and your extraction template file is correct, can you post a sample drawing and a copy of your extraction template. I can take a look tomorrow, but someone else might be able to help with those available. I run a macro that extracts all block names and attributes with just one click, and places the output into a csv file.

Posted

My blocks do not contain attributes (at least, not any that I have specified) other than their name.

 

 

I can't seem to attach the template but I did attach the output (basically, it's the template you get by choosing all default options and only exporting "Author". I chose "Author" arbitrarily - I don't need to export any attributes at all; I only care about names and quantities, but I can't click next unless some attribute is checked.)

test drawing.dwg

test drawing.xls

Posted

The problem you are having with ATTEXT is because it expects blocks to contain at least one attribute that it can read the tag name from that is listed in the template file, and it can only read attributes who's tag name is listed. I think DATAEXTRACTION works differently but I don't have access to that from LT.

Once a block contains at least 1 valid attribute, you can export quite a bit of information from the blocks such as name, layer, position. Take a look at the attached blocks and template file, with something like this you can setup a toolpalette macro to extract all block information from an entire drawing (into a csv file) with just one mouse click, which can easily be imported into excel.

ext.txt

test drawing.dwg

Posted

Can you use EATTEXT? In AutoCAD electrical, that command does exactly the same thing as DATAEXTRACTION.

 

 

Ah ok, I didn't realize that ATTEXT required that. ATTEXT may not be suitable then because it would require an extra step of adding an attribute to every block... as people are adding blocks to the library, I'm sure they'll forget at some point, and then the BOM will be missing items and they won't realize it. Unless there is a command to first add an attribute to every block, then extract the data. Is there such a command? Using -ATTDEF just returns "That block has no editable attributes.".

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