.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

I'm Lost on extracting data from a DWG file!

3 REPLIES 3
Reply
Message 1 of 4
texas1992
350 Views, 3 Replies

I'm Lost on extracting data from a DWG file!

OK, I have been asked to write utility that will open a DWG file, retrieve layer data from the file and put it into a spreadsheet.

 

I know nothing about AutoCAD but I have been reading on this forum and gathering information. I have found that I have to write a dll that will be used inside of AutoCAD. Here is what I have so far:

 

1. I have AutoCAD 2008 (will convert to 2011 or 2012 later)

2. I have .NET Framework 4.0

3. I have Visual Studio 2010 Express

4. Needs to be done using VB.NET.

 

I need to do this using .NET.

 

Do I need the 2008 API?

Could this be done easier using VBA?

Once I create the dll how do I use it inside AutoCAD?

How do I grab the layer data for studs and braces?

 

Any help would be greatly appreciated because I don't know where to start.

Thanks.

3 REPLIES 3
Message 2 of 4
Alfred.NESWADBA
in reply to: texas1992

Hi,

 

>> Do I need the 2008 API?

All is installed where AutoCAD is running, you don't have to install anything else for being able to write your code and do debuging.

It would be an advantage to download the ObjectARX-kit (find >>>here<<<, is free, but registration needed), there you find docu and samples (also for dotNET).

 

>> Could this be done easier using VBA?

Easier maybe, but not recommended, as of two points:

  • Autodesk told us for the last 3 versions not to support VBA anymore, however it's running now also for 2012, but we can't be sure how long that will be continued.
  • When running 64bit there will be a big performance-conflict. As VBA can't run inside AutoCAD-x64 (in-process) - as it did for the 32bit version all access to AutoCAD-entities runs a factor 100 to 1000 slower (compared to 32bit). So if you think you have to run large drawings or many drawings you will be lost in time.

 

>> Once I create the dll how do I use it inside AutoCAD?

Within the DLL you define AutoCAD-commands that can be started from the user/from the menu/from script/from ....

And to load your DLL into the AutoCAD-session you can do that with the command _NETLOAD (help look >>>here<<<) or you can set registry-values to have you App autoloaded every time AutoCAD starts.

 

>> How do I grab the layer data for studs and braces?

You get the layers through first finding the LayerTable within the current drawing (or any drawing you open) and the LayerTable gives you an enumerator to scan through all layers (LayerTableRecord)

 

>> [...] because I don't know where to start

There are a lot of videos, but I would first get the ObjectARX-kit and look into the samples within it.

 

Good luck, - alfred -

------------------------------------------------------------------------------------
Alfred NESWADBA
Ingenieur Studio HOLLAUS ... www.hollaus.at ... blog.hollaus.at ... CDay 2024
------------------------------------------------------------------------------------
(not an Autodesk consultant)
Message 3 of 4
texas1992
in reply to: Alfred.NESWADBA

Thanks for your reply.

 

I have never used AutoCAD so I don't know any of the commands that I need to use within my code.

 

Where are the videos that you talk about. I have looked at the code samples but they don't help if you are not familiar with AutoCAD. I am looking for a good example of how to get started on this.

 

Thanks.

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

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost