Extracting Specific Data From Excel And Making A Table

Extracting Specific Data From Excel And Making A Table

Anonymous
Not applicable
1,833 Views
3 Replies
Message 1 of 4

Extracting Specific Data From Excel And Making A Table

Anonymous
Not applicable

Hi guys,

 

I'm a new intern in a company and responsible for optimizing the block library of AutoCAD.
It seems like I'll have to work with AutoLISP for solving one specific problem that's causing me headaches.
The problem is that I've never worked with it before. I'm googling a lot and couldn't find something similar.
My goal is to learn AutoLISP so I can solve this problem and maybe others to come.

 

I would gladly appreciate it if you could point me in the right direction. What commands do I have to look for? What could the code look like? Any ideas how I could solve this?

 

Here's what I do:

 

I insert random blocks (for example Block_1, Block_2 and Block_3) in a new file. There is one Excel file with informations about all available blocks, yet I have to show only the informations of the blocks I inserted in AutoCAD (for example in a table).

 

  • a. Linking the Excel file was the wrong approach, because I have to link single sections of it to single blocks and then manually create a table out of these single "cells" in AutoCAD.
  • b. The Express Tools functions didn't help either, because I have to manually ATTOUT/ATTIN the data every time there's a change in the Excel table.

 

Please check the image I attached below, my English is limited.

 

Thanks a lot and cheers!

 

Fragestellung.png

 

0 Likes
Accepted solutions (1)
1,834 Views
3 Replies
Replies (3)
Message 2 of 4

DannyNL
Advisor
Advisor
Accepted solution

You don't need LISP for that as what you want is included in the built-in data extraction functionality (Ribbon Tab Insert --> Linking & Extraction Panel --> Extract Data).

 

  • First make sure that all possible blocks (from your example 1 through 30) are  available in the drawing, inserted or not inserted doesn't matter.
  • Save your drawing, if needed a copy to a temporary name
  • Create the data extraction through the ribbon and proceed with next to the step where you can select what to include in the extraction
  • Select in the bottom to display only blocks and select all the block names you want to include in the extraction
  • In the next step select the drawing filename property to extract. No worries, you are not interested in it but you need to select at least one property to be able to continue to the next step and you can hide the output of it in the extraction.
  • In step 5 you'll be able to refine the data and link the Excel file. Right click on the filename column and hide it. Also make sure at the bottom to select the 'combine identical rows'and hide the 'Count column'. With the button on the right you can link your Excel and connect the block name to the NAMEBLOCK column. Select only the STATUS column to be added to your extraction.
  • Proceed with the next steps and finish up to insert the table in your current drawing.

Whenever you insert a new block not yet included in the table or if you erase all blocks with the same name from the drawing, you can just update the table to refresh the data. And since the data extraction setup is saved to a .DXE file, you can use this in other drawings as well to create an extraction table.

Message 3 of 4

Anonymous
Not applicable
Thanks a lot DannyNL, you saved my day. I really appreciate it.
0 Likes
Message 4 of 4

DannyNL
Advisor
Advisor

You're welcome & glad I could help Smiley Happy

0 Likes