Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Block attributes extraction from a range of block with a prefix name BK-

8 REPLIES 8
SOLVED
Reply
Message 1 of 9
jannis4MFSW
360 Views, 8 Replies

Block attributes extraction from a range of block with a prefix name BK-

Hi,

I am trying to simplify the process in the office, in order to automate the gathering of information into a list for FF&E elements.

The data extraction tool is a good way to extract attributes from blocks into a single list.

This process is a bit complex because every time you want to expand your list and add a new block name, you have to edit your data extraction table again.

Because I want this to be easy for everyone in the office, I have concluded two ways to do that.

Honestly, I am more interested in the second one, which is more challenging. I could use some advice on whether it can be done.

What I want from the bigining is to setup my table with one block with specific attributes in order not to expand my list.

The first method is by creating an attribute block and nesting it with several others. But every time I want to edit its attributes, I have to open the master block and edit the attributes of the nested.

The second way is by creating a block category with a prefix name BK- so it can be easy to list the blocks that I am interested in.

Now, I know that I don't have the possibility to set the data extraction tool to read prefix - block names. But I am wondering if I can edit the DXE file in order to do so. Until now, with the help of AI coding, I didn't manage any results, every time the DXE reference file is corrupted. I don't even know if I can edit it easy in Lisp, VB, or Notepad.

Is there something that can be done, does anyone have a similar problem?

Thanks,

8 REPLIES 8
Message 2 of 9
daniel_cadext
in reply to: jannis4MFSW

Here’s a sample in python that extracts all blocks that start with SPK

uses pandas to organize the data and writes it to excel.

I’m sure there’s a way in lisp though

 

https://pyarx.blogspot.com/2023/11/autocad-python-pandas-and-excel.html

 

 

Python for AutoCAD, Python wrappers for ARX https://github.com/CEXT-Dan/PyRx
Message 3 of 9
Sea-Haven
in reply to: jannis4MFSW

Like Daniel that is why you learn lisp or python and make custom lisps to suit a project, to give you an idea select 100+ blocks sort and count up then make a Table in dwg with option send to Excel.

 

It is pretty straight forward to use a text file with block names and get attributes, just use Notepad to make block names.

 

You can use wild cards in searching for blocks "B*" would get all "B" blocks using ssget and a block name filter.

 

 

(setq ss (ssget "X" (list (cons 0 "INSERT")(cons 2 "A*,B*,C*")(cons 410 (getvar 'ctab)))))

 

Avoid nested blocks complicates things so much.

 

Message 4 of 9
jannis4MFSW
in reply to: Sea-Haven

For me, it would be okay to work with Lisp. I have already prepared a small script, but all the results are in the command line. The problem is that I don't think everyone in the office will be able to work with that. I think the first scenario will work better for everyone. But why avoid nested blocks? As far as I tested with the data extraction tool, it was okay. Is the problem in scripting?

Message 5 of 9
daniel_cadext
in reply to: jannis4MFSW

Nested blocks can be an issue when working through selection sets.

Working through the database avoids this issue, there’s pros and cons of both

Python for AutoCAD, Python wrappers for ARX https://github.com/CEXT-Dan/PyRx
Message 6 of 9
ec-cad
in reply to: jannis4MFSW

Untested, but should output a .csv (Excel) formatted text file to double-click into Excel.

You'll have to tune it a bit for your Blockname(s) and Attribute Tag names.

Since you say " I have already prepared a small script, but all the results are in the command line.",

maybe add to that script the report_str_csv portion to output them to disk.

Let me know if it helps out.

ECCAD

Message 7 of 9
Sea-Haven
in reply to: jannis4MFSW

Problems with other staff using ok use a menu so its clear which to choose, HOPEFULY.

 

There is like 100+ behind this "Library" pop menu, which has sub menu's

SeaHaven_0-1713252060579.png

You can do help in the menu. But adopted a simpler method all knew where directory "How to" was located and had various descriptions of how to use the menu options, Pdf's, Doc's and Movies.

 

 

 

 

 

 

 

Message 8 of 9
Sea-Haven
in reply to: jannis4MFSW

A one size fits all may not be the solution, we had various extract options, not all to do with blocks. So think about say text files with the block names in them, so can have multiple extract proformas, even as an example get certain hatch areas by layer and p/lines total lengths by layer filters. 

 

To edit a TXT file is as easy as it gets. An advanced option could be a add / remove names then do search. Lee-mac has a nice select from a list of say block names using a dcl. If only a few block names just select each block for name to be added to a extract. Then just select all.

 

Just a few suggestions rather than locking into 1 single solution.

Message 9 of 9
jannis4MFSW
in reply to: jannis4MFSW

Thank you all for the response. I have started using step-by-step LISP and formulas for the workflow of the office. I believe that for this, I will go with the nested attribute block and the data extraction process. All the scripting and the coding demand time to recreate lists or to add many steps to the workflow. I think the data extraction update table command is more direct and can be done for multiple files at once. I was hoping to edit the DXE file to customize the process. Thanks for the support; I will come back as soon as I have news, whether it was a success or a failure. :-))

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost