Autodesk Exchange: preparing your AutoCAD application for posting

Back when we were first creating the Exchange Store, I went through the process of preparing several of our Plugins of the Month for posting to Autodesk Exchange. After a break of several months, I've now gone back and readied September's plugin (TransTips, now on Autodesk Labs) for posting, also.

It seemed to make sense to spend a couple of posts documenting the process I followed โ€“ which should complement the DevTV sessions already posted on the Autodesk Exchange Apps Developer Center:

This initial post focuses on preparing an application for submission to Autodesk for posting. The follow-up post will step through the process of getting set up as a published and submitting the application to Autodesk.

Step 1 โ€“ download an existing Autodesk app to copy.

Download an Autodesk app from the Store: any of the previous Plugins of the Month will do. I tend to use Spiro as a basis for mine, for no particular reason.

Downloading Spiro from Autodesk Exchange

Step 2 - navigate to where it is on your hard-drive and make a copy of it.

I use this handy string, pasted into Windows Explorer, to get to the folder containing downloaded application bundles (i.e. the file structures containing the application modules, etc.):

%AppData%/Autodesk/ApplicationPlugins

Then you can simply right-click drag and select "Copy here":

Copy the bundle to work with

Rename the bundle to have the name you want (prefixing it with your Registered Developer Symbol, to avoid name clashes with other applications).

I'd also suggest moving the bundle out of the autoloader folder โ€“ or at least renaming it so it doesn't end in .bundle โ€“ as we will be launching AutoCAD before we've finished the complete migration (and don't want it loaded until we're ready).

The plugin's source code is there for you to look at and extend, if you wish, but you should remove it from your copy of the application bundle (i.e. delete the entire "Contents\Source" sub-folder).

Step 3 โ€“ copy your application modules to the new bundle's "Contents\Windows" folder.

Navigate down through your newly renamed bundle, to find the "Contents\Windows" sub-folder. This is the location to which you should copy your LISP, .NET, ObjectARX, etc. application modules.

Step 4 โ€“ update the PackageContents.xml manifest.

Here's a sample manifest for Spiro, such as the one found in the root folder of the downloaded/copied bundle. There may be some additional attributes in the XML you download โ€“ specifically the ProductCode and UpgradeCode GUIDs and the reference to the HTML help-file โ€“ which can safely be removed as they will be included automatically during the posting process. I've also inserted a few additional attributes to comply with standards we'll be starting to impose soon for newly submitted applications (as well as retro-fitting to the existing applications on the store).

For more details on the XML format, see this online help page.

<?xml version="1.0" encoding="utf-8"?>

<ApplicationPackage

  SchemaVersion="1.0"

  ProductType="Application"

  Name="Spiro" AppVersion="1.1.0"

  Description="ADN Plugin of the Month: Spiro"

  Author="Kean Walmsley"

  Icon="./Contents/Resources/Spiro.bmp">

  <CompanyDetails

    Name="Autodesk"

    Phone=" "

    Url="http://labs.autodesk.com/utilities/ADN_Plugins"

    Email="labs.plugins@autodesk.com" />

  <Components>

    <RuntimeRequirements

      SupportPath="./Contents/Resources"

      Platform="AutoCAD|AutoCAD*"

      OS="Win32|Win64"

      SeriesMin="R18.2" />

    <ComponentEntry

      AppName="ADNPlugin-Spiro"

      ModuleName="./Contents/Windows/ADNPlugin-Spiro.dll"

      AppDescription="ADN Plugin of the Month: Spiro"

      LoadOnCommandInvocation="True"

      LoadOnRequest="True">

      <Commands GroupName="ADNPLUGINS">

        <Command Local="SPI" Global="SPI" />

        <Command Local="SPISEGS" Global="SPISEGS" />

      </Commands>

    </ComponentEntry>

    <ComponentEntry

      AppName="ADNPlugin-Spiro"

      ModuleName="./Contents/Resources/Spiro.cuix" />

  </Components>

</ApplicationPackage>

Here's what I typically do when updating this file:

  • Go through, line by line, updating the names, descriptions, resource links, etc.
    • As I'm typically using the same application format, I would typically just replace "Spiro" with my updated product name, including for the various image files, etc. You will have a bit more work to do, of course. ๐Ÿ™‚
  • Specify the components that need loading in AutoCAD, and under which circumstances, in the Components section.
    • Dependent modules โ€“ such as runtime components or shared libraries used by the main AutoCAD components โ€“ do not need to be listed.

Step 5 โ€“ update the images in the bundle.

Rename the various .bmp files in the "Contents/Resources" sub-folder, making sure they match the names in the manifest. This is also true of the .CUIX file, although you can simply delete the .MNR and the .HTM files, which will get generated automatically later (one when we edit the .CUIX file and the other when the application submission is processed by Autodesk).

Use an image editor โ€“ I'm a big fan of the free Paint.NET tool, as it supports layers and provides other features that makes life easier โ€“ to update (or create) images of the same dimensions as those in the bundle. Having the existing images renamed arguably makes it easier to get the filenames right as you overwrite them, although I can see how others may find this a little redundant.

Editing images in Paint.NET

The background I've used for the various plugins I've posted is intended to make it clear the plugins are from Autodesk. You will clearly want to have your own, unique branding.

Step 6 โ€“ update the CUIX file.

All applications on the Exchange Store have a consistent UI for being launched, in that upon install they add a ribbon panel (containing one or more commands) to the "Plug-ins" ribbon tab inside AutoCAD. They do this by providing a partial CUIX file containing the panel definition that is also referenced from the XML manifest.

We'll use AutoCAD to update the CUIX file to work for our application. Start by using the MENULOAD command to unload the partial CUIX file we're basing ours on (just to avoid confusion, as the one we copied will have similar internal names and IDs).

Use MENULOAD to unload any partial CUIX with the same name

You can then use the same dialog to browse to and load our copied/renamed CUIX file.

Now run the CUI command, selecting the partial CUIX to edit:

Selecting our partial CUIX in the CUI dialog

We can see that the CUIX itself is pretty minimal: it really only contains our custom ribbon panel โ€“ and associated command โ€“ and an entry for it on the standard "Plug-ins" tab (whose internal name is "Add-Ins").

A quick comment on this tab: when the CUIX file is brought in, an attempt is made to match the internal ID of the partial tab with those of the main CUI file. If a match is found, the contents of the tab in the partial file get added to the existing one. Otherwise a new tab is created with the name of the tab in the partial file.

So if the "Plug-ins" tab isn't present in one of an AutoCAD-based product's workspace, a new tab will be created. It's recommended to use the ID of the "Plug-ins" tab for the tab containing your custom panel in the CUIX file, but you should use a name that makes sense if the standard "Plug-ins" tab isn't present. If everyone just calls their tab "Plug-ins", then potentially there could end up being one "Plug-ins" tab created for each product (it's about the tabs in the main CUI file, not about those loaded in the current workspace).

Therefore, in this case, I'd suggest keeping the ID as "ID_ADDINSTAB" but changing the name of the ribbon tab to something like "Language" or "Translate".

The contents of our partial CUIX

Start by editing the Name, Display Text and Aliases for the panel itself (in the Properties window you can see at the bottom right of the above image).

Next select the button image entry (the one named "Spiro" above, the first child of "Row 1") and edit its various properties:

Our button image properties

You should change the Group Name, Command Name, Description, Command Display Name, Macro and Small & Large image properties. Don't be concerned about the Element ID in the "Advanced" category: you can edit this by selecting the SPIRO command at the lower-left of the CUI dialog:

Our custom command properties

Now you should be able to save your changes and see the results on the "Plug-ins" tab inside AutoCAD.

There's a quirk in the FCS (First Customer Shipment or the original, un-patched) version of AutoCAD 2012: if the Autoloader has already loaded your bundle โ€“ but then you remove and replace it โ€“ then the partial CUIX sometimes doesn't get loaded. This should be addressed before too long, but in the meantime you can simply unload and reload your CUIX file using the MENULOAD or CUI commands.

Our custom item on the plug-ins tab inside AutoCAD 2012

Step 7 โ€“ test your bundle.

Move your bundle back into the "%AppData%\Autodesk\ApplicationPlugins" folder (or rename it to have the .bundle suffix) and launch AutoCAD, to see how the application loads and performs. For instance, make sure the conditions for loading the various modules specified in the PackageContents.xml file are respected (such as loading the application on invocation of your custom commands).

In case you hit problems, try using the APPAUTOLOADER command with the RELOAD option to reload the various application bundles: this will report when your XML is incorrect or list the settings for each application, otherwise.

It's really worth testing your application thoroughly before submitting. Upon receiving the submission, my team will certainly let you know of any issues they come across during their cursory inspection of the loading/launching functionality, but each iteration of the feedback loop adds to the time it takes for you to get your application in the hands of AutoCAD users.

That's it for this post looking at preparing your application for posting. In the next post we'll take a look at the actual posting process.

11 responses to “Autodesk Exchange: preparing your AutoCAD application for posting”

  1. Thx for this post Kean, I may not put up any apps for a while, but knowing what it takes establishes the amount of effort involved. It seems to me that whole iudea of an app store is to slick out the user experience. Hopefully there will be some kind of submission tool that asks step by step questions that would walk through all the steps. Kind of like slicking it out for the developer too. If I just had a .net dll with one command, i should be able to pick it, fill out some info, pick a logo, and have it do the submission, something simple like that.

  2. It'll get easier, as we do more automation on our side (we're already doing a lot, and it's increasing).

    If you actually look at the work involved (rather than the length of the post), there really isn't that much to it. A little XML editing and some basic CUI work, but nothing earth-shattering (but I do see that these steps could be simplified, over time).

    And you'll always have to edit your images, of course. ๐Ÿ™‚

    Kean

  3. Hello,

    Thanks a lot for this post..

    I am trying to add a test .NET dll to the AutoCAD 2012 Plugins ribbon, but unfortunately am not able to see my tool in the Plugins ribbon although am following the same steps as you mentioned in this post. The only step am skipping is "Step 6 โ€“ update the CUIX file". Well, am not sure how can I apply this step & whether it is needed!

    Please advise.

    Thanks in advance,

  4. Updating the CUIX file is exactly how you get your app to display an item in the Plug-ins ribbon tab.

    Please try that step, too, and then - if it still doesn't work - post your problem to the AutoCAD .NET Discussion Group or to the ADN team (if you're a member).

    Kean

  5. Thanks Kean for your reply,
    Unfortunately, I am still facing a problem in executing the command, anyways I submitted the problem to ADN team.

    Regards,
    Mona

  6. MexicanCustard Avatar
    MexicanCustard

    Kean, do you know if its possible to get AutoCAD to look outside the bundle folder to find an Assembly?

    I have DLLs on a network drive and when I try to load them with the autoloader the error message shows AutoCAD combining the path I gave with the bundle folder path. Which of course leads to AutoCAD not locating the assemby in that location.

  7. Kean Walmsley Avatar

    I don't believe full paths are supported (and network drives come with their own problems when it comes to .NET security).

    Kean

  8. hi
    i have need to write plugin on delphi
    have you example simple plugin on pascal or .net? i try rewrite into delphi
    wery thanks from ukraine

  9. Sorry - I have no experience with that. Please post your question to the relevant (probably .NET) AutoCAD discussion group.

    Kean

    1. Pierre de la Verre Avatar
      Pierre de la Verre

      Hi Kean
      step 6 describes the merging of different partial cuix in the "plugins" tab of the main cuix, using the same alias. Is it correct that this will only work with the main cuix?

      I'm looking for a way to get a similar result with partial menus, merging into the same tab of a partial menu:
      - I have My_A.cuix, My_B.cuix and My_C.cuix
      - Each cuix has a tab with ID "my_ID"
      - The first loaded partial cuix creates a new tab, the following cuix should merge into the existing tab.

      I tried, but failed. How to get it?

      Regards

      Peter

  10. Can you please provide an example of loading Dependencies with the autoloader? I have 3rd party dll's such as EntityFramework.dll that I would like registered to ensure they are loaded. I have googled quite a bit and discovered: adndevblog.typepad.com/autocad/ and would like to go the autoloader route for simplicity, or so I hope.

    Thanks,
    Matt

Leave a Reply to kolio Cancel reply

Your email address will not be published. Required fields are marked *