添加项目文件。
This commit is contained in:
58
RevitAddins/App.cs
Normal file
58
RevitAddins/App.cs
Normal file
@@ -0,0 +1,58 @@
|
||||
|
||||
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;
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user