59 lines
1.7 KiB
C#
59 lines
1.7 KiB
C#
|
|
|
|||
|
|
using System;
|
|||
|
|
using System.Diagnostics;
|
|||
|
|
using System.Drawing;
|
|||
|
|
using System.Linq;
|
|||
|
|
using System.Net;
|
|||
|
|
using System.Reflection;
|
|||
|
|
using System.Text;
|
|||
|
|
using System.Windows;
|
|||
|
|
using System.Windows.Interop;
|
|||
|
|
using System.Windows.Media.Imaging;
|
|||
|
|
|
|||
|
|
using Autodesk.Revit.DB;
|
|||
|
|
using Autodesk.Revit.UI;
|
|||
|
|
using Autodesk.Windows;
|
|||
|
|
|
|||
|
|
using Nice3point.Revit.Toolkit.External;
|
|||
|
|
using Nice3point.Revit.Toolkit.External.Handlers;
|
|||
|
|
|
|||
|
|
using RevitAddins.Properties;
|
|||
|
|
|
|||
|
|
using RibbonButton = Autodesk.Windows.RibbonButton;
|
|||
|
|
using RibbonPanel = Autodesk.Revit.UI.RibbonPanel;
|
|||
|
|
|
|||
|
|
namespace RevitAddins;
|
|||
|
|
|
|||
|
|
public class App : ExternalApplication
|
|||
|
|
{
|
|||
|
|
public override void OnStartup()
|
|||
|
|
{
|
|||
|
|
var panel = UiApplication.CreateRibbonPanel("属性表导出");
|
|||
|
|
|
|||
|
|
PushButtonData export =
|
|||
|
|
new(nameof(ExportSheetsCmd), "导出属性表", GlobalVariables.AddInPath, typeof(ExportSheetsCmd).FullName)
|
|||
|
|
{
|
|||
|
|
LargeImage = ToBitmapSource(Resources.xlsx),
|
|||
|
|
ToolTip = "导出属性表"
|
|||
|
|
};
|
|||
|
|
PushButtonData browser =
|
|||
|
|
new(nameof(BrowserFolderCmd), "模板文件夹", GlobalVariables.AddInPath, typeof(BrowserFolderCmd).FullName)
|
|||
|
|
{
|
|||
|
|
LargeImage = ToBitmapSource(Resources.folder),
|
|||
|
|
ToolTip = "模板文件夹"
|
|||
|
|
};
|
|||
|
|
panel.AddItem(export);
|
|||
|
|
panel.AddItem(browser);
|
|||
|
|
}
|
|||
|
|
public static BitmapSource ToBitmapSource(Bitmap bitmap)
|
|||
|
|
{
|
|||
|
|
if (bitmap == null)
|
|||
|
|
{
|
|||
|
|
return null;
|
|||
|
|
}
|
|||
|
|
return Imaging.CreateBitmapSourceFromHBitmap(bitmap.GetHbitmap(), IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions());
|
|||
|
|
}
|
|||
|
|
public RibbonControl RibbonControl => ComponentManager.Ribbon;
|
|||
|
|
|
|||
|
|
}
|