Revit使用WinForm和WPF编程范式
作者:互联网
Revit使用WinForm和WPF编程范式:
1、程序入口
[Autodesk.Revit.Attributes.Transaction(Autodesk.Revit.Attributes.TransactionMode.Manual)] [Autodesk.Revit.Attributes.Regeneration(Autodesk.Revit.Attributes.RegenerationOption.Manual)] [Autodesk.Revit.Attributes.Journaling(Autodesk.Revit.Attributes.JournalingMode.NoCommandData)] public class Command : IExternalCommand { public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements) { try { // create a form to display the information of view filters using (ViewFiltersForm infoForm = new ViewFiltersForm(commandData)) { infoForm.ShowDialog(); } return Result.Succeeded; } catch (Exception ex) { // If there is something wrong, give error information and return failed message = ex.Message; return Result.Failed; } } }View Code
2、窗口接口
public ViewFiltersForm(Autodesk.Revit.UI.ExternalCommandData commandData) { InitializeComponent(); m_doc = commandData.Application.ActiveUIDocument.Document; }View Code
如果使用MVVM模式
可加入Mode层、Repository层、和VM层
标签:return,Autodesk,commandData,public,Attributes,WPF,Revit,WinForm 来源: https://www.cnblogs.com/liuxinyong/p/14867975.html