zhangyk-c
2024-07-30 e5b04afb7062a908c700f66a1a33aaa5eb98b7bb
HStation.RevitDev/RevitDataExport/Plugin/Command.cs
@@ -1,17 +1,13 @@
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.Model;
using HStation.RevitDev.Model.ModelEnum;
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.IO;
using System.Windows.Forms;
namespace HStation.RevitDev.RevitDataExport
@@ -32,12 +28,28 @@
    }
    /// <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
    {
        YWFamilyType m_type = YWFamilyType.YWFT_Pump;
        RevitType m_type = RevitType.RFT_Pump;
        public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
        {
            DocumentUtil.RegistDocumentEvent(commandData.Application.Application);
@@ -52,7 +64,7 @@
    [Transaction(TransactionMode.Manual)]
    public class PipeSystem : IExternalCommand
    {
        YWFamilyType m_type = YWFamilyType.YWFT_Pipe;
        RevitType m_type = RevitType.RFT_Pipe;
        public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
        {
            Common.GlobalResource.CurrentAddinId = commandData.Application.ActiveAddInId;
@@ -68,7 +80,7 @@
    [Transaction(TransactionMode.Manual)]
    public class ValveSystem : IExternalCommand
    {
        YWFamilyType m_type = YWFamilyType.YWFT_Valve;
        RevitType m_type = RevitType.RFT_Valve;
        public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
        {
            DocumentUtil.RegistDocumentEvent(commandData.Application.Application);
@@ -83,7 +95,7 @@
    [Transaction(TransactionMode.Manual)]
    public class HeatExchangerSystem : IExternalCommand
    {
        YWFamilyType m_type = YWFamilyType.YWFT_Heat_Exchanger;
        RevitType m_type = RevitType.RFT_HeatExchanger;
        public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
        {
            DocumentUtil.RegistDocumentEvent(commandData.Application.Application);
@@ -98,7 +110,7 @@
    [Transaction(TransactionMode.Manual)]
    public class BlockerSystem : IExternalCommand
    {
        YWFamilyType m_type = YWFamilyType.YWFT_Blocker;
        RevitType m_type = RevitType.RFT_Blocker;
        public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
        {
            DocumentUtil.RegistDocumentEvent(commandData.Application.Application);
@@ -113,7 +125,7 @@
    [Transaction(TransactionMode.Manual)]
    public class ShowerSystem : IExternalCommand
    {
        YWFamilyType m_type = YWFamilyType.YWFT_Shower;
        RevitType m_type = RevitType.RFT_Shower;
        public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
        {
            DocumentUtil.RegistDocumentEvent(commandData.Application.Application);
@@ -128,7 +140,7 @@
    [Transaction(TransactionMode.Manual)]
    public class ThreeJointSystem : IExternalCommand
    {
        YWFamilyType m_type = YWFamilyType.YWFT_Three_Joint;
        RevitType m_type = RevitType.RFT_ThreeJoint;
        public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
        {
            DocumentUtil.RegistDocumentEvent(commandData.Application.Application);
@@ -143,7 +155,7 @@
    [Transaction(TransactionMode.Manual)]
    public class FourJointSystem : IExternalCommand
    {
        YWFamilyType m_type = YWFamilyType.YWFT_Four_Joint;
        RevitType m_type = RevitType.RFT_FourJoint;
        public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
        {
            DocumentUtil.RegistDocumentEvent(commandData.Application.Application);
@@ -158,7 +170,7 @@
    [Transaction(TransactionMode.Manual)]
    public class WaterMeterSystem : IExternalCommand
    {
        YWFamilyType m_type = YWFamilyType.YWFT_Water_Meter;
        RevitType m_type = RevitType.RFT_WaterMeter;
        public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
        {
            DocumentUtil.RegistDocumentEvent(commandData.Application.Application);
@@ -173,7 +185,7 @@
    [Transaction(TransactionMode.Manual)]
    public class WaterPoolSystem : IExternalCommand
    {
        YWFamilyType m_type = YWFamilyType.YWFT_Water_Pool;
        RevitType m_type = RevitType.RFT_WaterPool;
        public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
        {
            DocumentUtil.RegistDocumentEvent(commandData.Application.Application);
@@ -188,7 +200,7 @@
    [Transaction(TransactionMode.Manual)]
    public class WaterBoxSystem : IExternalCommand
    {
        YWFamilyType m_type = YWFamilyType.YWFT_Water_Box;
        RevitType m_type = RevitType.RFT_WaterBox;
        public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
        {
            DocumentUtil.RegistDocumentEvent(commandData.Application.Application);
@@ -203,7 +215,7 @@
    [Transaction(TransactionMode.Manual)]
    public class ElbowSystem : IExternalCommand
    {
        YWFamilyType m_type = YWFamilyType.YWFT_Elbow;
        RevitType m_type = RevitType.RFT_Elbow;
        public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
        {
            DocumentUtil.RegistDocumentEvent(commandData.Application.Application);
@@ -218,7 +230,22 @@
    [Transaction(TransactionMode.Manual)]
    public class FireHydrantSystem : IExternalCommand
    {
        YWFamilyType m_type = YWFamilyType.YWFT_Fire_Hydrant;
        RevitType m_type = RevitType.RFT_FireHydrant;
        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 ReducingSystem : IExternalCommand
    {
        RevitType m_type = RevitType.RFT_Reducing;
        public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
        {
            DocumentUtil.RegistDocumentEvent(commandData.Application.Application);