AutoCAD .NET
-
It's quite common for AutoCAD developers to use Extended Entity Data (XData) to tag objects their application cares about. This is certainly the approach taken in the recent series showing how to overrule the graphics display for an object – we store a "pipe radius" in XData attached to the Line or Circle we want to have a 3D profile. That's fine, but what if we're storing a unique identifier with an object in XData that we do not want copied with the object? The Overrule API in AutoCAD 2010 allows you to hook into the DeepClone of an object…
-
A huge thank you to Zeljko Gjuranic for providing this code for a guest post. The code is based on a paper of Zeljko's that was published in issue 11 of KoG magazine. The original paper is available in Croatian with an abstract in English. The code in this post asks the user to select a set of points and then creates a polyface mesh by using Delaunay triangulation on those points. [As we're creating a polyface mesh we're limited to 32,767 vertices. This is a known limitation when using the PolyFaceMesh object: with the new SubDMesh object in AutoCAD…
-
To continue my investigations into IronPython and the fun I'm having with overrules, I decided to to port my most recent C# overrule implementation across to IronPython. I've also been trying to do the same for IronRuby, but – so far – without luck. Please refer back to one of the previous IronPython posts for the PYLOAD command implementation needed to load our Python script into AutoCAD. Here are the contents of our .py file: import clr path = 'C:\\Program Files\\Autodesk\\AutoCAD 2010\\' clr.AddReferenceToFileAndPath(path + 'acdbmgd.dll') clr.AddReferenceToFileAndPath(path + 'acmgd.dll') import Autodesk import Autodesk.AutoCAD.Runtime as ar import Autodesk.AutoCAD.ApplicationServices as aas import…
-
As mentioned in a comment on a recent post, Stephen Preston, our DevTech Americas Manager, has put together a useful tool and accompanying DevTV session to help people migrate their VBA code to VB.NET. The resultant code uses COM Interop to call into AutoCAD. AutoCAD VBA to .NET Migration Basics view download (44.3 Mb) Stephen considers this presentation, and the migration tool itself, to be in draft form. If you have feedback, please do send Stephen an email.
-
Sorry if the title is a little abrupt, but it seemed too good an opportunity to show off my now appalling poetry skills. [Something almost no-one knows (well, OK, knew) about me is that, at the age of 8, I was the youngest winner of a poetry competition. I went along to the King's Lynn Arts Centre (known back then as The Fermoy Centre) to recite my poem, "Words Inside my Pencil", to a packed – at least it seemed so, at the time – audience of the various winners' parents. Anyway, as you can see it was all downhill…
-
I am really starting to love the new Overrule API in AutoCAD 2010, and I still feel as though I'm just scratching the surface. This question came in overnight from Danny Polkinhorn (thanks, Danny! 🙂 : It's exciting to see a very usable implementation of 'custom' objects in .NET. Obviously, this implementation protects what could be proprietary business intelligence from being sent around, but it brings up a question. What process would you use to 'explode' these elements so that you could send the drawing to someone without your code, but with the custom elements in it? My first thought…
-
In the last post we looked at some code that attaches additional data to individual entities, allowing them to be drawn independently with different visual properties via the new Overrule API in AutoCAD 2010. A couple of comments – one from Qun, who provided the original F# sample, and one from Tony Tanzillo – have prompted me to optimize the code somewhat. Tony pointed out, very validly, that as the previous code registers its overrule against Drawable objects it will get called for every entity (and various objects besides) which could clearly impact performance. Qun pointed me to some interesting…
-
In the last post we looked at some C# code to customize the display of all Lines and Circles within AutoCAD, adding a thickness (or a diameter) to make them look more like pipes. This was, in turn, based on this F# post. The previous code implemented an overrule that allowed us to insert our own graphics for every instance of the types of object we cared about. [A quick note on the previous implementation: we actually register the overrule to be called for all "drawable" objects: the inheritance tree for the Circle class is: Drawable –> DBObject –> Entity…
-
The code in this post is a direct port of the F# code in this previous post, which was entered by Qun Lu in the recent F# programming contest. Someone – very validly - commented on the fact the post involved both a new language and a new API, which was probably pushing things a little from a learning perspective. 🙂 Without repeating my various comments in the previous post, I will reiterate the fact that this API is extremely interesting for developers who wish to customize the appearance and behaviour of standard AutoCAD objects without going through the pain of implementing full…
-
In the last post I introduced a very simple "Hello World!" IronRuby application working with AutoCAD, just as I'd previously done with IronPython. My idea for this post was to take the code from my second IronPython post – which showed how to jig an AutoCAD solid from IronPython – and get it working with IronRuby, forcing me to learn a little more Ruby in the process. All started out well: to convert the basic syntax from Python to Ruby was straightforward, and I have a definite liking for the syntax of the Ruby language. Especially when working with object…