mirror of
https://github.com/ShrlAlgo/AddinManager.git
synced 2026-03-07 16:38:56 +00:00
添加项目文件。
This commit is contained in:
40
AddInManager/CAddInManagerManual.cs
Normal file
40
AddInManager/CAddInManagerManual.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
using Autodesk.Revit.Attributes;
|
||||
using Autodesk.Revit.UI;
|
||||
|
||||
using System;
|
||||
using System.Windows;
|
||||
|
||||
namespace AddInManager
|
||||
{
|
||||
[Transaction(TransactionMode.Manual)]
|
||||
public class CAddInManagerManual : IExternalCommand
|
||||
{
|
||||
public Result Execute(ExternalCommandData commandData, ref string message, Autodesk.Revit.DB.ElementSet elements)
|
||||
{
|
||||
try
|
||||
{
|
||||
var aim = AIM.Instance;
|
||||
var window = new Wpf.MainWindow(aim)
|
||||
{
|
||||
WindowStartupLocation = WindowStartupLocation.CenterScreen
|
||||
};
|
||||
|
||||
var dialogResult = window.ShowDialog();
|
||||
|
||||
// 检查是否需要执行命令
|
||||
if (dialogResult == true && aim.ActiveCmd != null && aim.ActiveCmdItem != null)
|
||||
{
|
||||
// 调用AIM的ExecuteCommand方法来执行选中的命令
|
||||
return aim.ExecuteCommand(commandData, ref message, elements, true);
|
||||
}
|
||||
|
||||
return Result.Succeeded;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
message = ex.Message;
|
||||
return Result.Failed;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user