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.
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:
>> 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 -
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.
http://download.autodesk.com/media/adn/DevTV_Introduction_to_AutoCAD._NET_Programming/
http://through-the-interface.typepad.com/
http://usa.autodesk.com/adsk/servlet/index?siteID=123112&id=1911627
http://www.vbcad.com/vbcadbooks.htm
Can't find what you're looking for? Ask the community or share your knowledge.