Community
AutoCAD Forum
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

AutoCAD - Export to Excel by external program like python

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
Anonymous
3212 Views, 4 Replies

AutoCAD - Export to Excel by external program like python

Team I am very new to autocad. For a project I am trying to extract information from the cad drawing .dwg file. For an example I have an electrical layout of a house. I need to count how many light points are present in the drawing. I need to access the drawing by some programming language like python. I have seen that by export to excel feature in autocad gives me a tabular list of the components, so can i run this export command by some external program using autocad. Or any other alternative is available?

 

[ The subject line of this post has been edited for clarity by @handjonathan Original: export to excel from autocad drawing by external program like python ]

4 REPLIES 4
Message 2 of 5
Alfred.NESWADBA
in reply to: Anonymous

Hi,

 

to export data you can use command _DATAEXTRACTION (>>>details<<<).

If needed you can start the command also using COM and accessing AutoCAD via COM/ActiveX (>>>details<<<). There are more complex options too, however, then you'll need to learn the internal AutoCAD structure.

 

- alfred -

------------------------------------------------------------------------------------
Alfred NESWADBA
ISH-Solutions GmbH / Ingenieur Studio HOLLAUS
www.ish-solutions.at ... blog.ish-solutions.at ... LinkedIn ... CDay 2024
------------------------------------------------------------------------------------

(not an Autodesk consultant)
Message 3 of 5
Anonymous
in reply to: Alfred.NESWADBA

Hi Alfred,

Thanks a lot for your reply.

If I understood it correctly, then the VB Script will be called inside the Autocad, like Macro in excel.

I am trying to do a small project. I have a electrical layout plan for a Villa. I need to read the drawing file and trying extract features such as 1) Number of different electrical equipment such as fan,light etc. per bed room,Dining Room, Kitchen etc. 2) Extract hierarchical info like, in the electrical line Main cut out is at the outside perimeter of the plot , and internal distribution box is inside villa electrical room.

I am thinking of "export to Spreadsheet" from drawing file, and then count object present in each room, and by looking into the x,y coordinate establish the hierarchical information.

To extract the info I am thinking of using a language to access autocad software from outside of autocad.

If you can kindly let me know if the extracted data in the excel is enough to solve above two use cases, and is it possible to  call different cad command programmatically from outside the autocad?

Message 4 of 5
Alfred.NESWADBA
in reply to: Anonymous

Hi,

 

>> If I understood it correctly, then the VB Script will be

>> called inside the Autocad

You can also connect to AutoCAD via ActiveX/COM and send a command from that external application (using SendCommand).

 

>> Number of different electrical equipment such as fan,light etc.

>> per bed room,Dining Room, Kitchen etc

That's more interesting as you need to identify which equipment is placed in which room.

Either the objects already have their info's (e.g. block with attributes and one attribute hold the info of the room it is placed into) or you have to do geometric calculation based on room area (what ever object your room is) and the location of your equipment. More easy with 2D, a bit complex if you have 3D geometry.

 

For the extraction of "which equipment belongs to which room" ... there does not exist any function inside of AutoCAD (Vanilla) that can do that for you. That needs to be developed in your app.

 

- alfred -

------------------------------------------------------------------------------------
Alfred NESWADBA
ISH-Solutions GmbH / Ingenieur Studio HOLLAUS
www.ish-solutions.at ... blog.ish-solutions.at ... LinkedIn ... CDay 2024
------------------------------------------------------------------------------------

(not an Autodesk consultant)
Message 5 of 5
pg47347
in reply to: Anonymous

Can you help me? I have exactly the same problem as you... I need to extract information from dwg file without open autocad. Plz, help me as soon as possible...

Cumps

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

Post to forums  

Forma Design Contest


AutoCAD Beta