AutoCAD

  • After a minor technical glitch, I've now been able to submit two class proposals for Autodesk University 2014. Both are currently planned as 90-minute lectures. The first is about AutoCAD's JavaScript API: Connect AutoCAD to the web with HTML5 and JavaScript AutoCAD 2015's JavaScript API enables a whole new generation of web-enabled applications. This session focuses on how you can use this API to connect web-based applications with AutoCAD. We'll look at how HTML5 can be used to implement user interface components inside AutoCAD – modal & modeless dialogs, palettes and new document windows – including calling into core AutoCAD…

  • A few people expressed an interest in understanding how AutoCAD 2015's ability to open HTML pages inside its frame – shown in this recent post – could be extended to work with "native" user interfaces. This post shows how that can be done using WPF – the other supported mechanism for adding new documents to AutoCAD's main frame introduced in the 2015 release. Just as with last week's post, there really isn't that much to it: you just need to add your own WPF UserControl to the project and load that into an Autodesk.AutoCAD.Windows.WPFDocumentWindow object and pass it to other…

  • I have to say that I'm having an absolute blast getting to know the new API features in AutoCAD 2015. It turns out I'd barely scratched the surface with my original post about the impact for developers. It's a release that just keeps on giving. 🙂 One new feature that I've had a lot of fun playing with is the "cursor badge" capability, something you may have seen blogged about from a user's perspective. The good news is that the ability to add your own cursor badges is provided in the public API (although I did end up using an internal…

  • Many thanks to Holger Rasch who worked out how to fix the code in this previous post. It really doesn't matter that 3 years have passed, Holger – I have no doubt people will greatly appreciate the fact the code can now run without causing the annoying display issues it produced previously. Holger made a few adjustments to the implementation to make sure the persistent hatch loop gets added and removed in the right places. Here's the updated C# code: using Autodesk.AutoCAD.ApplicationServices; using Autodesk.AutoCAD.DatabaseServices; using Autodesk.AutoCAD.EditorInput; using Autodesk.AutoCAD.Geometry; using Autodesk.AutoCAD.Runtime; using Autodesk.AutoCAD.Colors; using System;   namespace HatchJig {   class…

  • This was a fun one. It was really only a single line of code but I decided to embellish it a bit to make it a bit more useful. The "task" I set myself was to open a web-page – this blog, in fact – inside AutoCAD as an MDI child. AutoCAD can now host web-pages directly inside its MDI frame – the New Tab Page is a great example of that – and this mechanism can be used for external applications, too. You can also load non-HTML documents into the frame, but it's quick and easy to use HTML.…

  • In yesterday's post, we looked at a mechanism that has been introduced in AutoCAD 2015 to simplify associating custom data with a Document. In today's post we're going to swap out the custom manager class to make use of the standard UserData mechanism, showing how the PerDocumentClass attribute and the UserData property are actually highly complementary. Here's the updated C# code: using Autodesk.AutoCAD.ApplicationServices; using Autodesk.AutoCAD.Runtime; using System; using System.Collections.Generic;   // The all-important attribute telling AutoCAD to instantiate // the PerDocData class for each open or new document   [assembly: PerDocumentClass(typeof(PerDocSample.PerDocData))]   namespace PerDocSample {   public class Commands  …

  • I almost named this post to make it clear it's about a new API capability in AutoCAD 2015, but then I wouldn't have had the slightly perverse satisfaction of resurrecting a series of posts after 7.5 years. Here are the first parts in this series, in case you've forgotten them (and you'd be forgiven for doing so, after all ;-). This post is introducing the new PerDocumentClassAttribute capability provided in AutoCAD 2015's .NET API. We're going to look at it over two posts: the first showing how it can be used with your own "manager" class to link the data…

  • I had an email from Martin Duke about this old post a couple of weeks ago. I started to update the original post but then realised that a) I couldn't easily go that far back using Windows Live Writer and the built-in Typepad editor often messes up code in old posts when I edit them and b) there was some value in revisiting this topic again now that nearly 6 years has passed. I'll hopefully manage to link to this updated post from the old one without things going awry. Martin was having some trouble with text display in object…

  • The "call for proposals" for AU2014 is going out on April 23rd and will remain open for about a month. This is approaching quickly, so get your thinking hats on if you're considering submitting a class proposal. From my side I'm thinking about a few possible topics: Implementing a tangible user interface for AutoCAD using SensorTag Integrating a web-based user interface into AutoCAD via its JavaScript API I'm also toying around with the idea of doing a kind of "meta" session, during which we'd look at some of my favourite blog posts/areas of research over the years. Something like "8…

  • We first introduced a JavaScript API into AutoCAD as a "preview" in the 2014 release. Take a look at this post for more details on this implementation. In the 2015 release the API has matured in a number of key ways, making it really ready for primetime usage. Firstly it's been made much more robust: rather than having a single instance of the browser executable hosting the various bits of JavaScript code running inside AutoCAD, we now use separate instances of the browser – which in turn hosts the Chromium Embedded Framework (CEF) – for each application. Which means that…