Monday, July 30, 2007

AutoCAD.Net Programming - VB.Net or C# ?

As far as I have seen, the prerequisite for Dot Net programming is not the proficiency in any of the supporting languages, but a very good understanding of Dot Net Framework and Framework Class Libraries (FCL). There are several supporting languages (still counting) which enables you choose your favourite one. Of all those, the most popular ones are VB.Net and C#. Learning both of them seems to be a tough task (for me, even learning one of them seems to be a herculean task..!!). So I started searching on net for finding advantage of one over the other. I kept on reading till I saw these two links laying side by side in the same website.

Top 10 reasons VB.NET is better than C#
Top 10 reasons C# is better than VB.NET

Apparently, they all are same in case of productivity. Choosing a language depends mainly on how much the user is comfortable with it. Personally thinking, I had exposure to VBA and JavaScript in the past. In case of VB.Net, it is known as an entirely different language from VB. C# is a new language developed exclusively for Dot Net Framework. So the options are clear. Both are new languages and doesn't carry any benefits from learning its ancestors. Finally I decided to go for C# over VB.Net as it was becoming more popular among the Dot Net Developers. Moreover, some popular AutoCAD programmer blogs like Through the Interface (It's really a nice place) inspired me to choose C# over VB.Net. I found some very good DevHood training modules for beginners to start with C# and DotNet.

I found this training modules simple and elegant and good enough to give a start on C#. There are some advanced topics under the Training Modules link. I am planning to look at it when I get enough time to do so.

That's all about Microsoft.Net and C#. Now for doing AutoCAD.Net programming, we need to know something more than that. The easiest thing is to download AutoCAD 2007.Net file from AutoCAD Developer Center. Go through the AutoCAD 2007 Managed C#.NET Training.3.doc and try it. If you come across any problems, visit forums like Autodesk AutoCAD.Net discussion group. There are many people out there to guide you through proper direction.

That's all I have done so far apart from doing a few basic programs. By the way, If you would like to download Microsoft Visual C# Express Edition (It's free) just follow the link.


Anonymous said...

I was looking for information on using C# with AutoCAD. Thanks for your links. I do have one comment. I think there are several advantages for having a background in using C++ with AutoCAD customization, then moving to C#. C# is not entirely new. It is another ++ for C++, which makes the sharp sign after the C. First, a C++ programmer will be familiar with what kinds of things you can do with the AutoCAD API. That takes awhile to learn. Second, a C++er will have good experience with object-oriented programming. Third, C# grew out of C++. Most of it looks very familiar to C++ programmers. The parts that are different are improvements. So it is actually easier than C++ because it removes some of the hassles of C++. The main problem with C++ is having difficult to find memory leaks from not keeping exact control of the life and death of the objects you create to live on the memory heap. C# is supposed to have an answer for this with Garbage Collection. Unfortunately AutoCAD's .NET is not a fundamental rewrite of AutoCAD, but just wrappers around the existing C++ API. That means that I cannot delegate the cleanup to the Garbage Collector on .NET, but must still do it myself. Hopefully they will rewrite the API completely someday. In the meantime I still have much improved database connectivity to work with from C#.

Sreekanth S said...


Is there any way to execute fillet command without any user intervention. I mean, I have to fillet two line that i drwn programmatically. Any ide ?

Anonymous said...

Great job masta, we are waiting for more. Thanx.

Speto said...


First, thanks for post this article, very useful.

Now my doubt is, The autocad API is the same in any version of AutoCad?

If I wrote a AddIn in a later version, I need to rewrite in the new version?

Tks again.

Speto said...


If I wrote a AddIn in a prior version, I need to rewrite in the new version?

har!s said...

Hi Speto,
Since managed classes used inside AutoCAD dotnet are basically wrapper classes on top of the ObjectARX C++ classes, I beleive that you will have to rebuild the application with each release of AutoCAD.

Speto said...

Ok, Tks!