AutoCAD .NET

  • As Scott has announced over on his blog, January's Plugin of the Month, DrawOrder By Layer, is now available on Autodesk Labs. I first posted the code for this very useful plugin back in October, and this version includes only a very minor change from that one (for performance reasons it now only works with modelspace layers). A huge thanks to Terry Dotson from DotSoft for generously donating this plugin. After the original post, a few people provided feedback on user interface enhancements they'd like to see in the tool – thanks for taking the time to do so, those…


  • A tool to help understand transformation matrices in AutoCAD

    As promised, today's post delivers a simple application that provides a user-interface for the command implemented in this previous post. I chose to implement the UI as a WPF user control which is then hosted by a standard AutoCAD palette. Aside from its core function – to allow composition of transformation matrices to be applied on an AutoCAD object – it demonstrates a couple of handy tips for working with Palettes: Separate the core functionality from our UI, using SendStringToExecute() to call it This will reduce the chance of issues related to Document vs. Session context, document-locking, etc. If you…


  • A simple command to perform a matrix transformation on an AutoCAD entity using .NET

    As promised in the last post and based on the overwhelming feedback in the one before that,  today we're starting a series on how to transform AutoCAD geometry. Before developing a fancy modeless GUI to make this really easy, we need a base command that can do the hard work. What's needed from our basic command is the following: Get a single entity from the pickfirst set (which will help us when calling the command from our modeless UI) If there isn't one selected, ask the user for it Get the property name to transform Only for writeable Point3d and…

  • I've arrived in Munich for our German DevDay + DevLab. There's lots of snow, but luckily I didn't get delayed: I was a touch paranoid after my trip to AU, and then having to fly two legs to get here. Therein lies a story: it's not usually needed to take two planes to get from Switzerland to Munich, of course, but I had a 30-minute flight from Geneva to Zurich before connecting to a 50-minute flight form Zurich to Munich. As far as I recall this was the most cost-effective option when I booked the flight. My home is actually…

  • As many of you may now be aware, much of the content recorded at this year's Autodesk University is now available on the AU website. You'll find the recording of my AU Virtual session, "Getting to Know the AutoCAD® Plug-ins of the Month", as well as material from the two physical sessions I presented, "Point Clouds on a Shoestring" and "Integrate F# into Your C# or VB.NET Application for an 8x Performance Boost". In fact, much to my surprise, the "Point Clouds on a Shoestring" session (which turned out to be my highest-rated session) ended up being recorded, and can…


  • December’s Plugin of the Month live on Autodesk Labs: QR Codes for AutoCAD

    As promised and reported on, and then announced by Scott on his blog, the QR Codes application for AutoCAD is now live on Autodesk Labs as December's Plugin of the Month. You may have seen my original implementation, but it's come a long way thanks to the efforts of Augusto Gonçalves, a member of DevTech based in São Paulo. While I had developed the original implementation to create and embed raster images using the Google Chart API, Augusto extended that implementation to create native hatches for QR Codes. And while my implementation focused on a command-line UI, Augusto implemented a…


  • Jigging an AutoCAD polyline with arc segments using .NET

    I was just easing back into post-AU work – dealing with my email backlog and thinking about possible blog posts for the week – when I received a very welcome email from Philippe Leefsma, a member of the DevTech team based in Prague. Philippe had a bit of time to spare during our annual DevDays tour and decided to polish up a sample he'd been working on for posting. It extends a post of mine from four years ago (I can't believe it's been that long, but anyway), which shows how to jig a polyline with keywords. Philippe adjusted the…


  • Adding a 2D spatial filter to perform a simple xclip on an external reference in AutoCAD using .NET

    I've now checked in for my flight to Las Vegas – and, thanks to Jeremy Tammik's recent troubles, I luckily renewed my ESTA – so I'm pretty much all set for my trip to AU 2010, at least from a travel perspective. I'm just keeping my fingers crossed that the gastric 'flu my kids seem to have come down with doesn't hit me before I leave (or once I'm at AU… what a grim thought). I was going to keep today's post light, just like the last one, but then decided to dip into my email folder of externally contributed…

  • I'm heads-down in final preparation mode for AU 2010 and so won't post anything very detailed for the rest of the week, but I did just want to share a series of programming gems that I stumbled across the other day. James Michael Hare has published a great series entitled "C#/.NET Little Wonders": C#/.NET Five Little Wonders (part 1) The Null Coalescing Operator (??) The As Cast Auto-Properties The Stopwatch Class TimeSpan factory methods C#/.NET Five More Little Wonders (part 2) string.IsNullOrEmpty() and string.IsNullOrWhiteSpace() string.Equals() using Statements static Class Modifier Object and Collection Initializers C#/.NET Five Final Little Wonders (part…

  • Or perhaps the title should really be "why it's really a good idea to avoid misusing mutable state when using F# Asynchronous Workflows". Ultimately I wanted to share a brief (or not, we'll see), cautionary tale about the dangers of shared state when implementing concurrent tasks. I've been using F# for some time, and have it fairly well drilled into my skull by this point that shared, mutable state is bad. And yet occasionally it somehow creeps in as an expedient way to solve certain issues: perhaps it's just a lack of discipline on my part or the years of…