Extract blocks per layer (even zero-values)

Extract blocks per layer (even zero-values)

Anonymous
Not applicable
1,385 Views
8 Replies
Message 1 of 9

Extract blocks per layer (even zero-values)

Anonymous
Not applicable

Hi everybody, thanks in advance for taking time to help.

I'm looking for (information on) a lisp that can do the following:

 

 

Extract block-quantities per layer to an excel (or table that I could copy/paste).

It should also count blocks that may not be present.

It is important the list is in a specific order (not alfabetical or anything) (for copying the quantities to another excel that calculates other stuff)

 

So the table would look something like:

 

 

Layer1

Layer2

Layer3

Layer4

Layer5

Layer6

Layer7

Block1

0

5

15

0

8

5

12

Block2

5

2

8

12

12

12

12

Block5

0

0

0

0

0

0

0

BlockX

8

10

8

10

8

8

10

Block3

12

6

8

4

8

12

12

 

 

 

Any bits of help are greatly appreciated!

 

0 Likes
Accepted solutions (1)
1,386 Views
8 Replies
Replies (8)
Message 2 of 9

dbroad
Mentor
Mentor

Without programming, this process should work.  

  1. Set up an attribute extraction template with  the following:
    BL:NAME C040000
    BL:LAYER C040000

     

  2. Use attext command with cdf format output.
  3. Use the built in capabilities of the spreadsheet to sort and summarize the data with a pivot table.

 

Architect, Registered NC, VA, SC, & GA.
Message 3 of 9

Anonymous
Not applicable

Hi

 

Thanks for the reply.

I did some research on 'attribute extraction'.

But I don't think it's what I need.

 

Attribute extraction only seems to look at blocks and give you the information of every block.

 

 

I need to look at layers, and extract all the different block-quantities. (no other details).

0 Likes
Message 4 of 9

dbroad
Mentor
Mentor
Accepted solution

What I suggested will give you a list of every block name and layer in excel format.  Using the pivot table feature will give you the table in your OP.

 

Another non-programmed approach is to use dataextraction as illustrated here.

 

Architect, Registered NC, VA, SC, & GA.
Message 5 of 9

pbejse
Mentor
Mentor

@Anonymous wrote:

 

 Another non-programmed approach is to use dataextraction ....... 


The OP's request sounds easy enough ( and fun ) to code but dbroads' suggestion is spot on. Cant get any easier than that.

Message 6 of 9

Anonymous
Not applicable

 

Okay, I'll try and play around with it a little bit.

Though at first sight I'm not really sure how I'll get blocks listed that arn't in any layer...

 

I'll try and work it out, and when I get to it I'll be sure to share the results!

 

 

Thanks again!

0 Likes
Message 7 of 9

Anonymous
Not applicable

 

Alright!

 

Got it sortof working with "Dataextraction" altough it needs alot of cleaning up. (and doesn't give a zero result when a block isn't present in the drawing)

 

But I get an empty result when I use "ATTEXT"

I copied the text you proposed into an empty notepad-file. Saved it and selected it as template.

Any ideas why this isn't giving results?

 

 

 

Thanks again, this will save lots of time when I get used to working with/around it!

0 Likes
Message 8 of 9

dbroad
Mentor
Mentor

Apparently the attext command will not do any extraction unless there is at least one attribute in the block, even if it is a constant attribute.  This is a disappointing limitation but is probably implied in the command name.  Dataextraction works fine.  The template can serve as a starting point for other drawings but you do need to make sure you save a unique template file for each project. Since dxe files have some binary content in addition to xml, it would be extremely difficult to program their creation.  I find it doesn't take much time however to run through the process and regularly use this command to generate a sheet index of rooms and sheets on which their plan views exist.

 

To maximize flexibility, it might be worth adding a set of constant attributes to each block with consistent tags on layer defpoints for block management.

 

I don't see how any method would generate a list of blocks that aren't there unless you maintain a master list of blocks which would take an enormous effort to continue to update unless your business model is static.

Architect, Registered NC, VA, SC, & GA.
Message 9 of 9

Anonymous
Not applicable

It doesn't work 100% perfect but it's all I need.

 

I use the data-extraction  and select all blocks I need counted.

To compensate for the missing blocks, I added them all into "layer 0".

In the pivot table I use a custom-sort to instantaneously get them in the right order.
So the excel-table is easy to paste 1:1 into my existing excel-table.

 

This already compensates for the most (and most important) blocks I need counting.

 

 

 

The busisness model is pretty static and straightforward though.
I draw plans for rental-equipment in the building-industry.

Seldon do new item's get added.

 

 

 

The way I was thinking of getting a perfect 1on1 table that I could paste into my excel (that serves as checklist and does some small extra calculations),

was with a lisp.

The lisp would just go chronologically:

count block 001 in layer 1             write in table

count block 001 in layer 2 till 50   write in table

count block 002 in layer1-50         write in table

count block 100 in layer1-50         write in table

 

for about a 100 blocks. (in maximum 40-50 layers).

 

This means 5000 computations and writes. So maybe not the best way either...

 

 

 

 

Either way I think I'll play around with it some more.

In a perfect situation I would get a perfect table in one click, and have semi/fully automated the autocad drawing as well... But I'll have some more time to implement that now I have some more bits of extra time.

Thanks to you and the other active members of the autodesk community!

 

 

 

 

 

0 Likes