VBA
Discuss AutoCAD ActiveX and VBA (Visual Basic for Applications) questions here.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Autocad Attribute Export to Excel

5 REPLIES 5
Reply
Message 1 of 6
Ryan_McKellar
18577 Views, 5 Replies

Autocad Attribute Export to Excel

Hi Guys, 

 

I am currently working on a project where I am taking a lot of Autocad Attributes and Eporting them to an excel file so they can be referenced in a table of contents type of manner. My question is if there is a way to have excel automatically update the tables after changes are made to the autocad file. This file is an ever changing thing so going back and running through the entire "Eattext" commad and re exporting and overwriting the existing file is very tiresome, especially when I am adding and deleting attributes daily. Is there a VBA program I can run to accomplish this task, I have failry limited VBA skills and haven't written in VBA for years. I am fairly new to exporting autocad attributes to excel so if there is a very simple fix that I do not know about please forgive my ignorance. 

 

I attached a very simplistic example of the general Idea of what I am trying to accomplish.

 

Any help would be greatly appreciated

 

Thanks

5 REPLIES 5
Message 2 of 6
norman.yuan
in reply to: Ryan_McKellar

There may be existing VBA program/code that does what you want or similar to what you want. But most likely, you need to write your own code to do exactly you want.

 

However, the important thing of your requirement is not to how to write VBA code (or .NET API code, which is a bit more furture-proof in term of AutoCAD programming), rather, it is how you decide the process workflow and how the workflow fit your situation the best.

 

You can do batch processing a bunch of drawings to extract attribute data to external data sotrage (be it Excel file or other type of file/database), automatically at certain time of the day, or run it manually whenver it is needed; This way, you can guaranttee the data in data storage is up-to-date at the moment of last batch processing completion. Also, AutoCAD user is not bothered to do any extra work to make sure data is updated to external data store.

 

You can right code (and loaded into AutoCAD whet it starts) to watch certain events iin AutoCAD. Say, you can handle AcadDocument.BeginDocClose/AcadApplication.BeginQuit event and extract attribute data and save it when this event happens. That is, user is free to do anything withthe drawing, and when the drawing is to be closed, you code examine the drawing and decide if there is attribute data to be extracted and saved. You can also watch AcadDocument.ObjectAdded/ObjectErase/ObjectUpdated event to do the similar thing.

 

You may want to make sure you code that extracts attribute and code that save data to external data store is well separated so you have flexibility later to save data to different external data store without break your code that extract attribute data.

 

Message 3 of 6
Ryan_McKellar
in reply to: norman.yuan

Wow so much more to Autocad then I ever imagined haha. Thank you very much
for the reply the information was very informative, but i believe it is
past my current skill level. Can you recommend any online information that
would help me produce this code, or just enhance my current abilities in
programming. I don't know if there are any programming type books that
would apply to this situation?
Message 5 of 6

Look at this

https://www.youtube.com/watch?v=oGyCLcY7-HE

It's a video's which explains my work. Basically you can import properties of line polylines and text to excel and whenever you modify something in drawings automatically excel spreadsheet will be update.  You can list properties of different drawings togheter also. 

Let me know if this macro matches you request.

 

Vittorio

Message 6 of 6
senpnathan
in reply to: gizmowiebe

Thanks for your guidance gizmowiebe, but unfortunately both those links doesn't work :(.


http://www.visiblevisual.com/jupgrade/index.php/autocad-vb-vba/66-export-blocks-to-excel

http://www.visiblevisual.com/jupgrade/index.php/general-net/135-get-block-attributes-net 



I want to use excel VBA to extract the data .dwg file, all the components in diagram to be exported to excel.

I would like to have a VBA code to do that.

Thanks
Senthil

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

Post to forums  

Autodesk Design & Make Report

”Boost