AutoCAD .NET

  • Back at the beginning of the year I launched a programming contest for using F# with Autodesk products. A few months ago I introduced one of the winning entries showing how to use F# to implement Overrules in AutoCAD 2010. Now I've finally got around to unveiling the second winning entry. And the winner is… drumroll… Nada Amin, who entered her Master of Engineering project which uses F# with AutoCAD. Here is a description of the project from the MIT website: Micado: an AutoCAD plug-in for programmable microfluidic chips Programmable microfluidics, using multi-layer soft lithography, are lab-on-chip systems that can…

  • Fenton Webb, from DevTech Americas, is presenting two sessions on using WPF in your AutoCAD .NET applications. These will be of particular interest to developers wanting to take their ribbon interfaces to the next level in AutoCAD 2010, but will be of relevance to anyone wanting to understand more about WPF and how it can be used within AutoCAD. The first session is coming up quickly, on June 2nd (next Tuesday), but if you're reading this soon after I've posted you should still have time to register. The second session is scheduled for July 14th. Both sessions will be recorded…

  • Here's a question I received recently by email: How do you set up a .NET plugin for AutoCAD to install & demand load in the same way as ObjectARX plugins? The documentation is not very clear at making the distinctions visible. In ARX terms, we currently write a set of registry entries as part of our installer, along with refreshing these via an AcadAppInfo registration during ARX load. The ARX itself can be located anywhere as long as the registry entries point to it. I'm not sure of the correct procedure for .NET plugins to duplicate this. Augusto Gonçalves, from…

  • Thanks to all of your interest in this recent post, which looked at a way to interface an out-of-process .NET application with an assembly running in-process to AutoCAD. After some obvious functionality gaps were raised, Renze de Waal, one of our ADN members, pointed out a DevNote on the ADN website covering – and more completely addressing – this topic. Shame on me for not checking there before writing the post. Anyway, onwards and upwards… The information in the DevNote highlights some of the problems I and other people had hit with my previous code, mostly related to the fact…

  • This question came in recently by email from Michael Fichter of Superstructures Engineers and Architects: Could you suggest an approach that would enable me to drive a .NET function (via COM) that could return a value from .NET back to COM? I have used SendCommand in certain instances where return values were not needed. Michael's referring to a technique used in this previous post, which shows how to launch AutoCAD from a .NET executable via COM and then launch a command which can then safely interface with AutoCAD in-process via its managed API. And yes, this technique is fine if…

  • This post extends the last one which looked at a basic implementation to allow AutoCAD's standard OFFSET command to work on the contents of external references. I haven't flagged the specific changes, but the old code (which is almost identical to that in the last post) starts with the Initialize() function. The previous example created geometry on a temporary layer that exists only as long as the source xref is attached: detaching the xref generally caused dangling layer references. This post evolves the approach and provides a choice to the user (via the XOFFSETLAYER command): to either create the geometry…

  • This was a fun little project: to enable AutoCAD's OFFSET command to work on the contents of external references (xrefs), something I'm told is a long-standing end-user wishlist request. AutoCAD's .NET API provides some very interesting events that make this possible without the need for us to implement our own OFFSET command. We can simply respond to the selection event and replace the selected object (the xref itself) with either an item contained in the xref or a clone of it that has been placed in the current space. I ended up using the latter approach: the former worked fine…

  • I might also have called this post "Overruling AutoCAD 2010's entity display and explode using Boo", as it complements the equivalent posts for C#, F#,  IronPython and IronRuby, but I felt it appropriate to combine the post with an introduction to what Boo is all about. What is Boo and how did I come to look into it? Knowing of my recent interest in the various scripting technologies being made available for .NET, a colleague at Autodesk recently pointed me at the Boo programming language (and here is the official page for the language, including its various downloads). First, to…

  • As mentioned in this previous post, where I gave the same treatment to IronPython, I've been trying to get display and explode overrules defined in IronRuby working properly in AutoCAD. IronRuby is still at version 0.3, so this effort has been hindered by a number of CLR interop bugs (it turns out). I finally managed to work around these issues thanks to Ivan Porto Carrero, who is just finishing up his book, Iron Ruby in Action, and has been working with IronRuby since pre-Alpha 1 (brave fellow). Ivan's help was invaluable: he ended up downloading and installing AutoCAD 2010 to…

  • I've been meaning to get to this one for a while. This post takes the OPM .NET implementation and shows how to use it to allow modification of data persisted with an object: in this case we're going to use the XData in which we store the "pipe radius" for the AutoCAD 2010 overrule sample we've recently been developing. To start with, I needed to migrate the OPM .NET module to work with AutoCAD 2010, which meant installing Visual Studio 2008 SP1. Other than that the code migrated very easily, and the project (with the built asdkOPMNetExt.dll assembly) can be…