| | |
| | | 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;
|
| | |
| | | }
|
| | | else
|
| | | {
|
| | | GlobalResource.InstancePlacing = false;
|
| | | GlobalResource.PlacingType = Model.ModelEnum.RevitType.RFT_Unknown;
|
| | | m_app.Idling -= App_Idling;
|
| | | m_isFirstTrigger = true;
|
| | | }
|
| | |
| | | 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));
|
| | |
| | | }
|
| | | else
|
| | | {
|
| | | GlobalResource.PipePlacing = false;
|
| | | GlobalResource.PlacingType = Model.ModelEnum.RevitType.RFT_Unknown;
|
| | | m_app.Idling -= App_Idling;
|
| | | m_isFirstTrigger = true;
|
| | | }
|
| | |
| | | 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
|
| | | {
|
| | |
|
| | | }
|
| | | } |
| | | } |
| | | }
|
| | | }
|