Using App.Config with AutoCad

In Winforms projects, it is quite common to use app.config. For instance, to store settings  and application parameters etc. When programming AutoCad extensions, you’ll run into problems: trying to address the default app.config file leads you to the app.config of the running process, being AutoCad. AutoCad has provided a solution for this (although it would be possible to do this yourself): they created an acad.exe.config.

Placing your application settings in acad.exe.config lets frameworks like Unity, Enterprise library and your own application to run correctly after all. This solution is not perfect, and still causes lots of problems with Unity, but there must be workarounds. This, again, might be interesting for a more extensive blog post on the subject. Just let me know if this is desired…

Posted by Bert Vanpeteghem 2 reacties

Geometry and Algebra libraries

Have you ever spent too much time figuring out a difficult algorithm with AutoCAD API’s Vectors and Matrices? I feel I have. In fact, I know I have. Last year, I needed several algorithms, such as Point In Polygon, Bounding Boxes and Convex Hull. I looked up the algorithms on Wikipedia or some other computational library, and I found mostly C or C++ code doing the job.

I know these languages, but I don’t use them all the time. It also seemed like a waste of time trying to write them in C# or VB. And it looked ugly as hell. Searching a little bit further, I found that these libraries actually already exist. More importantly, they are also very extensive and Open Source! These libraries are mostly GIS-oriented, but can definitely be used in CAD calculations too. A polygon is a polygon, no?

The most important one I found is Topology Framework, this is actually a collection of libraries with slight modifications and renamings. There are several frameworks referenced by this one. And they can all be found under the Credits section.

Today, I read the following blogpost. It mentions a numerical library providing mathematical functions for .NET. I haven’t looked into it in detail, but if you’re no longer happy with the Math namespace in .NET, this might be worth checking out: dnAnalytics

I might do a post on how to use these frameworks together with the AutoCad API, so if you’re interested, let me know…

Posted by Bert Vanpeteghem 0 reacties