Visual Studio Add-In Wizards for Revit 2012

As I mentioned yesterday, this weekend was spent traveling to Verona to give a Revit API training here.
Happily, I enjoyed some mountain air the weekend before, on Helgenhorn 2837m,

Basodino
3273m and
Cima di Lago south of All’Acqua in the

Bedretto Valley

(more photos by Jogi):

Jeremy on Basodino

Anyway, that was last weekend; back to here and now in Verona, where I was busy yesterday, preparing for the training, starting today.

I already updated the DevTV Visual Studio wizards for creating skeleton C# and VB Revit 2011 add-ins several times in the past:

One step in my preparations was to migrate the wizard templates to Visual Studio 2010 and the Revit 2012 API.
Here is the first result:

The two most important changes that I made for 2012 are:

  • Added required vendor id and optional vendor description to the add-in manifest file.
  • Removed the obsolete regeneration option attribute.

This is what the auto-generated add-in manifest now looks like:


<?xml version="1.0" encoding="utf-8"?>
<RevitAddIns>
  <AddIn Type="Command">
    <Text>Command RevitAddin1</Text>
    <Description>Some description for RevitAddin1</Description>
    <Assembly>c:tmprevitRevitAddin1RevitAddin1bindebugRevitAddin1.dll</Assembly>
    <FullClassName>RevitAddin1.Command</FullClassName>
    <ClientId>4e980ab7-e6f4-456f-b8cc-646ef733128c</ClientId>
    <VendorId>TBC_</VendorId>
    <VendorDescription>The Building Coder, http://thebuildingcoder.typepad.com</VendorDescription>
  </AddIn>
  <AddIn Type="Application">
    <Name>Application RevitAddin1</Name>
    <Assembly>c:tmprevitRevitAddin1RevitAddin1bindebugRevitAddin1.dll</Assembly>
    <FullClassName>RevitAddin1.App</FullClassName>
    <ClientId>dddfad28-c7a0-45fe-836e-0eb03e919e81</ClientId>
    <VendorId>TBC_</VendorId>
    <VendorDescription>The Building Coder, http://thebuildingcoder.typepad.com</VendorDescription>
  </AddIn>
</RevitAddIns>

I used The Building Coder
Autodesk Registered Developer Symbol RDS “TBC_”
for the vendor id.
You should obviously replace that with your own id before using the template.

Whatever you would like to change, it is extremely easy to adapt the templates for your own personal use:

Simply unpack the zip file somewhere, make your changes, update the zip file with the modified files, and copy the new zip file to the appropriate location.


Comments

5 responses to “Visual Studio Add-In Wizards for Revit 2012”

  1. Using Revit 2012, Visual studio 2010 getting an errer – Inconsistent accessibility: parameter type ‘Addpanel.UIControlledapplication’ is less accessible than Method ‘Addpanel.CSAddpanel.OnStartup(Addpanel.UIControlledapplication)’
    ###################################
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using Autodesk.Revit.UI;
    using System.Windows.Media.Imaging;
    namespace Addpanel
    {
    public class CSAddpanel : Autodesk.Revit.UI.IExternalApplication
    {
    public Autodesk.Revit.UI.Result OnStartup(UIControlledapplication application)
    {
    Ribbonpanel ribbonPanel = application.CreateRibbonPanel(“NewRibbonPanel”);
    PushButton pushButton = ribbonPanel.AddItem(new PushButtonData(“Helloworld”,
    “Helloworld”, @”C:\ProgramData\Autodesk\Revit\Addins\2012\HelloWorld.dll”, “HelloWorld.CSHelloWorld”)) as PushButton;
    Uri uriImage = new Uri(@”C:\ProgramData\Autodesk\Revit\Addins\2012\Addpanel_33X32.png”);
    BitmapImage largeImage = new BitmapImage(uriImage);
    pushButton.LargeImage = largeImage;
    return Result.Succeeded;
    }
    public Result OnShutdown(UIControlledApplication application)
    {
    return Result.Succeeded;
    }
    }
    }

  2. Dear Baju,
    C# is case sensitive. You need to replace the class names UIControlledapplication by UIControlledApplication (capital A) and Ribbonpanel by RibbonPanel (capital P).
    Cheers, Jeremy.

  3. Jeremy,
    How would I go about updating this template to work for RME 2012? Is there a wizard for developing on this platform? The only issues that I have noticed with working with this wizard is the locations of the API is referencing the RAC location.
    With Regards,
    Matt

  4. Jeremy,
    I have figured it out… Simply by editing the TemplateRevitCS.csproj file and replacing the .dll’s with the correct ones for my version.
    Thank you for disregarding my first post.
    With Regards,
    Matt

  5. Dear Matt H,
    Yup, exactly.
    Congratulations on figuring it out, and thanks for letting us know.
    The latest version of the wizard is available here:
    http://thebuildingcoder.typepad.com/blog/2012/06/update-api-assembly-references-and-wizards.html#4
    That link also points to the various previous versions.
    You simply unpack a couple of them and compare differences to see how to modify them for other Revit installations.
    As you say, just unpack any one, edit the files as required, pack them up again and install the updated zip file to produce the result you desire.
    Cheers, Jeremy.

Leave a Reply to bkRCancel reply

Discover more from Autodesk Developer Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading