| | |
| | | using Autodesk.Revit.Attributes; |
| | | using Autodesk.Revit.DB; |
| | | using Autodesk.Revit.DB.Plumbing; |
| | | using Autodesk.Revit.UI; |
| | | using HStation.RevitDev.RevitDataExport.Common; |
| | | using HStation.RevitDev.RevitDataExport.Enum; |
| | | using HStation.RevitDev.RevitDataExport.Forms; |
| | | using HStation.RevitDev.RevitDataExport.Utility; |
| | | using Spire.AI.Api; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | 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)); |
| | | return Result.Succeeded; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 水泵 |
| | | /// </summary> |
| | | [Transaction(TransactionMode.Manual)] |
| | | public class PumpSystem : IExternalCommand |
| | | { |
| | | YWFamilyType m_type = YWFamilyType.YWFT_Pump; |
| | | public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements) |
| | | { |
| | | ExternalCommandUtils.ShowDockablePanel(commandData, m_type); |
| | | return Result.Succeeded; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 管道 |
| | | /// </summary> |
| | | [Transaction(TransactionMode.Manual)] |
| | | public class PipeSystem : IExternalCommand |
| | | { |
| | | YWFamilyType m_type = YWFamilyType.YWFT_Pipe; |
| | | public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements) |
| | | { |
| | | ExternalCommandUtils.ShowDockablePanel(commandData, m_type); |
| | | return Result.Succeeded; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 阀门 |
| | | /// </summary> |
| | | [Transaction(TransactionMode.Manual)] |
| | | public class ValveSystem : IExternalCommand |
| | | { |
| | | YWFamilyType m_type = YWFamilyType.YWFT_Valve; |
| | | public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements) |
| | | { |
| | | ExternalCommandUtils.ShowDockablePanel(commandData, m_type); |
| | | return Result.Succeeded; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 换热气 |
| | | /// </summary> |
| | | [Transaction(TransactionMode.Manual)] |
| | | public class HeatExchangerSystem : IExternalCommand |
| | | { |
| | | YWFamilyType m_type = YWFamilyType.YWFT_Heat_Exchanger; |
| | | public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements) |
| | | { |
| | | ExternalCommandUtils.ShowDockablePanel(commandData, m_type); |
| | | return Result.Succeeded; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 闷头 |
| | | /// </summary> |
| | | [Transaction(TransactionMode.Manual)] |
| | | public class BlockerSystem : IExternalCommand |
| | | { |
| | | YWFamilyType m_type = YWFamilyType.YWFT_Blocker; |
| | | public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements) |
| | | { |
| | | ExternalCommandUtils.ShowDockablePanel(commandData, m_type); |
| | | return Result.Succeeded; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 喷淋头 |
| | | /// </summary> |
| | | [Transaction(TransactionMode.Manual)] |
| | | public class ShowerSystem : IExternalCommand |
| | | { |
| | | YWFamilyType m_type = YWFamilyType.YWFT_Shower; |
| | | public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements) |
| | | { |
| | | ExternalCommandUtils.ShowDockablePanel(commandData, m_type); |
| | | return Result.Succeeded; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 三通 |
| | | /// </summary> |
| | | [Transaction(TransactionMode.Manual)] |
| | | public class ThreeJointSystem : IExternalCommand |
| | | { |
| | | YWFamilyType m_type = YWFamilyType.YWFT_Three_Joint; |
| | | public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements) |
| | | { |
| | | ExternalCommandUtils.ShowDockablePanel(commandData, m_type); |
| | | return Result.Succeeded; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 四通 |
| | | /// </summary> |
| | | [Transaction(TransactionMode.Manual)] |
| | | public class FourJointSystem : IExternalCommand |
| | | { |
| | | YWFamilyType m_type = YWFamilyType.YWFT_Four_Joint; |
| | | public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements) |
| | | { |
| | | ExternalCommandUtils.ShowDockablePanel(commandData, m_type); |
| | | return Result.Succeeded; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 水表 |
| | | /// </summary> |
| | | [Transaction(TransactionMode.Manual)] |
| | | public class WaterMeterSystem : IExternalCommand |
| | | { |
| | | YWFamilyType m_type = YWFamilyType.YWFT_Water_Meter; |
| | | public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements) |
| | | { |
| | | ExternalCommandUtils.ShowDockablePanel(commandData, m_type); |
| | | return Result.Succeeded; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 水库 |
| | | /// </summary> |
| | | [Transaction(TransactionMode.Manual)] |
| | | public class WaterPoolSystem : IExternalCommand |
| | | { |
| | | YWFamilyType m_type = YWFamilyType.YWFT_Water_Pool; |
| | | public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements) |
| | | { |
| | | ExternalCommandUtils.ShowDockablePanel(commandData, m_type); |
| | | return Result.Succeeded; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 水箱 |
| | | /// </summary> |
| | | [Transaction(TransactionMode.Manual)] |
| | | public class WaterBoxSystem : IExternalCommand |
| | | { |
| | | YWFamilyType m_type = YWFamilyType.YWFT_Water_Box; |
| | | public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements) |
| | | { |
| | | ExternalCommandUtils.ShowDockablePanel(commandData, m_type); |
| | | return Result.Succeeded; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 弯头 |
| | | /// </summary> |
| | | [Transaction(TransactionMode.Manual)] |
| | | public class ElbowSystem : IExternalCommand |
| | | { |
| | | YWFamilyType m_type = YWFamilyType.YWFT_Elbow; |
| | | public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements) |
| | | { |
| | | ExternalCommandUtils.ShowDockablePanel(commandData, m_type); |
| | | return Result.Succeeded; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 弯头 |
| | | /// </summary> |
| | | [Transaction(TransactionMode.Manual)] |
| | | public class FireHydrantSystem : IExternalCommand |
| | | { |
| | | YWFamilyType m_type = YWFamilyType.YWFT_Fire_Hydrant; |
| | | public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements) |
| | | { |
| | | ExternalCommandUtils.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; |
| | | } |
| | | } |
| | | using Autodesk.Revit.Attributes;
|
| | | using Autodesk.Revit.DB;
|
| | | using Autodesk.Revit.UI;
|
| | | 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.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.Show(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);
|
| | | DockablePaneUtils.ShowInstancePanel(commandData);
|
| | | GlobalResource.InstancePanel.UpdateForm();
|
| | | 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;
|
| | | CacheUtil.HideOrShowModels(commandData.Application.ActiveUIDocument.Document);
|
| | | return Result.Succeeded;
|
| | | }
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 系统检查
|
| | | /// </summary>
|
| | | [Transaction(TransactionMode.Manual)]
|
| | | public class SystemCheck : IExternalCommand
|
| | | {
|
| | | public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
|
| | | {
|
| | | var doc = commandData.Application.ActiveUIDocument.Document;
|
| | | SystemCheckUtils.SystemCheck(commandData);
|
| | | return Result.Succeeded;
|
| | | }
|
| | | }
|
| | |
|
| | | /// <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;
|
| | |
|
| | | CacheUtil.SaveCache(commandData.Application.ActiveUIDocument.Document);
|
| | | TaskDialog.Show("提示", "导出完成!");
|
| | | 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)
|
| | | {
|
| | | Common.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 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;
|
| | | }
|
| | | }
|
| | |
|
| | | 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;
|
| | | }
|
| | | }
|