| | |
| | | using Autodesk.Revit.Attributes; |
| | | using Autodesk.Revit.DB; |
| | | using Autodesk.Revit.UI; |
| | | using HStation.RevitDev.RevitDataExport.Forms; |
| | | using Spire.AI.Api; |
| | | using System; |
| | | using System.Diagnostics; |
| | | using System.Drawing.Drawing2D; |
| | | using System.Windows.Controls; |
| | | using System.Windows.Forms; |
| | | |
| | | namespace HStation.RevitDev.RevitDataExport |
| | | { |
| | | [Transaction(TransactionMode.Manual)] |
| | | public class Export : IExternalCommand |
| | | { |
| | | public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements) |
| | | { |
| | | var form = new Form_SystemSelect(commandData); |
| | | //var revitHandle = Autodesk.Windows.ComponentManager.ApplicationWindow; |
| | | |
| | | //实例WPF窗体 |
| | | var revitHandle = Process.GetCurrentProcess().MainWindowHandle; |
| | | form.Show(new WindowHandle(revitHandle)); |
| | | |
| | | //测试代码 |
| | | UIApplication uiapp = commandData.Application; |
| | | Guid guid = new Guid(Common.GlobalResource.Guid_FamilyPanel); |
| | | DockablePaneId paneId = new DockablePaneId(guid); |
| | | DockablePane pane = uiapp.GetDockablePane(paneId); |
| | | pane.Hide(); |
| | | |
| | | return Result.Succeeded; |
| | | } |
| | | } |
| | | |
| | | [Transaction(TransactionMode.Manual)] |
| | | public class PumpSystemAnalysis : IExternalCommand |
| | | { |
| | | public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements) |
| | | { |
| | | TaskDialog.Show("提示","泵系统分析命令调用成功!"); |
| | | UIApplication uiapp = commandData.Application; |
| | | Wpf_FamilyPanel page = new Wpf_FamilyPanel(); |
| | | Guid guid = Guid.Empty; |
| | | guid = new Guid(Common.GlobalResource.Guid_FamilyPanel); |
| | | DockablePaneId paneId = new DockablePaneId(guid); |
| | | DockablePane pane = uiapp.GetDockablePane(paneId); |
| | | pane.Show(); |
| | | return Result.Succeeded; |
| | | } |
| | | } |
| | | |
| | | |
| | | public class WindowHandle : IWin32Window |
| | | { |
| | | private IntPtr _handle; |
| | | |
| | | public WindowHandle(IntPtr h) |
| | | { |
| | | Debug.Assert(IntPtr.Zero != h, "expected non-null window handle"); |
| | | |
| | | _handle = h; |
| | | } |
| | | public IntPtr Handle => _handle; |
| | | } |
| | | } |
| | | using Autodesk.Revit.Attributes;
|
| | | using Autodesk.Revit.DB;
|
| | | using Autodesk.Revit.UI;
|
| | | using DevExpress.Internal.WinApi.Windows.UI.Notifications;
|
| | | using DevExpress.Utils.Extensions;
|
| | | using DevExpress.XtraPrinting.Native;
|
| | | using Glodon.Revit.Utility;
|
| | | using HStation.RevitDev.Model.ModelEnum;
|
| | | using HStation.RevitDev.RevitDataExport.Common;
|
| | | using HStation.RevitDev.RevitDataExport.Forms;
|
| | | using HStation.RevitDev.RevitDataExport.Utility;
|
| | | using System;
|
| | | using System.Diagnostics;
|
| | | using System.IO;
|
| | | using System.Linq;
|
| | | using System.Text.RegularExpressions;
|
| | | using System.Windows.Forms;
|
| | |
|
| | | namespace HStation.RevitDev.RevitDataExport
|
| | | {
|
| | | /// <summary>
|
| | | /// 导入
|
| | | /// </summary>
|
| | | [Transaction(TransactionMode.Manual)]
|
| | | public class SystemSelect : IExternalCommand
|
| | | {
|
| | | public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
|
| | | {
|
| | | var form = new Form_SystemSelect(commandData);
|
| | | var revitHandle = Process.GetCurrentProcess().MainWindowHandle;
|
| | | form.Show(new WindowHandle(revitHandle));
|
| | | return Result.Succeeded;
|
| | | }
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 族库管理
|
| | | /// </summary>
|
| | | [Transaction(TransactionMode.Manual)]
|
| | | public class FamilyManager : IExternalCommand
|
| | | {
|
| | | public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
|
| | | {
|
| | | var form = new Form_FamilyManager(commandData);
|
| | | var revitHandle = Process.GetCurrentProcess().MainWindowHandle;
|
| | | form.ShowDialog(new WindowHandle(revitHandle));
|
| | | return Result.Succeeded;
|
| | | }
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 构件分类
|
| | | /// </summary>
|
| | | [Transaction(TransactionMode.Manual)]
|
| | | public class AutoClassified : IExternalCommand
|
| | | {
|
| | | public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
|
| | | {
|
| | | DocumentUtil.RegistViewEvent(commandData);
|
| | | DocumentUtil.RegistDocumentEvent(commandData);
|
| | | commandData.Application.ActiveUIDocument.Document.UpdataDocumentCache();
|
| | | GlobalResource.InstancePanel.UpdateForm();
|
| | | DockablePaneUtils.ShowInstancePanel(commandData);
|
| | | return Result.Succeeded;
|
| | | }
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 一键显隐
|
| | | /// </summary>
|
| | | [Transaction(TransactionMode.Manual)]
|
| | | public class HideModels : IExternalCommand
|
| | | {
|
| | | public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
|
| | | {
|
| | | var doc = commandData.Application.ActiveUIDocument.Document;
|
| | | commandData.Application.ActiveUIDocument.Document.UpdataDocumentCache();
|
| | | CacheUtil.HideOrShowModels(commandData.Application.ActiveUIDocument.Document);
|
| | | return Result.Succeeded;
|
| | | }
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 水力计算
|
| | | /// </summary>
|
| | | [Transaction(TransactionMode.Manual)]
|
| | | public class Analy : IExternalCommand
|
| | | {
|
| | | UIApplication m_uiapp = null;
|
| | | ExternalCommandData m_data = null;
|
| | | public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
|
| | | {
|
| | | var uiapp = commandData.Application;
|
| | | var doc = commandData.Application.ActiveUIDocument.Document;
|
| | | m_uiapp = uiapp;
|
| | | m_data = commandData;
|
| | |
|
| | | commandData.Application.ActiveUIDocument.Document.UpdataDocumentCache();
|
| | |
|
| | | var results = NetWorkHelper.Check(commandData);
|
| | | if (results.Any())
|
| | | {
|
| | | SystemCheckUtils.ShowCheckResult(m_uiapp, results);
|
| | | }
|
| | | else
|
| | | {
|
| | | var ml = NetWorkHelper.GetModelList(commandData);
|
| | | //var aa = NetWorkHelper.Check(ml, commandData);
|
| | | var inpPath = GlobalResource.TempInpFilePath;
|
| | | if (!File.Exists(inpPath))
|
| | | File.Create(inpPath).Close();
|
| | |
|
| | | try
|
| | | {
|
| | | ml.BuildRelation();
|
| | | ml.BuildToInp(inpPath);
|
| | | var result = NetWorkHelper.Calc(inpPath);
|
| | | using (var trans = new Transaction(doc, "修改属性"))
|
| | | {
|
| | | trans.Start();
|
| | | //result.ForEach(d =>
|
| | | foreach (var d in result)
|
| | | {
|
| | | var ut = "";
|
| | | if (!d.Key.Contains("_"))
|
| | | continue;
|
| | | try
|
| | | {
|
| | | var id = 0;
|
| | | var pid = d.Key.Split('_')[1];
|
| | | if (d.Key.Contains("E__") || d.Key.Contains("S__"))
|
| | | {
|
| | | pid = d.Key.Split('_')[3];
|
| | | }
|
| | | id = int.Parse(pid);
|
| | | var p = d.Key.Split('_')[0];
|
| | | var prop = "";
|
| | | switch (p)
|
| | | {
|
| | | case "Flow":
|
| | | prop = "流量";
|
| | | ut = " (m³/h)";
|
| | | break;
|
| | | case "Velocity":
|
| | | prop = "流速";
|
| | | ut = " (m/s)";
|
| | | break;
|
| | | case "Headloss":
|
| | | prop = "水损";
|
| | | ut = " (m)";
|
| | | break;
|
| | | case "Press":
|
| | | prop = "压力";
|
| | | ut = " (m)";
|
| | | break;
|
| | | //case "Head":
|
| | | // prop = "压力";
|
| | | // break;
|
| | | case "Demand":
|
| | | prop = "流量";
|
| | | ut = " (m³/h)";
|
| | | if (d.Key.Contains("S__"))
|
| | | {
|
| | | prop = "进口压力";
|
| | | ut = " (m)";
|
| | | }
|
| | | else if (d.Key.Contains("E__"))
|
| | | {
|
| | | prop = "出口压力";
|
| | | ut = " (m)";
|
| | | }
|
| | |
|
| | | break;
|
| | | }
|
| | | var vu = d.Value.ToString("0.000");
|
| | |
|
| | | var eid = new ElementId(id);
|
| | | var ele = doc.GetElement(eid);
|
| | | if (ele != null)
|
| | | {
|
| | | var pro = ele.GetParameterByProName(prop);
|
| | | if (pro != null)
|
| | | {
|
| | |
|
| | | if (prop.Equals("流量") && !vu.Contains("E"))
|
| | | vu = Math.Abs(decimal.Parse(vu)).ToString("0.000");
|
| | | if (pro != null && !pro.IsReadOnly && pro.StorageType == StorageType.String)
|
| | | {
|
| | | pro.Set(vu + ut);
|
| | | }
|
| | |
|
| | | var ps = ele.GetParameters(prop);
|
| | | if (ps != null)
|
| | | {
|
| | | var sp = ps.FirstOrDefault(c => !c.IsReadOnly && c.StorageType == StorageType.String);
|
| | | if (sp != null)
|
| | | sp.Set(vu + ut);
|
| | | }
|
| | |
|
| | |
|
| | | }
|
| | | }
|
| | | }
|
| | | catch (Exception ex)
|
| | | {
|
| | | var err = ex.Message;
|
| | | }
|
| | | };
|
| | |
|
| | | ml.pumps.ForEach(p =>
|
| | | {
|
| | | if (result.Any())
|
| | | {
|
| | | var p1 = result.FirstOrDefault(c => c.Key == "Press_" + p.Node1).Value;
|
| | | var p2 = result.FirstOrDefault(c => c.Key == "Press_" + p.Node2).Value;
|
| | |
|
| | | var eid = new ElementId(int.Parse(p.ID));
|
| | | var ele = doc.GetElement(eid);
|
| | | if (ele != null)
|
| | | {
|
| | | var pro1 = ele.GetParameterByProName("进口压力");
|
| | | var pro2 = ele.GetParameterByProName("出口压力");
|
| | | if (pro1 != null)
|
| | | pro1.Set(Math.Abs(p1) > Math.Abs(p2) ? Math.Abs(p2).ToString("0.000") + " (m)" : Math.Abs(p1).ToString("0.000") + " (m)");
|
| | | if (pro2 != null)
|
| | | pro2.Set(Math.Abs(p1) > Math.Abs(p2) ? Math.Abs(p1).ToString("0.000") + " (m)" : Math.Abs(p2).ToString("0.000") + " (m)");
|
| | |
|
| | | }
|
| | | }
|
| | | });
|
| | |
|
| | | trans.Commit();
|
| | | }
|
| | |
|
| | | TaskDialog.Show("提示", "计算成功!");
|
| | | }
|
| | | catch (Exception ex)
|
| | | {
|
| | | TaskDialog.Show("错误", "计算错误:" + ex.Message);
|
| | | }
|
| | | }
|
| | | return Result.Succeeded;
|
| | | }
|
| | |
|
| | |
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 其它一键显隐
|
| | | /// </summary>
|
| | | [Transaction(TransactionMode.Manual)]
|
| | | public class HideOtherModels : IExternalCommand
|
| | | {
|
| | | public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
|
| | | {
|
| | | var doc = commandData.Application.ActiveUIDocument.Document;
|
| | | commandData.Application.ActiveUIDocument.Document.UpdataDocumentCache();
|
| | | CacheUtil.HideOrShowOtherModels(commandData.Application.ActiveUIDocument.Document);
|
| | | return Result.Succeeded;
|
| | | }
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 系统检查
|
| | | /// </summary>
|
| | | [Transaction(TransactionMode.Manual)]
|
| | | public class SystemCheck : IExternalCommand
|
| | | {
|
| | | bool m_isFirstTrigger = true;
|
| | | UIApplication m_uiapp = null;
|
| | | ExternalCommandData m_data = null;
|
| | | public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
|
| | | {
|
| | | var uiapp = commandData.Application;
|
| | | var doc = commandData.Application.ActiveUIDocument.Document;
|
| | | m_uiapp = uiapp;
|
| | | m_data = commandData;
|
| | |
|
| | | doc.UpdataDocumentCache();
|
| | | var results = NetWorkHelper.Check(commandData);// SystemCheckUtils.SystemCheck(m_data);
|
| | | if (results != null && results.Any())
|
| | | SystemCheckUtils.ShowCheckResult(m_uiapp, results);
|
| | | else
|
| | | TaskDialog.Show("系统检查", "系统检查通过 !");
|
| | | //m_uiapp.Idling += App_Idling;
|
| | | //RevitCommandId id = RevitCommandId.LookupPostableCommandId(PostableCommand.ShowDisconnects);
|
| | | //if (uiapp.CanPostCommand(id))
|
| | | //{
|
| | | // uiapp.PostCommand(id);
|
| | | //}
|
| | |
|
| | | return Result.Succeeded;
|
| | | }
|
| | |
|
| | | //private void App_Idling(object sender, Autodesk.Revit.UI.Events.IdlingEventArgs e)
|
| | | //{
|
| | | // if (m_isFirstTrigger)
|
| | | // {
|
| | | // m_isFirstTrigger = false;
|
| | | // }
|
| | | // else
|
| | | // {
|
| | | // var results = SystemCheckUtils.SystemCheck(m_data);
|
| | | // SystemCheckUtils.ShowCheckResult(m_uiapp, results);
|
| | | // m_uiapp.Idling -= App_Idling;
|
| | | // m_isFirstTrigger = true;
|
| | | // }
|
| | | //}
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 导出模型
|
| | | /// </summary>
|
| | | [Transaction(TransactionMode.Manual)]
|
| | | public class ExportModels : IExternalCommand
|
| | | {
|
| | | public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
|
| | | {
|
| | | var doc = commandData.Application.ActiveUIDocument.Document;
|
| | | if (string.IsNullOrEmpty(doc.PathName))
|
| | | {
|
| | | TaskDialog.Show("提示", "请先保存模型后再进行导出操作!");
|
| | | return Result.Failed;
|
| | | }
|
| | | doc.UpdataDocumentCache();
|
| | |
|
| | | CacheUtil.SaveCache(commandData.Application.ActiveUIDocument.Document);
|
| | | var result = CacheUtil.ExportZipFile(doc, out string err);
|
| | | if (result)
|
| | | TaskDialog.Show("提示", "文件导出完成!");
|
| | | else TaskDialog.Show("提示", "导出失败," + err);
|
| | | return Result.Succeeded;
|
| | | }
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 上传模型
|
| | | /// </summary>
|
| | | [Transaction(TransactionMode.Manual)]
|
| | | public class UploadModels : IExternalCommand
|
| | | {
|
| | | public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
|
| | | {
|
| | | var doc = commandData.Application.ActiveUIDocument.Document;
|
| | | if (string.IsNullOrEmpty(doc.PathName))
|
| | | {
|
| | | TaskDialog.Show("提示", "请先保存模型后再进行导出操作!");
|
| | | return Result.Failed;
|
| | | }
|
| | | doc.UpdataDocumentCache();
|
| | |
|
| | | CacheUtil.SaveCache(commandData.Application.ActiveUIDocument.Document);
|
| | | var result = CacheUtil.UploadFile(doc, out string err);
|
| | | if (result)
|
| | | TaskDialog.Show("提示", "文件上传完成!");
|
| | | else TaskDialog.Show("提示", "上传失败," + err);
|
| | | return Result.Succeeded;
|
| | | }
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 帮助
|
| | | /// </summary>
|
| | | [Transaction(TransactionMode.Manual)]
|
| | | public class Help : IExternalCommand
|
| | | {
|
| | | public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
|
| | | {
|
| | | Process.Start(new ProcessStartInfo("https://www.yuque.com/yiweikeji-stofk/lu5dm6?#") { UseShellExecute = true });
|
| | | return Result.Succeeded;
|
| | | }
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 水泵
|
| | | /// </summary>
|
| | | [Transaction(TransactionMode.Manual)]
|
| | | public class PumpSystem : IExternalCommand
|
| | | {
|
| | | RevitType m_type = RevitType.RFT_Pump;
|
| | | public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
|
| | | {
|
| | | DocumentUtil.RegistDocumentEvent(commandData);
|
| | | DockablePaneUtils.ShowDockablePanel(commandData, m_type);
|
| | | return Result.Succeeded;
|
| | | }
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 管道
|
| | | /// </summary>
|
| | | [Transaction(TransactionMode.Manual)]
|
| | | public class PipeSystem : IExternalCommand
|
| | | {
|
| | | RevitType m_type = RevitType.RFT_Pipe;
|
| | | public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
|
| | | {
|
| | | GlobalResource.CurrentAddinId = commandData.Application.ActiveAddInId;
|
| | | DocumentUtil.RegistDocumentEvent(commandData);
|
| | | DockablePaneUtils.ShowDockablePanel(commandData, m_type);
|
| | | return Result.Succeeded;
|
| | | }
|
| | | }
|
| | |
|
| | |
|
| | |
|
| | | /// <summary>
|
| | | /// 阀门
|
| | | /// </summary>
|
| | | [Transaction(TransactionMode.Manual)]
|
| | | public class ValveSystem : IExternalCommand
|
| | | {
|
| | | RevitType m_type = RevitType.RFT_Valve;
|
| | | public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
|
| | | {
|
| | | DocumentUtil.RegistDocumentEvent(commandData);
|
| | | DockablePaneUtils.ShowDockablePanel(commandData, m_type);
|
| | | return Result.Succeeded;
|
| | | }
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 换热器
|
| | | /// </summary>
|
| | | [Transaction(TransactionMode.Manual)]
|
| | | public class HeatExchangerSystem : IExternalCommand
|
| | | {
|
| | | RevitType m_type = RevitType.RFT_HeatExchanger;
|
| | | public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
|
| | | {
|
| | | DocumentUtil.RegistDocumentEvent(commandData);
|
| | | DockablePaneUtils.ShowDockablePanel(commandData, m_type);
|
| | | return Result.Succeeded;
|
| | | }
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 空压机
|
| | | /// </summary>
|
| | | [Transaction(TransactionMode.Manual)]
|
| | | public class WindTurbineSystem : IExternalCommand
|
| | | {
|
| | | RevitType m_type = RevitType.RFT_WindTurbine;
|
| | | public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
|
| | | {
|
| | | DocumentUtil.RegistDocumentEvent(commandData);
|
| | | DockablePaneUtils.ShowDockablePanel(commandData, m_type);
|
| | | return Result.Succeeded;
|
| | | }
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 闷头
|
| | | /// </summary>
|
| | | [Transaction(TransactionMode.Manual)]
|
| | | public class BlockerSystem : IExternalCommand
|
| | | {
|
| | | RevitType m_type = RevitType.RFT_Blocker;
|
| | | public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
|
| | | {
|
| | | DocumentUtil.RegistDocumentEvent(commandData);
|
| | | DockablePaneUtils.ShowDockablePanel(commandData, m_type);
|
| | | return Result.Succeeded;
|
| | | }
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 喷淋头
|
| | | /// </summary>
|
| | | [Transaction(TransactionMode.Manual)]
|
| | | public class ShowerSystem : IExternalCommand
|
| | | {
|
| | | RevitType m_type = RevitType.RFT_Shower;
|
| | | public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
|
| | | {
|
| | | DocumentUtil.RegistDocumentEvent(commandData);
|
| | | DockablePaneUtils.ShowDockablePanel(commandData, m_type);
|
| | | return Result.Succeeded;
|
| | | }
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 三通
|
| | | /// </summary>
|
| | | [Transaction(TransactionMode.Manual)]
|
| | | public class ThreeJointSystem : IExternalCommand
|
| | | {
|
| | | RevitType m_type = RevitType.RFT_ThreeJoint;
|
| | | public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
|
| | | {
|
| | | DocumentUtil.RegistDocumentEvent(commandData);
|
| | | DockablePaneUtils.ShowDockablePanel(commandData, m_type);
|
| | | return Result.Succeeded;
|
| | | }
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 四通
|
| | | /// </summary>
|
| | | [Transaction(TransactionMode.Manual)]
|
| | | public class FourJointSystem : IExternalCommand
|
| | | {
|
| | | RevitType m_type = RevitType.RFT_FourJoint;
|
| | | public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
|
| | | {
|
| | | DocumentUtil.RegistDocumentEvent(commandData);
|
| | | DockablePaneUtils.ShowDockablePanel(commandData, m_type);
|
| | | return Result.Succeeded;
|
| | | }
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 水表
|
| | | /// </summary>
|
| | | [Transaction(TransactionMode.Manual)]
|
| | | public class WaterMeterSystem : IExternalCommand
|
| | | {
|
| | | RevitType m_type = RevitType.RFT_WaterMeter;
|
| | | public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
|
| | | {
|
| | | DocumentUtil.RegistDocumentEvent(commandData);
|
| | | DockablePaneUtils.ShowDockablePanel(commandData, m_type);
|
| | | return Result.Succeeded;
|
| | | }
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 水库
|
| | | /// </summary>
|
| | | [Transaction(TransactionMode.Manual)]
|
| | | public class WaterPoolSystem : IExternalCommand
|
| | | {
|
| | | RevitType m_type = RevitType.RFT_WaterPool;
|
| | | public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
|
| | | {
|
| | | DocumentUtil.RegistDocumentEvent(commandData);
|
| | | DockablePaneUtils.ShowDockablePanel(commandData, m_type);
|
| | | return Result.Succeeded;
|
| | | }
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 水箱
|
| | | /// </summary>
|
| | | [Transaction(TransactionMode.Manual)]
|
| | | public class WaterBoxSystem : IExternalCommand
|
| | | {
|
| | | RevitType m_type = RevitType.RFT_WaterBox;
|
| | | public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
|
| | | {
|
| | | DocumentUtil.RegistDocumentEvent(commandData);
|
| | | DockablePaneUtils.ShowDockablePanel(commandData, m_type);
|
| | | return Result.Succeeded;
|
| | | }
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 弯头
|
| | | /// </summary>
|
| | | [Transaction(TransactionMode.Manual)]
|
| | | public class ElbowSystem : IExternalCommand
|
| | | {
|
| | | RevitType m_type = RevitType.RFT_Elbow;
|
| | | public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
|
| | | {
|
| | | DocumentUtil.RegistDocumentEvent(commandData);
|
| | | DockablePaneUtils.ShowDockablePanel(commandData, m_type);
|
| | | return Result.Succeeded;
|
| | | }
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 消火栓
|
| | | /// </summary>
|
| | | [Transaction(TransactionMode.Manual)]
|
| | | public class FireHydrantSystem : IExternalCommand
|
| | | {
|
| | | RevitType m_type = RevitType.RFT_FireHydrant;
|
| | | public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
|
| | | {
|
| | | DocumentUtil.RegistDocumentEvent(commandData);
|
| | | DockablePaneUtils.ShowDockablePanel(commandData, m_type);
|
| | | return Result.Succeeded;
|
| | | }
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 过渡件
|
| | | /// </summary>
|
| | | [Transaction(TransactionMode.Manual)]
|
| | | public class ReducingSystem : IExternalCommand
|
| | | {
|
| | | RevitType m_type = RevitType.RFT_Converter;
|
| | | public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
|
| | | {
|
| | | DocumentUtil.RegistDocumentEvent(commandData);
|
| | | DockablePaneUtils.ShowDockablePanel(commandData, m_type);
|
| | | return Result.Succeeded;
|
| | | }
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 自定义
|
| | | /// </summary>
|
| | | [Transaction(TransactionMode.Manual)]
|
| | | public class CustomizeSystem : IExternalCommand
|
| | | {
|
| | | RevitType m_type = RevitType.RFT_Customize;
|
| | | public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
|
| | | {
|
| | | GlobalResource.CurrentAddinId = commandData.Application.ActiveAddInId;
|
| | | DocumentUtil.RegistDocumentEvent(commandData);
|
| | | DockablePaneUtils.ShowDockablePanel(commandData, m_type);
|
| | | return Result.Succeeded;
|
| | | }
|
| | | }
|
| | |
|
| | | public class WindowHandle : IWin32Window
|
| | | {
|
| | | private IntPtr _handle;
|
| | |
|
| | | public WindowHandle(IntPtr h)
|
| | | {
|
| | | Debug.Assert(IntPtr.Zero != h, "expected non-null window handle");
|
| | |
|
| | | _handle = h;
|
| | | }
|
| | | public IntPtr Handle => _handle;
|
| | | }
|
| | | }
|