AUGIWorld

Page 17

to link Visual Studio 2010 to the old Visual C++ 9 compiler. This compiler shipped with Visual Studio 2008 and is required for building ObjectARX add-ins -as long as you’ve also installed Visual Studio 2008 (Service Pack 1). This means you can use the same compiler to develop your .NET add-ins and ObjectARX add-ins if you like to do a bit of both. (You’ll have to use this configuration if you’re one of the small number of people who write mixed-managed C++ code.) You need to be aware of one more migration issue. If you use an installer to deploy your add-in or if you access AutoCAD registry settings, the minor version number in the AutoCAD registry key has changed. AutoCAD 2011 was version R18.1, AutoCAD 2012 is version R18.2. Now on to the fun stuff. The new APIs

The new APIs in AutoCAD 2012 can be classified as two big APIs, a lot of small enhancements, and a really cool new feature that’s not really an API, but is going to be of huge benefit when you want to deploy your add-ins to your customers’ or colleagues’ computers.

The Associative Array API gives you the power to do anything in your add-ins that you can do with the Associative Array feature. You can create new arrays or modify the parameters of existing arrays. A sample demonstrating this API will have been posted to Kean Walmsley’s ‘Through the Interface’ blog by the time this article is published (see the links to further reading later in this article). The second big API is the Multi-Mode Grip API. In AutoCAD 2011, polylines and splines grew some new grips. And when you hovered over those grips with your cursor, a menu of options suddenly appeared (see Figure 2). In AutoCAD 2012 you can add these grip context menus to the standard AutoCAD entities, or to your own custom objects (if you’re an ObjectARX programmer). Combining this with the Overrule API that arrived with AutoCAD 2010, you can even add your own custom grips to an AutoCAD object and then add grip context menus to your custom grips. A sample demonstrating this will also be available on the Through the Interface blog.

product focus

AutoCAD AutoCAD API

Sorry, LISP programmers—the new APIs in this release are focused on .NET and ObjectARX. But the ‘cool new feature’ I describe in the next section will be very useful to you, too. The two big APIs are the evolution of features and APIs that appeared in previous versions of AutoCAD. AutoCAD 2010 gave us the Parametric Drawing feature, which allowed us to add 2D geometric and dimensional constraints to drawing elements. That was accompanied by an ObjectARX API. AutoCAD 2011 gave us a .NET version of the Parametric Drawing API, and also ObjectARX and .NET APIs for the Associative Surfaces feature introduced in that release. Both these features make use of an internal framework called the Associative Framework. We’ve used that Associative Framework again in AutoCAD 2012 to create the Associative Array feature, which comes with (you guessed it) ObjectARX and .NET APIs. Figure 2: The Multi-Mode Grip API allows you to create your own grip context menus—just like the AutoCAD ones.

The other new APIs in AutoCAD 2012 are smaller additions, and are scattered about enough that I can’t describe them all in this article. You’ll have to download the ObjectARX SDK documentation and read through the What’s New section to find them all. Here are a few of the more notable ones. Visibility Overrule – a new addition to the Overrule API family to allow you to react to the changing visibility of AutoCAD objects.

Figure 1: The Associative Array feature comes with a comprehensive API. April 2011

ResetTimes API – resets the TDCREATE, TDUPDATE, TDINDWG, and TDUSRTIMER drawing variables to zero. Helpful if you use these to track editing times.

www.augiworld.com 17


Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.