If you’re using AutoCAD® 2012, you may have noticed a new tab that recently appeared in the AutoCAD online help window. This is the link to the new Autodesk Exchange Apps store for AutoCAD that was launched in June 2011.
Figure 1: Where did that come from?
Your first question when you saw this may have been:
How will this help me?
And perhaps that was followed by:
How do I publish my own stuff?
I’ll answer both questions in this article along with a third question that some CAD and IT Managers will be asking: How do I disable it?
How will this help me?
Many AutoCAD users write their own plug-ins and macros using LISP, ObjectARX, .NET, or VBA, and there is a large and thriving community of programmers and experts who make a living selling applications and content based on Autodesk products. If you’re not customizing or programming AutoCAD, then you’re really only using half the product. Even just writing a few simple utility macros to automate common tasks can greatly increase your productivity.
Plug-ins for AutoCAD are nothing new, but the Autodesk Exchange Apps store is. The store creates a single marketplace where you can quickly find the utilities you need. There, you’ll find plug-ins, block libraries, e-books, training videos, standalone applications, and other products that help you to be more productive when working with AutoCAD.
Autodesk reviews and tests every submitted app before it is published to help ensure it is of suitable quality and that it follows some simple usability requirements. The vast majority of apps are AutoCAD plug-ins and block libraries—these make use of the new AutoCAD 2012 Autoloader feature and a standard installer template to ensure a consistent installation and discovery experience. That means they all install the same way and users can always find the user interface and helpfile in the same place.
A simple example …
Let’s say you’re working in a drawing that contains several inserts of the same block. You need to create offset geometry for the lines contained in just one of those block inserts (i.e., you don’t want to use BEDIT to edit the block definition to create the offset lines inside all of the block inserts). You could do something like explode the block insert, draw your offset lines, and then reinsert the block. Or you could search the store to see if there are any utilities that might help. Let’s do that now.
First, we open the Exchange Window (EXCHANGE command), select the Apps tab and search for “offset” (Figure 2).
Figure 2: The Apps homepage
That first hit for the search looks promising—the OffsetInXref plug-in (see Figure 3). Even better, it’s free. Other apps are trials or must be purchased. Purchase transactions can be made through PayPal.
Figure 3: We found a suitable app—OffsetInXref
We open up the product description page, check the ratings and comments made by other users, and read through the helpfile documentation. It looks like this does just what we need, so we click the download link. The plug-in installer automatically runs and adds a new panel to the AutoCAD Plug-ins tab, which confirms that installation was successful (see Figure 4).
Figure 4: Each plug-in adds a panel or tab to the AutoCAD ribbon so you can easily find it.
Now we’re ready to start offsetting geometry from inside the block inserts that we couldn’t work with before. We don’t even have to restart AutoCAD.
OffsetInXref was originally posted as an Autodesk Developer Network (ADN) Plugin of the Month on the Autodesk Labs website (http://labs.autodesk.com/utilities/ADN_plugins/). The Plugin of the Month program is intended to demonstrate that you can create productivity enhancing tools and utilities with relatively little investment in learning to program using Autodesk Application Programming Interfaces (APIs). All Plugins of the Month come with full source code to allow you to study and enhance them.
Three free apps
A large part of my work at Autodesk over the last six months has been coordinating the review and testing of apps submitted to the store to make sure the shelves were full when it launched. That means I’ve played with almost all the apps that are published there today. Many are free; many are trial versions (offering either functionality-limited or time-limited use); others can be bought via a simple PayPal transaction. Prices for purchased apps range from less than $5 to more than $1,000. I’ll come back and review some interesting purchased apps in the future. But to whet your appetite, here are my suggestions for three free apps to try if you want to experiment with the Autodesk Exchange Apps store.
COINS is a global company that creates and sells construction industry software solutions. COINS has posted a fun, free app to the store called COINS Translate. This ticks all the boxes for me as a cool plug-in: it’s simple, it’s useful, and (with the whole world going nutty over cloud computing) it uses a web service.
Working with colleagues around the world, I often have to translate text into English. COINS Translate uses the Google Translate web service to translate MText and Text in drawings. Here’s a very simple example. I received a drawing with some annotations that I want to translate (see Figure 5).
Figure 5: Mtext to translate.
After installing the app, I simply click the button it added to the Plug-ins ribbon tab and select all the MTexts I want to translate. A dialog then lets me choose the language to translate from and to (Figure 6). It even includes an option to auto-detect the ‘from’ language. (I’m using the auto-detect option on the text in Figure 5.)
Figure 6: Selecting translation options
Click the ‘Go’ button in the dialog, and the selected text is replaced with the translation. My MText now looks like Figure 7.
Figure 7: The result of the translation
ADN DWF/PDF Batch Publish
DWF/PDF Batch Publish is another ADN Plugin of the Month. This was by far the most popular download from the Autodesk Labs website, and it’s already topping the download list in the Exchange Apps store. This is another example of a simple plug-in that does what it does really well. As you no doubt guessed from the name, it helps you quickly publish a batch of drawings to DWF and/or PDF format. As a Plugin of the Month, it includes source code, and so also serves as an example of good coding practice when batch processing drawings.
Again, the plug-in is launched by simply clicking the button installed to the plug-ins tab. A dialog lets you select the folder containing the DWGs to process, the output folders for the DWF and PDF files, and a few configuration options (see Figure 8).
Figure 8: The DWF/PDF Batch Publish dialog
Click the Publish button and you’re off. The plug-in whips through your selected DWGs (Figure 9) quickly creating your DWFs/PDFs.
Figure 9: The Batch Publish status dialog
DotSoft has been writing productivity improving plug-ins for AutoCAD since 1988. These plug-ins range in complexity, but many of them are designed to tweak or enhance existing AutoCAD features to make them quicker and easier to use. The free DotSoft OrderByLayer plug-in does just this. It builds on the DRAWORDER command to allow users to quickly set the relative draw order of all geometry on a selected layer. Without OrderByLayer, you’d probably run the QSELECT command to create a query to select all the geometry on a layer, and then run the DRAWORDER command. After installing the plug-in, simply run the ORDERBYLAYER command (at the command line or by clicking the button added to the ribbon) to display the OrderByLayer dialog. Figure 10 shows a simple example drawing with three solid hatched circles on three different layers along with the OrderByLayer dialog.
Figure 10: The default draw order has MyLayer_Blue at the back
Click the checkboxes next to the layers for which you want to change the relative draw order, and then use the Move Up/Move Down buttons on the dialog to set the order. Clicking OK will dismiss the dialog and redraw the drawing in the changed order (Figure 11)—much quicker than setting the draw order by layer without the plug-in.
Figure 11: Objects on MyLayer_Blue are now drawn in front of MyLayer_Red.
Take some time to search and browse the store to see what else is there. At the time of writing there are already 150 apps posted—plug-ins, standalone helper apps, block libraries, e-books, and training videos—and more are being added all the time. Download a few more free ones to see how it works.
How do I publish my own stuff?
The Autodesk Exchange Apps store isn’t just for professional programmers. Many of us have our own collections of helper utilities, block libraries, or other AutoCAD content. And anyone can submit their apps to be published on the store. Click on the button on the Exchange Apps tab to get started (see Figure 12).
You’ll be asked to agree to the publisher terms and conditions and provide some information about yourself and your app. Once submitted, Autodesk will review your app and (if there are no problems) publish it within two weeks.
As long as your app is useful to other AutoCAD users and doesn’t do anything nasty (like crashing AutoCAD) then it’s probably something you can publish. (Detailed product guidelines are available on Autodesk Exchange as part of the publisher terms and conditions.) And if you want to sell your stuff (instead of posting it for free) then you need to create a PayPal account.
Figure 12: Click on this button on the Apps tab to publish your own apps.
Anatomy of an App
The vast majority of apps available in the store are plug-ins and block libraries. Both of these app types use the Autoloader feature (new in AutoCAD 2012). In the case of block libraries, this is to install the partial CUI that defines the UI elements (ribbon panels, toolbars, etc.) that drive the content. An Autoloader ‘bundle’ is a simple folder structure that is copied by the installer to a location on your hard drive where AutoCAD can find it. That’s normally %appdata%\Autodesk\ApplicationPlugins (%appdata% translates to C:\Users\<username>\AppData\Roaming on a standard Windows 7 installation). We call it a ‘bundle’ because the names of folders containing Autoloader plug-ins end in ‘.bundle’ so that AutoCAD can identify them. A bundle for an Exchange store app is made up of the following.
Autoloader configuration file: Every Autoloader bundle contains an XML file (called ‘PackageContents.xml’). AutoCAD reads this XML file to determine whether the plug-in is compatible with this version of AutoCAD, and so it knows how to load the various plug-in components and what support paths it has to set up. For example, you normally want your partial CUI to load when AutoCAD is launched, but (for performance reasons) you would typically only load the DLL containing the implementation of your plug-in when a command it defines is invoked.
Partial CUI file: Every plug-in (and block library) posted to the store is required to add information to the ribbon—either a panel on the Plug-ins tab, or a new tab for a larger plug-in that makes use of multiple panels. This is done by creating a partial CUI that is loaded when AutoCAD is launched. The user interface defined in this partial CUI must make it easy for the user to quickly get up and running with the plug-in, either by providing a simple and obvious user interface or providing access to the helpfile for the plug-in.
Helpfile: Regardless of any other (more detailed) helpfiles installed with a plug-in, every plug-in published to the Exchange Apps store must include a simple ‘getting started’ helpfile in HTML format. The information to populate this HTML file is gathered on the app submission form, and the helpfile is auto-generated from this information. The HTML file is viewable online (using a link from the app’s page on the Exchange Apps tab), and is also installed with the plug-in. The locally installed copy of this helpfile can be displayed from the installer after installation is complete and can be accessed from the balloon notification AutoCAD displays when it detects a newly installed plug-in.
Plug-in components: Autoloader bundles support plug-ins written in .NET, ObjectARX (ARX and DBX) and LISP (LSP, FAS, VLX). How AutoCAD should load these modules, and the inter-dependencies between them, is described by the Autoloader configuration file.
Block libraries are handled a bit differently. An Autoloader bundle is used to install the partial CUI file that accompanies the library and to define any support paths needed to access the blocks from the user interface defined in the CUI. Many block libraries are driven through menus or other CUI elements (image tile libraries for example). These are installed as normal using the Autoloader bundle. The block library files (DWGs) must also be viewable using the Content Explorer palette (new in AutoCAD 2012). The actual blocks (DWGs) are installed to a location where Content Explorer (CONTENTEXPLORER command) can find them (see Figure 13). On Windows 7 this is %public%\Documents\Autodesk\Downloaded Content (%public% translates to C:\Users\Public\ on a standard Windows 7 installation).
Other stuff: Autoloader only supports certain file types, but you can put anything you like inside the .bundle folder. This might include extended helpfiles, or support or sample files. Autoloader doesn’t replace any of the old ways to load plug-ins and files into AutoCAD, so you can put anything not directly supported by Autoloader into the .bundle and access it from the plug-in files that Autoloader can handle. Just don’t use hardcoded paths to access these files. Instead, use relative paths, support paths defined in the configuration files, expand the %appdata% environment variable, or query the location of your DLL at runtime using Windows APIs.
Figure 13: Block libraries can be accessed using Content Explorer.
I promised at the beginning of this article that I would also answer a third question that is particularly important for CAD and IT Managers:
How do I disable the Exchange Apps tab?
If you’re managing projects that demand every workstation have exactly the same configuration, then you’re probably not too keen on putting an Exchange Apps store on every computer in your network.
Not a problem. There are four ways you can disable the Exchange Apps tab in AutoCAD 2012, although disabling this tab will have the side effect of turning off online help (i.e., AutoCAD will only display the locally installed helpfiles using your default web browser).
These methods are described in detail in the “CAD Manager Reference - How to Block Access to Autodesk Exchange” document. You can download this from http://exchange.autodesk.com/autocad/enu/pdf-documentation, but before you rush off to read that, I suggest you keep the Exchange Apps store enabled on your admin computer – you might just find some apps that will help your team with their work .
Here is a summary of the four methods.
You can create a custom deployment with Exchange disabled from the AutoCAD setup.exe. You can then install AutoCAD to all your workstations using this custom deployment. This method is for disabling the Exchange window at installation time. It isn’t suitable if you’ve already deployed AutoCAD.
CAD Manager Control Utility
The CAD Manager Control Utility can be installed from the AutoCAD setup.exe (select the “Install Tools & Utilities” option), and can be used to disable the Exchange window after you’ve deployed AutoCAD 2012. The CAD Manager Control Utility can be installed and used on the computer on which you want to disable the Exchange window, or it can be used to create a .reg file that you can push to workstations on your network using your preferred method.
Disable Exchange plug-in
The simplest way to disable/re-enable the Exchange window on a single computer is to install ‘Disable Exchange’ from the Autodesk Exchange Apps tab. This installs a plug-in—only usable by users with Admin privileges—that allows them to toggle the Exchange window on and off from the computer on which the plug-in is installed.
The above three methods essentially do the same thing—edit this registry key:
You can simply add/edit this key yourself using RegEdit or a .reg file. Setting this key to ‘0’ will disable the Exchange window, setting it to ‘1’ will re-enable it. (By the way, the ‘A001’ in that registry key is the AutoCAD product code and the ‘409’ in the key is the locale code. (The locale code will be different if you have a non-English AutoCAD version.)
You can also block access to the Exchange URLs through your corporate firewall.
If you’d like to find out more about publishing your own apps, start by visiting the Autodesk Exchange Apps Developer Center at www.autodesk.com/developapps for more detailed information than I have room to include here. At this site you’ll find guidelines and recommendations, answers to frequently asked questions, and tutorial videos. If you have any additional questions about developing and posting apps to Autodesk Exchange Apps, then please email firstname.lastname@example.org.
Visit the AutoCAD Developer Center at www.autodesk.com/developautocad for more general information on developing AutoCAD Plug-Ins and customizing AutoCAD.
My ‘AutoCAD 2012 - New APIs’ article in the April 2011 issue of AUGIWorld includes an overview of the Autoloader feature used by plug-ins in the store.
Kean Walmsley’s ‘Through the Interface’ blog (http://through-the-interface.typepad.com) contains a wealth of information on programming AutoCAD in general, and some additional information on the Autoloader. Kean also manages the ADN Plugin of the Month program. The Plug-ins are posted to the Autodesk Labs website (http://labs.autodesk.com/utilities/ADN_plugins/).