添加项目
This commit is contained in:
30
RevitAddin/Revit/App.cs
Normal file
30
RevitAddin/Revit/App.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using Autodesk.Revit.DB;
|
||||
using Autodesk.Revit.UI;
|
||||
using ricaun.Revit.UI;
|
||||
|
||||
|
||||
namespace RevitAddin.Revit
|
||||
{
|
||||
[AppLoader]
|
||||
public class App : IExternalApplication
|
||||
{
|
||||
private RibbonPanel ribbonPanel;
|
||||
public Result OnStartup(UIControlledApplication application)
|
||||
{
|
||||
ribbonPanel = application.CreatePanel("RevitAddin");
|
||||
ribbonPanel.CreatePushButton<Commands.Command>()
|
||||
.SetLargeImage("Resources/Revit.ico");
|
||||
return Result.Succeeded;
|
||||
}
|
||||
|
||||
public Result OnShutdown(UIControlledApplication application)
|
||||
{
|
||||
ribbonPanel?.Remove();
|
||||
return Result.Succeeded;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
21
RevitAddin/Revit/Commands/Command.cs
Normal file
21
RevitAddin/Revit/Commands/Command.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using Autodesk.Revit.Attributes;
|
||||
using Autodesk.Revit.DB;
|
||||
using Autodesk.Revit.UI;
|
||||
|
||||
namespace RevitAddin.Revit.Commands
|
||||
{
|
||||
[Transaction(TransactionMode.Manual)]
|
||||
public class Command : IExternalCommand
|
||||
{
|
||||
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elementSet)
|
||||
{
|
||||
UIApplication uiapp = commandData.Application;
|
||||
|
||||
System.Windows.MessageBox.Show(uiapp.Application.VersionName);
|
||||
|
||||
return Result.Succeeded;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user