Message 1 of 6
Not applicable
07-04-2016
06:39 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello !
I have a little problem while creating my firts plugin. In fact my OnStartUp() function seems to not working ....
But when I transfer my code to the execute() function it work !
I think the problem is from my add-in but I haven't been able to find a guide to understood how it work.
here is the code of my add-in :
<?xml version="1.0" encoding="utf-8"?>
<RevitAddIns>
<AddIn Type="Command">
<Assembly>
C:\Users\maxime\Documents\Visual Studio 2015\Projects\ClassLibrary3\ClassLibrary3\bin\Debug\ClassLibrary3.dll
</Assembly>
<ClientId>502fe383-2648-4e98-adf8-5e6047f9dc35</ClientId>
<FullClassName>Class1</FullClassName>
<Text>ClassLibrary3</Text>
<VendorId>ADSK</VendorId>
<VisibilityMode>AlwaysVisible</VisibilityMode>
</AddIn>
</RevitAddIns>
And here the code of my OnStartUp function :
public Result OnStartup(UIControlledApplication a)
{
System.Windows.Forms.MessageBox.Show("test");
adWin.RibbonControl ribbon
= adWin.ComponentManager.Ribbon;
foreach (adWin.RibbonTab tab in ribbon.Tabs)
{
System.Windows.Forms.MessageBox.Show("test");
if (tab.Id == "Analyse")
{
foreach (adWin.RibbonPanel panel
in tab.Panels)
{
if (panel.Source.Id == "cea_shr")
{
adWin.RibbonButton button
= new adWin.RibbonButton();
button.Name = "TbcButtonName";
// button.Image = Image.FromFile("C:\\Users\\a\\Downloads\\12347734_10204048769899926_1746719051843979140_n.jpg");
//button.LargeImage = image;
button.Id = "ID_TBC_BUTTON";
button.AllowInStatusBar = true;
button.AllowInToolBar = true;
button.GroupLocation = Autodesk.Private
.Windows.RibbonItemGroupLocation.Middle;
button.IsEnabled = true;
button.IsToolTipEnabled = true;
button.IsVisible = true;
button.ShowImage = true;
button.ShowText = true;
button.ShowToolTipOnDisabled = true;
button.Text = "Export vues";
button.ToolTip = "Open The Building "
+ "Coder blog on the Revit API";
button.MinHeight = 0;
button.MinWidth = 0;
button.Size = adWin.RibbonItemSize.Large;
button.ResizeStyle = adWin
.RibbonItemResizeStyles.HideText;
button.IsCheckable = true;
button.Orientation = System.Windows
.Controls.Orientation.Vertical;
button.KeyTip = "TBC";
adWin.ComponentManager.UIElementActivated
+= new EventHandler<
adWin.UIElementActivatedEventArgs>(
ComponentManager_UIElementActivated);
panel.Source.Items.Add(button);
return Result.Succeeded;
}
}
}
}
return Result.Succeeded;
}
Solved! Go to Solution.
