I'm trying to add a new ribbon panel. I used the hello world ribbon wank through from the wiki help. Here's what I have, it won't work. Any thoughts? Thanks.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Autodesk.Revit;
using System.Diagnostics;
using System.IO;
using System.Windows.Media;
using System.Windows.Forms;
using System.Windows.Media.Imaging;
using Autodesk.Revit.UI;
using Autodesk.Revit.DB;
using Autodesk.Revit.ApplicationServices;
using Autodesk.Revit.UI.Events;
namespace
AddPanel
{
publicclassAddpanel : Autodesk.Revit.UI.IExternalApplication
{
public Autodesk.Revit.UI.Result OnStartup(UIControlledApplication application)
{
// add new ribbon panel
RibbonPanel ribbonPanel = application.CreateRibbonPanel("NewRibbonPanel");
//Create a push button in the ribbon panel "NewRibbonPanel"
//the add-in application "HelloWorld" will be triggered when button is pushed
PushButton pushButton = ribbonPanel.AddItem(newPushButtonData("HelloWorld",
"HelloWorld", @"C:\Users\bthatcher\Documents\Visual Studio 2010\Projects\HelloWorld\HelloWorld\bin\Release\HelloWorld.dll", "HelloWorld.HelloWorld")) asPushButton;
// Set the large image shown on button
Uri uriImage = newUri(@"C:\Users\bthatcher\Desktop\CB.jpg");
BitmapImage largeImage = newBitmapImage(uriImage);
pushButton.LargeImage = largeImage;
returnResult.Succeeded;
}
publicResult OnShutdown(UIControlledApplication application)
{
returnResult.Succeeded;
}
}
}
Hi:
Could it be because you are missing the transaction and regeneration attributes for the class. You should be adding the following attributes like :
[Autodesk.Revit.Attributes.
Transaction(Autodesk.Revit.Attributes.TransactionMode.Manual)]
[Autodesk.Revit.Attributes.
Regeneration(Autodesk.Revit.Attributes.RegenerationOption.Manual)]
[Autodesk.Revit.Attributes.
Journaling(Autodesk.Revit.Attributes.JournalingMode.NoCommandData)]
publicclassCommand : IExternalCommand
{
#region
IExternalCommand Members
. . .
Also please ensure that the entries in the addin manifest file are correct. If you need a ready made sample which creates a ribbon, please refer to the Ribbon sample which is part of the Revit SDK (which can be installed from the Revit installer under tools and utilities menu).
Hope this helps
Saikat