Jump to content

LISP for block attributes extraction to Excel - AutoCAD LT 2024


Recommended Posts

Posted

What I want to do is to extract all the attributes of a "Cable" block that contains a cable number as an attribute. By extracting, I would be able to get a drawing cable list.

 

I have tried "Global Attribute Extractor & Editor" from Lee Mac, but unfortunately, it's not working. 

The LISP "Batch Attribute Editor" seems to extract the attributes, but only one at a time.

 

I have been able to do it via ATTEXT command and then copy .txt to Excel but is there any LISP that can do it automatically to Excel? 

Posted

Have you tried using the Express Tools "ATTOUT" command? It exports to a tab delimited text file, but could easily be imported into Excel using the "From TXT/CSV" button on the "Data" tab.

Posted

@xperia BTW You can also use the "DATAEXTRACTION" command. The Wizard will walk you through getting the blocks and attributes you want, and can export to an excel or csv.

Posted

As far as I know, this is not available in LT version.. I can check later if  they made it available in 2024.

Posted

Sorry - yes you are correct - DATAEXTRACTION command is not available in LT, and neither is ATTOUT. not sure if possible with the reduced AutoLISP in LT.

Posted
4 hours ago, xperia said:

What I want to do is to extract all the attributes of a "Cable" block that contains a cable number as an attribute. By extracting, I would be able to get a drawing cable list.

 

I have tried "Global Attribute Extractor & Editor" from Lee Mac, but unfortunately, it's not working. 

The LISP "Batch Attribute Editor" seems to extract the attributes, but only one at a time.

 

I have been able to do it via ATTEXT command and then copy .txt to Excel but is there any LISP that can do it automatically to Excel? 

 

Unfortunately many of my programs will not be compatible with AutoCAD LT, as the LISP API in LT does not support interfacing with ActiveX objects outside of the AutoCAD Object Model.

Posted

Well that is really unfortunate. You have some really amazing LISPs on your website! 🙂

 

I was so happy when they introduced LISPs but obviously I will not be able to use half of the scripts I find...

Posted (edited)

Big problem with write direct to Excel my preferred way, is that open an "Application" is not supported in LT 2024, but write to a csv is. Which you can open in Excel.

 

This is some test code should see all the attribute text in 1 block.

(defun c:test ( / )
(setq obj (vlax-ename->vla-object (car  (entsel "Pick block obj"))))
(setq atts (vlax-invoke obj 'Getattributes))
(foreach att atts
(setq txt (vlax-get att 'Textstring))
(princ (strcat "\n" txt))
)
(princ)
)
(c:test)

Let us know if it works in your 2024 LT. The more we know about what works the better for LT lisp.

Edited by BIGAL

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