AutoCAD .NET

  • I just received this excellent question from a developer in Italy: We've been developing a quite complex AutoCAD application based on ObjectARX (gear) and VB (GUI) and we're wondering if, after a migration in C#(?) we could maintain  same results in term of entities control, performances and so on. In few words, is it time to leave the thorny and painful ARX world to embrace the .NET heaven πŸ™‚ ? Before answering this question, I'm going to take a step back for a second… Over the years I've been asked many times what "the best" API is to use for…

  • I've been threatening to implement this for a few posts, now, so I decided it was finally time for me to put my money where my mouth is. πŸ™‚ This post extends the series I've been writing on turtle graphics (here's the most recent part, from which you'll find links to its predecessors). This series has been about developing a turtle graphics engine using C#, eventually extending it for 3D. The series so far has focused very much on the engine, but from very early on it was my intention to use this engine to implement a subset of the…

  • What, yet another part? The series that just goes on and on... πŸ™‚ To catch up, here are parts 1, 2, 3, 4 and 5, and the original post. This post looks at more organic forms, once again, but this time in 3D. I had lots of fun with this one: I took the principle shown in Part 2, where we looked at adding random factors to fractal patterns when creating 2D trees and extended it to work with the 3D version of the TurtleEngine. The principle is the same, we're just creating three branches at relatively evenly spaced angles…

  • The first update to AutoCAD 2009 is now available. Here is the Readme for this update, which includes a note that these developer-oriented fixes are included (as well as many more general issues): .NET API When a .NET function with a LispFunction attribute has the return type as object, an exception is thrown in AutoCAD. Visual LISP The AutoLISP Redraw function fails to hide or highlight objects.

  • Once again I've ended up extending this series in a way I didn't originally expect to (and yes, that's a good thing :-). Here are parts 1, 2, 3 and 4, as well as the post that started it all. After thinking about my initial 3D implementation in Part 4, I realised that implementing pen colours and widths would actually be relatively easy. Here's the idea: Each section of a different width and/or pen colour is actually a separate extruded solid Whenever we start a new section we start off by creating a circular profile of the current pen width…

  • I just couldn't resist coming back to this fun (at least for me πŸ™‚ series... for reference here are parts 1, 2 and 3, while the series really started here. There are two main places I wanted to take this implementation: firstly it really needed to be made 3D, which is the focus of this post, and I still then want to take it further by implementing a turtle graphics-oriented language (one could probably call it a Domain Specific Language, the domain being turtle graphics), which is likely to be a subset or variant of Logo. This is likely to…

  • This question came in by email last week: The last two days I am struggling with adding a new LayerGroup to HostApplicationServices.WorkingDatabase.LayerFilters.Root. I simply cannot get it working. Is it possible to write a blog item with example on this? An interesting question and it can indeed be quite tricky to understand how this works. For those of you who are ADN members, here's a DevNote covering the basics, which I've taken and extended for this post. When working with LayerFilters, it's important to know that the Database property providing access to the list of current LayerFilters does so by…

  • This post demonstrates a simple check for whether a drawing is two or three dimensional. The code is almost embarrassingly simple, but then the question is significant and in the absence of a "Is3D" property on the Database object this is likely to prove useful for people. So how do we check whether a drawing is 3D? The quick answer is that in most circumstances the EXTMAX system variable will have a non-zero Z value for a 3D drawing. There are potential situations where this might not be true (and EXTMAX doesn't reflect the 3D nature of certain geometry), but…

  • Everything aches after a very enjoyable soccer tournament in Prague (to which I mentioned I was heading off in my last post). But it was well worth the pain; it was really a lot of fun playing with and against (and just catching up with) so many friends and colleagues. I received this question a week or so ago by email: Is there any way to change the handle of an object through the API? Ideally I would like to select two objects and swap the handle. The code in this post does just that: it asks the user to…

  • This post was inspired by a comment on this previous post, where we looked at some code to select entities on a specific layer. The question was regarding how best to select entities from multiple layers: the selection filtering mechanism inside AutoCAD makes this very easy, and can cope with composition of conditions related to various entity properties. The basic concept is to enclose sets of entity properties for which you wish to filter with tags indicating the composition of the conditions: for "or" you enclose the conditions with "<or" and "or>" and for "and" you use "<and" and "and>".…