Hi,
Trying to make a simple tab, but faced with an error.
Here is my code:
#region Namespaces
using Autodesk.Revit.ApplicationServices;
using Autodesk.Revit.Attributes;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.IO;
using System.Reflection;
#endregion
namespace YYY
{
internal class App : IExternalApplication
{
public Result OnStartup(UIControlledApplication a)
{
string tabName = "PERIR";
string panelName = "Info";
a.CreateRibbonPanel(tabName);
var panel = a.CreateRibbonPanel(tabName, panelName);
var button1 = new PushButtonData("Info", "b1", "C:\\Users\\denisyuk\\Desktop\\RevitApiTest\\YYY.dll", "YYY.Command");
button1.ToolTip = "TT";
button1.LongDescription = "This is TT";
var btn1 = panel.AddItem(button1) as PushButton;
return Result.Succeeded;
}
public Result OnShutdown(UIControlledApplication a)
{
return Result.Succeeded;
}
}
}
Nothing special just stuck on this.
UPD: I set AssemblyName hardcoded because I use virtual michine to make a build and place it as well as addin file to correspondng directories manually.
Solved! Go to Solution.
Hi,
Trying to make a simple tab, but faced with an error.
Here is my code:
#region Namespaces
using Autodesk.Revit.ApplicationServices;
using Autodesk.Revit.Attributes;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.IO;
using System.Reflection;
#endregion
namespace YYY
{
internal class App : IExternalApplication
{
public Result OnStartup(UIControlledApplication a)
{
string tabName = "PERIR";
string panelName = "Info";
a.CreateRibbonPanel(tabName);
var panel = a.CreateRibbonPanel(tabName, panelName);
var button1 = new PushButtonData("Info", "b1", "C:\\Users\\denisyuk\\Desktop\\RevitApiTest\\YYY.dll", "YYY.Command");
button1.ToolTip = "TT";
button1.LongDescription = "This is TT";
var btn1 = panel.AddItem(button1) as PushButton;
return Result.Succeeded;
}
public Result OnShutdown(UIControlledApplication a)
{
return Result.Succeeded;
}
}
}
Nothing special just stuck on this.
UPD: I set AssemblyName hardcoded because I use virtual michine to make a build and place it as well as addin file to correspondng directories manually.
Solved! Go to Solution.
Solved by Mohamed_Arshad. Go to Solution.
HI @denisyukJ
you're not creating a tab, Twice time you have created panel. Check Line No. 24 and 25.
In Ln No.24 change to a.CreateRibbonTab(tabName);
a.CreateRibbonTab(tabName);
Hope this will Helps 🙂
HI @denisyukJ
you're not creating a tab, Twice time you have created panel. Check Line No. 24 and 25.
In Ln No.24 change to a.CreateRibbonTab(tabName);
a.CreateRibbonTab(tabName);
Hope this will Helps 🙂
You are calling CreateRibbonPanel twice over. Revit probably does not like that.
You are calling CreateRibbonPanel twice over. Revit probably does not like that.
Can't find what you're looking for? Ask the community or share your knowledge.