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)
|
{
|
DocumentUtil.RegistDocumentEvent(commandData.Application.Application);
|
DockablePaneUtils.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)
|
{
|
Common.GlobalResource.CurrentAddinId = commandData.Application.ActiveAddInId;
|
DocumentUtil.RegistDocumentEvent(commandData.Application.Application);
|
DockablePaneUtils.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)
|
{
|
DocumentUtil.RegistDocumentEvent(commandData.Application.Application);
|
DockablePaneUtils.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)
|
{
|
DocumentUtil.RegistDocumentEvent(commandData.Application.Application);
|
DockablePaneUtils.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)
|
{
|
DocumentUtil.RegistDocumentEvent(commandData.Application.Application);
|
DockablePaneUtils.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)
|
{
|
DocumentUtil.RegistDocumentEvent(commandData.Application.Application);
|
DockablePaneUtils.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)
|
{
|
DocumentUtil.RegistDocumentEvent(commandData.Application.Application);
|
DockablePaneUtils.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)
|
{
|
DocumentUtil.RegistDocumentEvent(commandData.Application.Application);
|
DockablePaneUtils.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)
|
{
|
DocumentUtil.RegistDocumentEvent(commandData.Application.Application);
|
DockablePaneUtils.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)
|
{
|
DocumentUtil.RegistDocumentEvent(commandData.Application.Application);
|
DockablePaneUtils.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)
|
{
|
DocumentUtil.RegistDocumentEvent(commandData.Application.Application);
|
DockablePaneUtils.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)
|
{
|
DocumentUtil.RegistDocumentEvent(commandData.Application.Application);
|
DockablePaneUtils.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)
|
{
|
DocumentUtil.RegistDocumentEvent(commandData.Application.Application);
|
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;
|
}
|
}
|