Ribbon creation in revit 2014

Ribbon creation in revit 2014

Anonymous
Not applicable
880 Views
6 Replies
Message 1 of 7

Ribbon creation in revit 2014

Anonymous
Not applicable

These are the code lines in vb c#

 

 

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Windows.Media.Imaging;
using Autodesk.Revit.ApplicationServices;
using Autodesk.Revit.Attributes;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;
using System.Xaml;
using Autodesk.Revit.Creation;
using Autodesk.Revit.UI.Events;

namespace Ribbon
{
[Regeneration(RegenerationOption.Manual)]
class CsAddPanel : Autodesk.Revit.UI.IExternalApplication
{
public Result OnStartup(UIControlledApplication application)
{

String tabName = "This Tab Name";
application.CreateRibbonTab(tabName);

//create two push buttons
PushButtonData button1 = new PushButtonData("Button1", "My Button #1",
@"C:\All Elements.dll", "All_Elements.AllElements");
PushButtonData button2 = new PushButtonData("Button2", "My Button #2",
@"C:\MaterialQuantities.dll", "MaterialQuantities.Command");

RibbonPanel m_projectPanel = application.CreateRibbonPanel(tabName,"This Panel Name");

List<RibbonItem> projectButtons = new List<RibbonItem>();
projectButtons.AddRange(m_projectPanel.AddStackedItems(button1, button2));

return Result.Succeeded;

}
public Result OnShutdown(UIControlledApplication application)
{
return Result.Succeeded;
}
}
}

 

 

 

 

this is the adding manifest file

 

<?xml version="1.0" encoding="utf-8"?>
<RevitAddIns>
<!-- 1_Ribbon -->
<AddIn Type="Application">
<Name>UI Labs Ribbon</Name>
<FullClassName>Ribbon2.AddPanel</FullClassName>
<Assembly>C:\Users\Autodesk\Documents\Visual Studio 2010\Projects\Ribbon2\Ribbon2\bin\Debug\Ribbon2.dll</Assembly>
<AddInId>7851F984-76C1-437E-BF66-645FEE13A873</AddInId>
<VendorId>ADNP</VendorId>
<VendorDescription>Autodesk, Inc. www.autodesk.com</VendorDescription>
</AddIn>

 

 

there r no errors..

its showing two warnings...

 

Warning 1 There was a mismatch between the processor architecture of the project being built "MSIL" and the processor architecture of the reference "RevitAPI", "AMD64". This mismatch may cause runtime failures. Please consider changing the targeted processor architecture of your project through the Configuration Manager so as to align the processor architectures between your project and references, or take a dependency on references with a processor architecture that matches the targeted processor architecture of your project. 

 

Warning 2 There was a mismatch between the processor architecture of the project being built "MSIL" and the processor architecture of the reference "RevitAPIUI", "AMD64". This mismatch may cause runtime failures. Please consider changing the targeted processor architecture of your project through the Configuration Manager so as to align the processor architectures between your project and references, or take a dependency on references with a processor architecture that matches the targeted processor architecture of your project. 

 

 

Ribon doesn't get executed...

What is my mistake n how to rectify it?

 

Please help me...

0 Likes
881 Views
6 Replies
Replies (6)
Message 2 of 7

Anonymous
Not applicable
Hello,

Your code is correct and to buttons should appear at the Ribbon.

The warnings mean that your project platform is setup as AnyCPU but RevitAPI.dll and RevitUIAPI assemblies are x64 assemblies.

Make sure your project target is AnyCPU: Go to the project Properties and on the Build tab check that the Platform target is AnyCPU

Anyway, you will see these warnings though. Do not pay attention to them.

Make sure you copied your .addin manifest file to the C:\Users\<your user name>\AppData\Roaming\Autodesk\Revit\AddIns\2014

If the buttons still not appears on the ribbon, set the breakpoint to any line on the OnStartup method and try to debug the code step by step.
0 Likes
Message 3 of 7

Anonymous
Not applicable

Your external application class is called "Ribbon.CsAddPanel"

 

Yet in your Addin manifest file you call up 'Ribbon2.AddPanel'

 

I suspect this may be causing your problem.

 

 

 

 

 

 

 

0 Likes
Message 4 of 7

Anonymous
Not applicable

Yeah i corrected that..

It still dint show.

what should i do?

 

0 Likes
Message 5 of 7

Anonymous
Not applicable
I have changed in project properties and also copied adin manifest file..

ribbon dint show up.

0 Likes
Message 6 of 7

Anonymous
Not applicable
Have you added a eventhandler for DocumentOpened ?
0 Likes
Message 7 of 7

farisarch
Explorer
Explorer

how to pass parameter to MaterialQuantities.Command ?

0 Likes