Running a vb.NET dll from a network in AutoCAD doesn’t work very well on it’s own. It appears, at least from my small sample size, to work as long as the code doesn’t use Windows Presentation Foundation. If the code utilizes a routine that AutoCAD runs with WPF, AutoCAD crashes indicating that the routine isn’t supported. Unfortunately prompting the user for information such as a number or object causes this crash.
A way around this is to use the LispFunction available in .NET. The LispFunction passes a ResultBuffer between the .NET routine and a LISP command. By utilizing a LISP routine I was able to avoid the WPF issue. The LISP routine gets any objects or numbers required from the user and then passes them to the .NET routine. The first code I created worked fine on Civil 3D 2008, but crashes Civil 3D 2009 & Civil 3D 2010. I suppose the AutoCAD API was revised to use WPF after AutoCAD 2008. I then had to resort to using the LispFunction.
For more information on how to use the LispFunction check out these AU Papers:
CP211-3 VB.NET Command School
DE211-2 The Best of Both Worlds: .NET and LISP Can Coexist
Both papers may be found at AutodeskUniversity.com or AUGI.com.
2 comments:
With .NET Framework 3.5 SP 1 you can have the DLL on a network. A good news with .NET Framework 3.5 SP1
I think its an issue with AutoCAD and not framework 3.5 SP1. It runs fine until a user prompt is required. I think the issue is the same as this one: http://blog.jtbworld.com/2009/03/fatal-error-unsupported-version-of.html
Post a Comment