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;
}
}
///
/// 水泵
///
[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;
}
}
///
/// 管道
///
[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;
}
}
///
/// 阀门
///
[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;
}
}
///
/// 换热气
///
[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;
}
}
///
/// 闷头
///
[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;
}
}
///
/// 喷淋头
///
[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;
}
}
///
/// 三通
///
[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;
}
}
///
/// 四通
///
[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;
}
}
///
/// 水表
///
[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;
}
}
///
/// 水库
///
[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;
}
}
///
/// 水箱
///
[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;
}
}
///
/// 弯头
///
[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;
}
}
///
/// 弯头
///
[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;
}
}