Runtime

  • This post was queued up for Friday, but a technical issue (i.e. probably user error) prevented it from going out. So here we are on Sunday, instead, for another installment of Wayne Brill's AutoCAD .NET training DevTV series (to complement those from previous weeks). Today's session is focused on working with dictionaries and other types of container, as well as using runtime type identification and casting. This series of DevTV sessions is a companion for the new AutoCAD .NET training material available from the AutoCAD .NET Developer Center. Enjoy! ๐Ÿ™‚

  • They've been at it again. Stephen and Fenton have recorded another informative DevCast, this time on the new simplified application loading mechanism in AutoCAD 2012, the Autoloader. I'll be following up with my own experience of using Autoloader, in due course, but this should be a great "getting started" resource.

  • As promised, last week, today we're going to look at a technique pointed out to me by Viru Aithal for calling unexposed ObjectARX member functions via P/Invoke. It sometimes happens that ObjectARX (unmanaged C++) methods fail to get exposed immediately via .NET, which is currently the case for MLeader.Scale (both getting and setting this property). The technique shown in this post allows you to work around this, prior to the managed API in AutoCAD being updated to include it. It's worth noting that if you need a more complex exposure via .NET โ€“ as Dan Smith sometimes reminds me (thanks,…

  • From time to time I listen to the .NET Rocks show โ€“ I don't get the chance to listen every week, but I do browse through the RSS items I get for the show episodes and find some time to put those I find of particular interest on in the background while I'm working on something else. Yesterday's episode caught my eye, as it focused on the nKinect project, exposing the Kinect's capabilities to .NET. And 'm really (and I mean really) excited about the Xbox Kinect. I mentioned it in passing in a post from last March (it was…

  • Here's an idea I've been playing around with for some time: say you want to capture geometry as code for pasting back into your application, how do you do it? For instance, sometimes you might want to model geometry using AutoCAD and then capture it as code for later generation at runtime. I have a specific example in mind, of course: I have some boundary loops that can be used to generate the outer shell of a space shuttle using the surfacing capabilities introduced in AutoCAD 2010. I'd really like to use code to store these loops and โ€“ in…

  • In the last post we created a basic installer to deploy our product files and source into a user-specified location. In this post we'll look at the Registry-related activities that need to happen from our installer. One of the files we added to the install project was the RegDL executable. We're going to add some custom actions which use this executable to create/remove our demand-loading Registry entries on install/uninstall. The advantage of this approach is that we don't need to duplicate information in an installation script that's already stored in our .NET assemblies: RegDL queries an assembly programmatically for its…

  • It's been a long time since I've dabbled with software deployment technology, which is absolutely fine by me (in my experience installation issues are some of the gnarliest to deal with, so โ€“ presumably like the majority of developers, with apologies to Install specialists โ€“ I prefer not having to care about them, myself). But last week I had to put together a few installers - as an internal test - for some of our Plugins of the Month, and ended up deciding the process was worth documenting, especially where it relates to the RegDL component I created and published…

  • I received this question by email from Chris Witt: I know you can load specific linetypes with vb.net, but is there a way to load *all* line types from a specified lin file with vb.net without having to name each one? This is an easy one, as the Database.LoadLineTypeFile() method supports wildcard characters in the linetype name. Here's some C# code that does this: using Autodesk.AutoCAD.ApplicationServices; using Autodesk.AutoCAD.DatabaseServices; using Autodesk.AutoCAD.EditorInput; using Autodesk.AutoCAD.Runtime;   namespace LoadLinetypes {   public class Commands   {     [CommandMethod("LL")]     public void LoadLinetypes()     {       Document doc =         Application.DocumentManager.MdiActiveDocument;       Database db =…

  • This week I'm going to posting a few topics related to F#, as it feels as though I've been neglecting it, of late. And as this technology is going to hit the mainstream very soon โ€“ when Visual Studio 2010 ships โ€“ it seems all the more important to keep one's F# skills honed. We're going to start the week with an F# equivalent to the code shown in this previous post, where we go through and reflect on the commands exposed by an assembly in order to create corresponding demand-loading Registry keys automatically. We've shipped VB.NET and C# versions…

  • I received a really intriguing question by email from Dave Wolfe on Friday afternoon: Due to your post on the topic, I wanted to improve my installation method for .Net modules.  While examining the topic, I ran into a few concerns that shaped my development process. The game changer is that I couldn't find a way to use reflection to check a .net module for the CommandMethodAttributes without being in an AutoCAD session.  The CommandMethodAttribute crashes on initialization outside of AutoCAD. Dave went on to describe a couple of ways he'd found to work around this problem by driving AutoCAD,…