forked from McCulloughRT/PrintFromIndex
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.cs
49 lines (40 loc) · 1.68 KB
/
App.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#region Namespaces
using System;
using System.Collections.Generic;
using System.IO;
using System.Reflection;
using System.Windows.Media.Imaging;
using System.Drawing;
using Autodesk.Revit.ApplicationServices;
using Autodesk.Revit.Attributes;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;
#endregion
namespace PrintIndex
{
class App : IExternalApplication
{
public Result OnStartup(UIControlledApplication a)
{
// Add a new ribbon panel
RibbonPanel ribbonPanel = a.CreateRibbonPanel("Sheet Index Tools");
// Create a push button to trigger a command add it to the ribbon panel.
string thisAssemblyPath = Assembly.GetExecutingAssembly().Location;
string AddInPath = typeof(App).Assembly.Location;
string AddFolder = Path.GetDirectoryName(AddInPath);
string helpPath = AddFolder + "\\PrintIndexHelp.html";
ContextualHelp contextHelp = new ContextualHelp(ContextualHelpType.Url,helpPath);
PushButtonData button1Data = new PushButtonData("cmdPfI",
"Print Index", thisAssemblyPath, "PrintIndex.Command");
PushButton pushButton1 = ribbonPanel.AddItem(button1Data) as PushButton;
pushButton1.ToolTip = "Click to select your sheet index and save as a printable set.";
pushButton1.LargeImage = new BitmapImage(new Uri(Path.Combine(AddFolder, "PanelIconButton.bmp"),UriKind.Absolute));
pushButton1.SetContextualHelp(contextHelp);
return Result.Succeeded;
}
public Result OnShutdown(UIControlledApplication a)
{
return Result.Succeeded;
}
}
}