Ribbon/Tabs

Ribbon/Tabs

Anonymous
Not applicable
1,119 Views
5 Replies
Message 1 of 6

Ribbon/Tabs

Anonymous
Not applicable

Hi

 

I´m trying to make a ribbon and the botton must call a DLL.

I want to make one dll with the all my Tabs and Ribbon witch are going to call the other DLLs

 

The tab and the panel with the picture works fine, but I can´t call the DLL !!

 

 

In the addin file, I have the same information to call the DLL and the FullClassName:

 

 

<Assembly>C:\ProgramData\Autodesk\Revit\Plugins\2015\BBR_Beregning.dll</Assembly>
<FullClassName>BBR_Beregning.BBR_Beregning</FullClassName>

 

 

namespace Revit_Ribbon

{
class AA_Ribbon : IExternalApplication
{
public Autodesk.Revit.UI.Result OnStartup(UIControlledApplication application)
{
string Panel_AA = "Aarstiderne";

application.CreateRibbonTab(Panel_AA);

RibbonPanel ribbonPanel = application.CreateRibbonPanel(Panel_AA, "ArealBeregning");

PushButtonData pushButtonDataAA = new PushButtonData("BBR", "BBR", @"C:\ProgramData\Autodesk\Revit\Plugins\2015\BBR.dll", "BBR_Beregning.BBR_Beregning");

pushButtonDataAA.AvailabilityClassName = "BBR_Beregning.BBR_Beregning";

pushButtonDataAA.ToolTip = " Aarstiderne BBR beregning";
Uri urisource = new Uri(@"C:\ProgramData\Autodesk\Revit\Plugins\2015\Pictures\BBR.png");
pushButtonDataAA.LargeImage = new BitmapImage(urisource);
ribbonPanel.AddItem(pushButtonDataAA);

return Result.Succeeded;
}

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

 

Please Help 🙂

 

Regards

Anders

Accepted solutions (1)
1,120 Views
5 Replies
Replies (5)
Message 2 of 6

augusto.goncalves
Alumni
Alumni
Hi,

Your idea should work: one DLL with all ribbons, and the respective .addin file. Then this DLL point to the other DLLs, pointing to each class on them, no .addin is required for those...

From reading the code above, seems ok, but you need to make sure every DLL and class name is correct, otherwise will not work...

Looking forward, I would avoid hard-code the path like you did... assuming all DLLs are at the same folder, get the path of the executing assembly and find others on that folder.
Regards,



Augusto Goncalves
Twitter @augustomaia
Autodesk Developer Network
0 Likes
Message 3 of 6

Anonymous
Not applicable

Hi

 

I still got this error:

BBR_Beregning.BBR_Beregning does not inherit IExternalCommandAvailability

 

(BBR_Beregning.BBR_Beregning is the fullclassname)

 

Regards Anders

 

0 Likes
Message 4 of 6

augusto.goncalves
Alumni
Alumni
So have you made this class "BBR_Beregning" implement the required interface (IExternalCommandAvailability)?

This is required by Revit API, the same way all command classes must implement the IExternalCommand interface
Regards,



Augusto Goncalves
Twitter @augustomaia
Autodesk Developer Network
0 Likes
Message 5 of 6

Anonymous
Not applicable

Hi

 

I have added IExternalCommandAvailability to the class, as written below.

 

namespace BBR_Beregning
{
[Autodesk.Revit.Attributes.Transaction(Autodesk.Revit.Attributes.TransactionMode.Manual)]
[Autodesk.Revit.Attributes.Regeneration(Autodesk.Revit.Attributes.RegenerationOption.Manual)]

public class BBR_Beregning : IExternalCommandAvailability
{

............

 

But I now got this error when I build the DLL File

 

'BBR_Beregning.BBR_Beregning' does not implement interface member 'Autodesk.Revit.UI.IExternalCommandAvailability.IsCommandAvailable(Autodesk.Revit.UI.UIApplication, Autodesk.Revit.DB.CategorySet)'

 

 

0 Likes
Message 6 of 6

augusto.goncalves
Alumni
Alumni
Accepted solution
You should keep following the instructions from the error message, in this case, the missing method

As a suggestion, in this case, when you mouse hover the IExternalCommandAvailability on Visual Studio, should appear a small blue rectangle, click on it and select "Implement interface....""

For a full sample, please check the SDK sample under "\Revit 2015 SDK\Samples\ExternalCommand\CS\ExternalCommandRegistration\AvailabilityClass.cs" (if you don't have the SDK, download from www.autodesk.com/developrevit)
Regards,



Augusto Goncalves
Twitter @augustomaia
Autodesk Developer Network
0 Likes