Wednesday, September 13, 2006

.NET vs. COM in AutoCAD - What should I use?

Kean Walmsley writes about the pros and cons of .NET vs. COM in AutoCAD on the "Through the Interface" blog.

In general, a good article - but I don't think it addresses two of the biggest "gotchas" of AutoCAD.NET...

The Blessing/Curse of Versions
One of the goals of .NET was to avoid some of the issues of "DLL Hell", where different programs linked with different versions of DLLs without worrying about whether the differences were significant.

Now when I make an AutoCAD.NET application, it gets linked against the file "acmgd.dll" version (in vanilla AutoCAD 2007). If is not available later, you're out of luck...

Problem #1: Versions within AutoCAD and vertical Releases
In the AutoCAD 2005 release, we ran into a problem where vanilla AutoCAD was version, but the version of Autodesk Map3D 2005 and in various service packs was version

Now - Autodesk has been far better about being nice about not changing the version randomly in 2006 and 2007... But there may come a time when it's necessary in mid-release, and that makes a lot of stuff break!

Problem #2: Versions between AutoCAD Releases
This one there's really no getting around... Each release of AutoCAD will have a different version of acmgd.dll... And as a result, your application will need to be recompiled for each version.

This is a disadvantage compared to both ARX and COM... In ARX, Autodesk has been fairly succesful at making ARX applications binary compatible within 3 release blocks (2004, 2005, 2006, for example)... With COM, I suspect because the COM layer "insulates" the application from changes even further, there are people who can still run the VB application they wrote for AutoCAD 2000 in AutoCAD 2007 (OK, so there might be some changes - but it's the exception rather than the rule)...

Don't get me wrong - I'm still a HUGE fan of .NET for application development... But the benefits that it brings are not without their costs compared to ARX and COM. I've also noticed that there may be some relief from this in Visual Studio 2005 (although I don't quite have my head wrapped around the "Specific Version=FALSE" option).

Editor's Update: Kean has put in a comment that clarifies this issue:
The short, tongue-in-cheek version: In 2005, 2006 and 2007 it was intentionally broken, but going forward it will be the same as ARX ... So 2007,2008, and 2009 would presumably be binary compatible. Thanks Kean!


Todd M. Shackelford said...


Always interesting reading. Thanks for the insight and keep up the great work.

Stravadi said...

Hi.i googled for help and found your blog.I have both autocad 2000 and 2007 on my system.i worked on acad2007 and saved my file as an acad2000 form.when i opened it with acad2000 ,although it works fine i couldnt copy and paste the drawing (a line for example).The problem is that i must copy these drawings in some other ones and i cant do copies them but when i try to paste them a "_pasteclip" appears in the command line and nothing happens?is there a compatibility problem?i reaaly need help on this becouse i must have this work ready soon.