After our quick look at AutoCAD 2016 from a user perspective, let’s now spend some time looking at the things important to developers in this latest release.
Off the bat it’s worth stating that AutoCAD 2016 is a DWG compatible release: it’s using the same file format as AutoCAD 2013, 2014 and 2015. It’s also a binary application compatible release: ObjectARX apps written for AutoCAD 2015 should work in 2016 and it’s likely that .NET apps built for AutoCAD 2014 will work, too. That said, some changes have been made to the security model for this release of AutoCAD, so you may want to make sure these changes haven’t impacted your application…
You’ll see straight away when you try to load your application that there’s a bit more going on in the 2016 version of this dialog.
Firstly, the word “unsigned” indicates something very important: we’re encouraging developers to sign their executables – and even their LISP files – to improve security. An increasing number of AutoCAD customers – often the larger ones, as you might expect – are requiring application modules to be signed. This is certainly a topic that’s worth go into more deeply in a future post.
The other addition to the dialog is the “Always load this application” checkbox. This tells AutoCAD to continue loading this module from a non-trusted location, with the caveat that if the module changes the user will be prompted again.
A number of sysvars related to AutoCAD’s security features can now be locked by CAD managers:
TRUSTEDDOMAINS (see update below)
ACADLSPASDOC (see update below)
LEGACYCODESEARCH is important to note: AutoCAD’s default “find file” behaviour has been changed neither to search the current working folder nor the folder of the active drawing. This will make it much harder for people to write viruses that travel around with AutoCAD drawings.
On the subject of sysvars, I do think the System Variable Monitor – which we mentioned last time – will be a useful diagnostic tool for developers. If you know you’re using sysvars in your code – such as CMDECHO, CMDDIA, FILEDIA, etc. – try adding them to the monitor and see whether you get any notifications about your commands not setting them back properly. If you get any you can bet your users will, too.
Now let’s take a look at the new .NET API features (equivalent – and in a few cases more – functionality is also available via ObjectARX).
A number of point cloud-related features have been added to the product and are also available via the API.
You can create point cloud extension definitions (PointCloudDefEx objects) by attaching .RCS/.RCP files. These are analogous to block definitions. You can also create point cloud extension entities (PointCloudEx objects) that “insert” these into the drawing. A whole slew of properties and methods are exposed from both these classes.
A number of capabilities have been added relating to extraction of features from point clouds. Firstly, the Section class now has a “slice” type, and can be used to slice through a point cloud. Correspondingly it’s possible to use a PointCloudCrop object to crop a point cloud relative to a plane.
The extraction itself can also be driven programmatically. I’ve put together a sample that performs an extraction and adds the extracted geometry to the drawing: we’ll take a look at that in an upcoming post.
A number of capabilities related to the newly introduced RapidRT rendering system have been added to the API in this release. You can add and control image-based lighting, for instance, as well as managing the various settings related to RapidRT.
As this is a binary application compatible release, when we change an API significantly we make sure we do so via a new class until we can safely break API compatibility in a future release. So there’s a new Autodesk.AutoCAD.GraphicsSystem.Manager2 class which contains GetOffScreenDevice() and GetOffScreenView() methods making use of the RapidRT engine.
Here’s a quick round-up of some of the more interesting miscellaneous API enhancements in this release…
The Spline.ToPolyline() method has a couple of new Boolean parameters allowing you to specify that you wish to create arc segments as well as requesting the generation of lightweight polylines.
The Dimension.TextDefinedSize property allows you to control the width associated with long dimension text.
The MText class has a couple of new properties: ContentsRTF allows you to extract a version of the contents in Rich Text Format, while ShowBorders allows you to query or control whether an MText object’s borders are visible.
We mentioned the ability for CAD managers to lock certain system variables. There’s a corresponding Variable.IsLocked property allowing you to test this programmatically.
And finally my personal favourite miscellaneous enhancement in this release… you can now request code to be executed within a command context from the application context using DocumentCollection.ExecuteInCommandContextAsync(). Now this may not sound like much, but this one method allows you to do some really interesting things, such as calling commands from AutoCAD event handlers or even OS-level events. This is definitely a method of which we’re going to make a great deal of use, both in a few near-term posts and in the longer term.
It turns out that while the documentation for ACADLSPASDOC and TRUSTEDDOMAINS state they “may be locked by CAD managers”, the CAD Manager Control Utility currently does not, in fact, allow you to lock these two sysvars. Thanks to Dieter and Karen for tracking this one down: we’ll make sure the docs get fixed during the next update.