46 lines
1.7 KiB
C#
46 lines
1.7 KiB
C#
using System;
|
||
using System.Windows.Interop;
|
||
using Autodesk.Revit.Attributes;
|
||
using Autodesk.Revit.DB;
|
||
using Autodesk.Revit.UI;
|
||
using Sai.RvKits.IO;
|
||
using Sai.RvKits.Operation;
|
||
using SZBIM.StandardTools;
|
||
using SZBIM.StandardTools.ParameterManager;
|
||
|
||
namespace Sai.Common.Shared.ParameterManager
|
||
{
|
||
[Transaction(TransactionMode.Manual)]
|
||
[Regeneration(RegenerationOption.Manual)]
|
||
public class RemoveParamsCmd : IExternalCommand
|
||
{
|
||
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
|
||
{
|
||
//程序UI界面
|
||
UIApplication uiapp = commandData.Application;
|
||
//获取元素(选择) 显示元素 视图(活动视图)管理(对象)
|
||
UIDocument uidoc = uiapp.ActiveUIDocument;
|
||
//获取位置和场地 视图(多个视图)管理 获取元素(Revit 项目里的全部元素)
|
||
Document doc = uidoc.Document;
|
||
//当前视图
|
||
View view = doc.ActiveView;
|
||
var deleteElementsParamEventHandler = new RemoveParamsEventHandler();
|
||
var deleteElementsParamEvent = ExternalEvent.Create(deleteElementsParamEventHandler);
|
||
try
|
||
{
|
||
var win = RemoveParamsWin.Default;
|
||
|
||
_ = new WindowInteropHelper(win)
|
||
{
|
||
Owner = System.Diagnostics.Process.GetCurrentProcess().MainWindowHandle
|
||
};
|
||
win.Show();
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
LogUtil.WriteLog(ex.Message, RelativePaths.LogFolder);
|
||
}
|
||
return Result.Succeeded;
|
||
}
|
||
}
|
||
} |