From e358beb08f5be49703009b64f058ecfbcfeefbd9 Mon Sep 17 00:00:00 2001 From: qin <a@163.com> Date: 星期六, 28 九月 2024 14:27:52 +0800 Subject: [PATCH] 测试standard2.1 --- HStation.RevitDev/RevitDataExport/Entity/ExternalEvent.cs | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 53 insertions(+), 3 deletions(-) diff --git a/HStation.RevitDev/RevitDataExport/Entity/ExternalEvent.cs b/HStation.RevitDev/RevitDataExport/Entity/ExternalEvent.cs index 50ed6c8..2eab615 100644 --- a/HStation.RevitDev/RevitDataExport/Entity/ExternalEvent.cs +++ b/HStation.RevitDev/RevitDataExport/Entity/ExternalEvent.cs @@ -3,6 +3,7 @@ using HStation.RevitDev.RevitDataExport.Common; using HStation.RevitDev.RevitDataExport.Service; using System; +using System.Collections.Generic; using System.IO; using System.Linq; using System.Windows; @@ -41,7 +42,7 @@ } else { - GlobalResource.InstancePlacing = false; + GlobalResource.PlacingType = Model.ModelEnum.RevitType.RFT_Unknown; m_app.Idling -= App_Idling; m_isFirstTrigger = true; } @@ -73,7 +74,7 @@ trans.Start(); try { - if (!doc.LoadFamily(RfaPath, new FamilyLoadOption(), out family)) + if (!doc.LoadFamily(RfaPath, new ProjectLoadOption(), out family)) { //璇存槑鏂囨。涓凡缁忓瓨鍦�, 闇�瑕佹悳绱㈡暣涓枃妗� var elems = SearchService.SearchElements(doc, typeof(Family), Path.GetFileNameWithoutExtension(RfaPath)); @@ -136,7 +137,7 @@ } else { - GlobalResource.PipePlacing = false; + GlobalResource.PlacingType = Model.ModelEnum.RevitType.RFT_Unknown; m_app.Idling -= App_Idling; m_isFirstTrigger = true; } @@ -147,4 +148,53 @@ return "Create Pipe"; } } + + public class ExternalEvent_SelectElement : IExternalEventHandler + { + UIApplication m_uiapp = null; + public static string m_id = null; + + public void Execute(UIApplication app) + { + m_uiapp = app; + if (string.IsNullOrEmpty(m_id)) { return; } + var id = new ElementId(int.Parse(m_id)); + m_uiapp.ActiveUIDocument.Selection.SetElementIds(new List<ElementId> { id }); + m_uiapp.ActiveUIDocument.ShowElements(id); + } + + public string GetName() + { + return "Select Element"; + } + } + + public class ExternalEvent_Execute : IExternalEventHandler + { + public ExternalEvent_Execute(string name) + { + Name = name; + } + public string Name { get; private set; } + public Action<UIApplication> ExecuteAction { get; set; } + public string GetName() + { + return Name; + } + + public void Execute(UIApplication app) + { + if (ExecuteAction != null) + { + try + { + ExecuteAction(app); + } + catch + { + + } + } + } + } } -- Gitblit v1.9.3