Browse Source

mxg:添加下载代理

mengxiangge 6 years ago
parent
commit
53093bdc3f

+ 63 - 0
.gitattributes

@@ -0,0 +1,63 @@
+###############################################################################
+# Set default behavior to automatically normalize line endings.
+###############################################################################
+* text=auto
+
+###############################################################################
+# Set default behavior for command prompt diff.
+#
+# This is need for earlier builds of msysgit that does not have it on by
+# default for csharp files.
+# Note: This is only used by command line
+###############################################################################
+#*.cs     diff=csharp
+
+###############################################################################
+# Set the merge driver for project and solution files
+#
+# Merging from the command prompt will add diff markers to the files if there
+# are conflicts (Merging from VS is not affected by the settings below, in VS
+# the diff markers are never inserted). Diff markers may cause the following 
+# file extensions to fail to load in VS. An alternative would be to treat
+# these files as binary and thus will always conflict and require user
+# intervention with every merge. To do so, just uncomment the entries below
+###############################################################################
+#*.sln       merge=binary
+#*.csproj    merge=binary
+#*.vbproj    merge=binary
+#*.vcxproj   merge=binary
+#*.vcproj    merge=binary
+#*.dbproj    merge=binary
+#*.fsproj    merge=binary
+#*.lsproj    merge=binary
+#*.wixproj   merge=binary
+#*.modelproj merge=binary
+#*.sqlproj   merge=binary
+#*.wwaproj   merge=binary
+
+###############################################################################
+# behavior for image files
+#
+# image files are treated as binary by default.
+###############################################################################
+#*.jpg   binary
+#*.png   binary
+#*.gif   binary
+
+###############################################################################
+# diff behavior for common document formats
+# 
+# Convert binary document formats to text before diffing them. This feature
+# is only available from the command line. Turn it on by uncommenting the 
+# entries below.
+###############################################################################
+#*.doc   diff=astextplain
+#*.DOC   diff=astextplain
+#*.docx  diff=astextplain
+#*.DOCX  diff=astextplain
+#*.dot   diff=astextplain
+#*.DOT   diff=astextplain
+#*.pdf   diff=astextplain
+#*.PDF   diff=astextplain
+#*.rtf   diff=astextplain
+#*.RTF   diff=astextplain

+ 1 - 0
MBI/.gitignore

@@ -0,0 +1 @@
+TestCommand

+ 2 - 0
MBI/MBIResource/Config/HttpSetting.ini

@@ -13,3 +13,5 @@ FileAddress = http://service.sagacloud.cn:28888
 H5Address = http://mbi.sagacloud.cn:8889/#
 Html5DetailLocalHost = http://mbi.sagacloud.cn:8889/#/
 Html5ImageLocalHost = http://mbi.sagacloud.cn:8890/
+ProxyHost=218.60.8.98
+ProxyPort=3129

BIN
MBI/MBIResource/Family/占位符.rfa


+ 13 - 37
MBI/Menu/MBITool.xml

@@ -4,7 +4,7 @@
     <AppIndex>1</AppIndex>
     <AppName>SAGA</AppName>
   </App>
-  <Tab TabName="工具">
+  <Tab TabName="MBI工具">
     <MenuTab>MBITool_W</MenuTab>
     <Modules>MBITool</Modules>
   </Tab>
@@ -111,20 +111,8 @@
   </Panel>
   <Panel PanelName="工具" GroupFlag="True" GroupImage="" RevitVer="R14,R15,R16,R17"  ButtonStyles="Large">
     <Button ButtonStyles="Stacked">
-      <ButtonName>SAGA.MBI.CopyLocalIdCommand</ButtonName>
-      <ButtonText>复制设备编号的值</ButtonText>
-      <ImageName>1、打开楼层模型</ImageName>
-      <DllName>..\OutputDll\SAGA.MBI.exe</DllName>
-      <ClassName>SAGA.MBI.CopyLocalIdCommand</ClassName>
-      <ToolTip>将设备编号的值复制到设备本地编码中。</ToolTip>
-      <LongDescription>将设备编号的值复制到设备本地编码中,结果将列出本层复制失败的对象的id,如果本层都复制成功则没有提示。</LongDescription>
-      <ToolTipImage></ToolTipImage>
-      <MenuTab>MBITool_W</MenuTab>
-      <Modules>MBITool</Modules>
-    </Button>
-    <Button ButtonStyles="Stacked">
       <ButtonName>SAGA.MBI.DeleteZeroSpaceCommand</ButtonName>
-      <ButtonText>删除本层Zero空间</ButtonText>
+      <ButtonText>删除Zero空间</ButtonText>
       <ImageName>1、打开楼层模型</ImageName>
       <DllName>..\OutputDll\SAGA.MBI.exe</DllName>
       <ClassName>SAGA.MBI.DeleteZeroSpaceCommand</ClassName>
@@ -136,26 +124,25 @@
     </Button>
 
     <Button ButtonStyles="Stacked">
-      <ButtonName>SAGA.MBI.ExportCategoriesCommand</ButtonName>
-      <ButtonText>导出所有的设备类别</ButtonText>
+      <ButtonName>SAGA.MBI.ReportEquipInSpaceCommand</ButtonName>
+      <ButtonText>查询设备所在的空间</ButtonText>
       <ImageName>1、打开楼层模型</ImageName>
       <DllName>..\OutputDll\SAGA.MBI.exe</DllName>
-      <ClassName>SAGA.MBI.ExportCategoriesCommand</ClassName>
-      <ToolTip>更新设备所在楼层关系。</ToolTip>
-      <LongDescription>更新设备所在楼层关系。</LongDescription>
+      <ClassName>SAGA.MBI.ReportEquipInSpaceCommand</ClassName>
+      <ToolTip>查询设备所在的空间</ToolTip>
+      <LongDescription>查询设备所在的空间</LongDescription>
       <ToolTipImage></ToolTipImage>
       <MenuTab>MBITool_W</MenuTab>
       <Modules>MBITool</Modules>
     </Button>
-
     <Button ButtonStyles="Stacked">
-      <ButtonName>SAGA.MBI.ReportEquipInSpaceCommand</ButtonName>
-      <ButtonText>查询设备所在的空间</ButtonText>
+      <ButtonName>SAGA.MBI.CopyLocalIdCommand</ButtonName>
+      <ButtonText>复制设备编号的值</ButtonText>
       <ImageName>1、打开楼层模型</ImageName>
       <DllName>..\OutputDll\SAGA.MBI.exe</DllName>
-      <ClassName>SAGA.MBI.ReportEquipInSpaceCommand</ClassName>
-      <ToolTip>查询设备所在的空间</ToolTip>
-      <LongDescription>查询设备所在的空间</LongDescription>
+      <ClassName>SAGA.MBI.CopyLocalIdCommand</ClassName>
+      <ToolTip>将设备编号的值复制到设备本地编码中。</ToolTip>
+      <LongDescription>将设备编号的值复制到设备本地编码中,结果将列出本层复制失败的对象的id,如果本层都复制成功则没有提示。</LongDescription>
       <ToolTipImage></ToolTipImage>
       <MenuTab>MBITool_W</MenuTab>
       <Modules>MBITool</Modules>
@@ -172,6 +159,7 @@
       <MenuTab>MBITool_W</MenuTab>
       <Modules>MBITool</Modules>
     </Button>
+
     <Button ButtonStyles="Stacked">
       <ButtonName>SAGA.MBI.VerticalPipeAlginCommand</ButtonName>
       <ButtonText>立管对齐</ButtonText>
@@ -184,18 +172,6 @@
       <MenuTab>MBITool_W</MenuTab>
       <Modules>MBITool</Modules>
     </Button>
-    <Button ButtonStyles="Stacked">
-      <ButtonName>SAGA.MBI.VerticalPipeIsolationCommand</ButtonName>
-      <ButtonText>框选立管</ButtonText>
-      <ImageName>1、打开楼层模型</ImageName>
-      <DllName>..\OutputDll\SAGA.MBI.exe</DllName>
-      <ClassName>SAGA.MBI.VerticalPipeIsolationCommand</ClassName>
-      <ToolTip>框选立管</ToolTip>
-      <LongDescription>框选立管</LongDescription>
-      <ToolTipImage></ToolTipImage>
-      <MenuTab>MBITool_W</MenuTab>
-      <Modules>MBITool</Modules>
-    </Button>
   </Panel>
  <Panel PanelName="功能扩展" GroupFlag="True" GroupImage="" RevitVer="R14,R15,R16,R17"  ButtonStyles="Large">   
     <Button ButtonStyles="Large">

+ 53 - 0
MBI/Menu/Tool.xml

@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Menus>
+  <App>
+    <AppIndex>2</AppIndex>
+    <AppName>SAGA</AppName>
+  </App>
+  <Tab TabName="工具">
+    <MenuTab>Tool_W</MenuTab>
+    <Modules>Tool</Modules>
+  </Tab>
+  <Panel PanelName="工具" GroupFlag="True" GroupImage="" RevitVer="R14,R15,R16,R17"  ButtonStyles="Large">
+
+    <Button ButtonStyles="Stacked">
+      <ButtonName>ToolCommand.DeleteZeroSpaceCommand</ButtonName>
+      <ButtonText>删除本层Zero空间</ButtonText>
+      <ImageName>1、打开楼层模型</ImageName>
+      <DllName>..\OutputDll\ToolCommand.dll</DllName>
+      <ClassName>ToolCommand.DeleteZeroSpaceCommand</ClassName>
+      <ToolTip>删除本层Zero空间。</ToolTip>
+      <LongDescription>删除本层Zero空间。</LongDescription>
+      <ToolTipImage></ToolTipImage>
+      <MenuTab>Tool_W</MenuTab>
+      <Modules>Tool</Modules>
+    </Button>
+    <Button ButtonStyles="Stacked">
+      <ButtonName>ToolCommand.ExportCategoriesCommand</ButtonName>
+      <ButtonText>导出所有的设备类别</ButtonText>
+      <ImageName>1、打开楼层模型</ImageName>
+      <DllName>..\OutputDll\ToolCommand.dll</DllName>
+      <ClassName>ToolCommand.ExportCategoriesCommand</ClassName>
+      <ToolTip>更新设备所在楼层关系。</ToolTip>
+      <LongDescription>更新设备所在楼层关系。</LongDescription>
+      <ToolTipImage></ToolTipImage>
+      <MenuTab>Tool_W</MenuTab>
+      <Modules>Tool</Modules>
+    </Button>
+
+    <Button ButtonStyles="Stacked">
+      <ButtonName>ToolCommand.FocusLocationCommand</ButtonName>
+      <ButtonText>浏览坐标</ButtonText>
+      <ImageName>1、打开楼层模型</ImageName>
+      <DllName>..\OutputDll\ToolCommand.dll</DllName>
+      <ClassName>ToolCommand.FocusLocationCommand</ClassName>
+      <ToolTip>浏览坐标</ToolTip>
+      <LongDescription>浏览坐标</LongDescription>
+      <ToolTipImage></ToolTipImage>
+      <MenuTab>Tool_W</MenuTab>
+      <Modules>Tool</Modules>
+    </Button>
+  </Panel>
+</Menus>
+<!--名称里面换行-->
+<!-- <ButtonText>扫楼App&#x000A;用户管理</ButtonText>-->

+ 11 - 1
MBI/SAGA.MBI/RequestData/UpLoadFileRequest.cs

@@ -132,8 +132,18 @@ namespace SAGA.MBI.RequestData
             if (state == 2)
                 FloorFileOperate.BakFile(fullPath);
             string key = $"{MBIConst.OssClientFileKey}{cloudName}";
+            
             DownLoadNew:
-            OssClient client = new OssClient(MBIConst.Endpoint, MBIConst.AccessKeyId, MBIConst.AccessKeySecret);
+            OssClient client;
+            if (WebRequestProxy.IsOnline(out ClientConfiguration conf))
+            {
+                client = new OssClient(MBIConst.Endpoint, MBIConst.AccessKeyId, MBIConst.AccessKeySecret, conf);
+            }
+            else
+            {
+                client = new OssClient(MBIConst.Endpoint, MBIConst.AccessKeyId, MBIConst.AccessKeySecret);
+            }
+            
             int timeoutNum = 20;
             long totalLength = 0;
             try

+ 72 - 0
MBI/SAGA.MBI/RequestData/WebRequestProxy.cs

@@ -0,0 +1,72 @@
+/* ==============================================================================
+ * 功能描述:WebRequestProxy  
+ * 创 建 者:Garrett
+ * 创建日期:2019/5/10 17:48:28
+ * ==============================================================================*/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Net.NetworkInformation;
+using System.Text;
+using System.Threading.Tasks;
+using Aliyun.OSS.Common;
+using SAGA.DotNetUtils;
+using SAGA.DotNetUtils.Extend;
+using SAGA.MBI.FileStream;
+
+namespace SAGA.MBI.RequestData
+{
+    /// <summary>
+    /// WebRequestProxy
+    /// </summary>
+    class WebRequestProxy
+    {
+        /// <summary>
+        /// 判断主机是否在线
+        /// </summary>
+        /// <param name="address"></param>
+        /// <returns></returns>
+        public static bool IsOnline(out ClientConfiguration config)
+        {
+            bool result = false;
+            string address = GetProxyAddress();
+            int port = GetProxyPort();
+            config = null;
+            if (address.IsNullOrEmpty() || port==0)
+                return result;
+            Ping ping=new Ping();
+            PingReply pingReply = ping.Send(address);
+            if (pingReply.Status == IPStatus.Success)
+            {
+                result = true;
+                config=new ClientConfiguration();
+                config.ProxyHost = address;
+                config.ProxyPort = port;
+            }
+            else
+            {
+                result = false;
+                config = null;
+            }
+
+            return result;
+        }
+
+        /// <summary>
+        /// 获取下载代理地址
+        /// </summary>
+        /// <returns></returns>
+        private static string GetProxyAddress()
+        {
+            return ProjectDirOperate.GetConfigureInfo("ProxyHost");
+        }
+        /// <summary>
+        /// 获取下载代理端口
+        /// </summary>
+        /// <returns></returns>
+        private static int GetProxyPort()
+        {
+            return ProjectDirOperate.GetConfigureInfo("ProxyPort").ToInt();
+        }
+    }
+}

+ 1 - 1
MBI/SAGA.MBI/SAGA.MBI.csproj

@@ -316,6 +316,7 @@
     <Compile Include="RequestData\FileContentTransferUnit.cs" />
     <Compile Include="RequestData\QRCodeRequest.cs" />
     <Compile Include="RequestData\RequestResultUtil.cs" />
+    <Compile Include="RequestData\WebRequestProxy.cs" />
     <Compile Include="RevitExport\SpaceSortUtils.cs" />
     <Compile Include="RevitModelHandle\ParameterDefinitionFactory.cs" />
     <Compile Include="RevitModelHandle\ParameterUtil.cs" />
@@ -394,7 +395,6 @@
       <DependentUpon>WinModeCheckSetting.xaml</DependentUpon>
     </Compile>
     <Compile Include="ToolsData\CorrectLossDuty.cs" />
-    <Compile Include="ToolsData\ExportAllCategory.cs" />
     <Compile Include="ToolsData\ExportAllEquipmentAll.cs" />
     <Compile Include="ToolsData\IToolCommand.cs" />
     <Compile Include="ToolsData\ExportAllDuty.cs" />

+ 1 - 75
MBI/SAGA.MBI/ToolCommand.cs

@@ -37,47 +37,7 @@ namespace SAGA.MBI
 {
 
     #region 工具
-    /// <summary>
-    /// 隔离立管
-    /// </summary>
-    [Transaction(TransactionMode.Manual)]
-    [Regeneration(RegenerationOption.Manual)]
-    public class VerticalPipeIsolationCommand : ExternalCommand
-    {
-        public override Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
-        {
-            try
-            {
-                var elems = ExternalDataWrapper.Current.UiApp.WindowSelectElement("请框选...",new CommonFilter(t =>
-                {
-                    if (t is Pipe pipe)
-                    {
-                        var line = pipe.GetCurve() as Line;
-                        if (line != null)
-                        {
-                            var connectors = pipe.GetConnectors();
-                            
-                            return connectors.Any(tt=>!tt.IsConnected)&&line.Direction.IsParallel(XYZ.BasisZ);
-                        }
-                    }
-
-                    return false;
-                }));
-                ExternalDataWrapper.Current.UiApp.SetShowElements(elems,true);
-            }
-            catch (Exception e)
-            {
-                MessageShow.Show(e);
-                return Result.Cancelled;
-            }
-            return Result.Succeeded;
-        }
-
-        public override bool IsCommandAvailable(UIApplication applicationData, CategorySet selectedCategories)
-        {
-            return true;
-        }
-    }
+    
     /// <summary>
     /// 立管对齐
     /// </summary>
@@ -153,40 +113,6 @@ namespace SAGA.MBI
         }
     }
     /// <summary>
-    /// 导出类别
-    /// </summary>
-    [Transaction(TransactionMode.Manual)]
-    [Regeneration(RegenerationOption.Manual)]
-    public class ExportCategoriesCommand : ExternalCommand
-    {
-        public override Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
-        {
-            try
-            {
-
-                var tip = MessageShow.Question("确定要导出所有的族类别?");
-                if (tip)
-                    BllFactory<ExportAllCategory>.Instance.Operate();
-            }
-            catch (Exception e)
-            {
-                MessageShow.Show(e);
-                return Result.Cancelled;
-            }
-            return Result.Succeeded;
-        }
-
-
-        /// <summary>
-        /// Onlys show the dialog when a document is open, as Dockable dialogs are only available
-        /// when a document is open.
-        /// </summary>
-        public bool IsCommandAvailable(UIApplication applicationData, CategorySet selectedCategories)
-        {
-            return true;
-        }
-    }
-    /// <summary>
     /// 报告设备所在空间
     /// </summary>
     [Transaction(TransactionMode.Manual)]

+ 77 - 0
MBI/SAGA.Revit.sln

@@ -59,6 +59,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Test", "Test", "{33B095DB-1
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test", "Test\Test.csproj", "{C14E2157-5E86-488A-89C9-31FB07D98D3C}"
 EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestCommand", "TestCommand\TestCommand.csproj", "{F3C60916-7F3E-45E5-A695-1ECF408AF7D3}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ToolCommand", "ToolCommand\ToolCommand.csproj", "{5F2C216B-F298-4D86-A768-900BFFFEA91F}"
+EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 		Debug|Any CPU = Debug|Any CPU
@@ -852,6 +856,78 @@ Global
 		{C14E2157-5E86-488A-89C9-31FB07D98D3C}.RR17|x64.Build.0 = RR17|Any CPU
 		{C14E2157-5E86-488A-89C9-31FB07D98D3C}.RR17|x86.ActiveCfg = RR17|Any CPU
 		{C14E2157-5E86-488A-89C9-31FB07D98D3C}.RR17|x86.Build.0 = RR17|Any CPU
+		{F3C60916-7F3E-45E5-A695-1ECF408AF7D3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{F3C60916-7F3E-45E5-A695-1ECF408AF7D3}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{F3C60916-7F3E-45E5-A695-1ECF408AF7D3}.Debug|x64.ActiveCfg = Debug|Any CPU
+		{F3C60916-7F3E-45E5-A695-1ECF408AF7D3}.Debug|x64.Build.0 = Debug|Any CPU
+		{F3C60916-7F3E-45E5-A695-1ECF408AF7D3}.Debug|x86.ActiveCfg = Debug|Any CPU
+		{F3C60916-7F3E-45E5-A695-1ECF408AF7D3}.Debug|x86.Build.0 = Debug|Any CPU
+		{F3C60916-7F3E-45E5-A695-1ECF408AF7D3}.R16|Any CPU.ActiveCfg = Release|Any CPU
+		{F3C60916-7F3E-45E5-A695-1ECF408AF7D3}.R16|Any CPU.Build.0 = Release|Any CPU
+		{F3C60916-7F3E-45E5-A695-1ECF408AF7D3}.R16|x64.ActiveCfg = Release|Any CPU
+		{F3C60916-7F3E-45E5-A695-1ECF408AF7D3}.R16|x64.Build.0 = Release|Any CPU
+		{F3C60916-7F3E-45E5-A695-1ECF408AF7D3}.R16|x86.ActiveCfg = Release|Any CPU
+		{F3C60916-7F3E-45E5-A695-1ECF408AF7D3}.R16|x86.Build.0 = Release|Any CPU
+		{F3C60916-7F3E-45E5-A695-1ECF408AF7D3}.R17|Any CPU.ActiveCfg = Debug|Any CPU
+		{F3C60916-7F3E-45E5-A695-1ECF408AF7D3}.R17|Any CPU.Build.0 = Debug|Any CPU
+		{F3C60916-7F3E-45E5-A695-1ECF408AF7D3}.R17|x64.ActiveCfg = Release|Any CPU
+		{F3C60916-7F3E-45E5-A695-1ECF408AF7D3}.R17|x64.Build.0 = Release|Any CPU
+		{F3C60916-7F3E-45E5-A695-1ECF408AF7D3}.R17|x86.ActiveCfg = Release|Any CPU
+		{F3C60916-7F3E-45E5-A695-1ECF408AF7D3}.R17|x86.Build.0 = Release|Any CPU
+		{F3C60916-7F3E-45E5-A695-1ECF408AF7D3}.R18|Any CPU.ActiveCfg = Release|Any CPU
+		{F3C60916-7F3E-45E5-A695-1ECF408AF7D3}.R18|Any CPU.Build.0 = Release|Any CPU
+		{F3C60916-7F3E-45E5-A695-1ECF408AF7D3}.R18|x64.ActiveCfg = Release|Any CPU
+		{F3C60916-7F3E-45E5-A695-1ECF408AF7D3}.R18|x64.Build.0 = Release|Any CPU
+		{F3C60916-7F3E-45E5-A695-1ECF408AF7D3}.R18|x86.ActiveCfg = Release|Any CPU
+		{F3C60916-7F3E-45E5-A695-1ECF408AF7D3}.R18|x86.Build.0 = Release|Any CPU
+		{F3C60916-7F3E-45E5-A695-1ECF408AF7D3}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{F3C60916-7F3E-45E5-A695-1ECF408AF7D3}.Release|Any CPU.Build.0 = Release|Any CPU
+		{F3C60916-7F3E-45E5-A695-1ECF408AF7D3}.Release|x64.ActiveCfg = Release|Any CPU
+		{F3C60916-7F3E-45E5-A695-1ECF408AF7D3}.Release|x64.Build.0 = Release|Any CPU
+		{F3C60916-7F3E-45E5-A695-1ECF408AF7D3}.Release|x86.ActiveCfg = Release|Any CPU
+		{F3C60916-7F3E-45E5-A695-1ECF408AF7D3}.Release|x86.Build.0 = Release|Any CPU
+		{F3C60916-7F3E-45E5-A695-1ECF408AF7D3}.RR17|Any CPU.ActiveCfg = Release|Any CPU
+		{F3C60916-7F3E-45E5-A695-1ECF408AF7D3}.RR17|Any CPU.Build.0 = Release|Any CPU
+		{F3C60916-7F3E-45E5-A695-1ECF408AF7D3}.RR17|x64.ActiveCfg = Release|Any CPU
+		{F3C60916-7F3E-45E5-A695-1ECF408AF7D3}.RR17|x64.Build.0 = Release|Any CPU
+		{F3C60916-7F3E-45E5-A695-1ECF408AF7D3}.RR17|x86.ActiveCfg = Release|Any CPU
+		{F3C60916-7F3E-45E5-A695-1ECF408AF7D3}.RR17|x86.Build.0 = Release|Any CPU
+		{5F2C216B-F298-4D86-A768-900BFFFEA91F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{5F2C216B-F298-4D86-A768-900BFFFEA91F}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{5F2C216B-F298-4D86-A768-900BFFFEA91F}.Debug|x64.ActiveCfg = Debug|Any CPU
+		{5F2C216B-F298-4D86-A768-900BFFFEA91F}.Debug|x64.Build.0 = Debug|Any CPU
+		{5F2C216B-F298-4D86-A768-900BFFFEA91F}.Debug|x86.ActiveCfg = Debug|Any CPU
+		{5F2C216B-F298-4D86-A768-900BFFFEA91F}.Debug|x86.Build.0 = Debug|Any CPU
+		{5F2C216B-F298-4D86-A768-900BFFFEA91F}.R16|Any CPU.ActiveCfg = Release|Any CPU
+		{5F2C216B-F298-4D86-A768-900BFFFEA91F}.R16|Any CPU.Build.0 = Release|Any CPU
+		{5F2C216B-F298-4D86-A768-900BFFFEA91F}.R16|x64.ActiveCfg = Release|Any CPU
+		{5F2C216B-F298-4D86-A768-900BFFFEA91F}.R16|x64.Build.0 = Release|Any CPU
+		{5F2C216B-F298-4D86-A768-900BFFFEA91F}.R16|x86.ActiveCfg = Release|Any CPU
+		{5F2C216B-F298-4D86-A768-900BFFFEA91F}.R16|x86.Build.0 = Release|Any CPU
+		{5F2C216B-F298-4D86-A768-900BFFFEA91F}.R17|Any CPU.ActiveCfg = Debug|Any CPU
+		{5F2C216B-F298-4D86-A768-900BFFFEA91F}.R17|Any CPU.Build.0 = Debug|Any CPU
+		{5F2C216B-F298-4D86-A768-900BFFFEA91F}.R17|x64.ActiveCfg = Release|Any CPU
+		{5F2C216B-F298-4D86-A768-900BFFFEA91F}.R17|x64.Build.0 = Release|Any CPU
+		{5F2C216B-F298-4D86-A768-900BFFFEA91F}.R17|x86.ActiveCfg = Release|Any CPU
+		{5F2C216B-F298-4D86-A768-900BFFFEA91F}.R17|x86.Build.0 = Release|Any CPU
+		{5F2C216B-F298-4D86-A768-900BFFFEA91F}.R18|Any CPU.ActiveCfg = Release|Any CPU
+		{5F2C216B-F298-4D86-A768-900BFFFEA91F}.R18|Any CPU.Build.0 = Release|Any CPU
+		{5F2C216B-F298-4D86-A768-900BFFFEA91F}.R18|x64.ActiveCfg = Release|Any CPU
+		{5F2C216B-F298-4D86-A768-900BFFFEA91F}.R18|x64.Build.0 = Release|Any CPU
+		{5F2C216B-F298-4D86-A768-900BFFFEA91F}.R18|x86.ActiveCfg = Release|Any CPU
+		{5F2C216B-F298-4D86-A768-900BFFFEA91F}.R18|x86.Build.0 = Release|Any CPU
+		{5F2C216B-F298-4D86-A768-900BFFFEA91F}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{5F2C216B-F298-4D86-A768-900BFFFEA91F}.Release|Any CPU.Build.0 = Release|Any CPU
+		{5F2C216B-F298-4D86-A768-900BFFFEA91F}.Release|x64.ActiveCfg = Release|Any CPU
+		{5F2C216B-F298-4D86-A768-900BFFFEA91F}.Release|x64.Build.0 = Release|Any CPU
+		{5F2C216B-F298-4D86-A768-900BFFFEA91F}.Release|x86.ActiveCfg = Release|Any CPU
+		{5F2C216B-F298-4D86-A768-900BFFFEA91F}.Release|x86.Build.0 = Release|Any CPU
+		{5F2C216B-F298-4D86-A768-900BFFFEA91F}.RR17|Any CPU.ActiveCfg = Release|Any CPU
+		{5F2C216B-F298-4D86-A768-900BFFFEA91F}.RR17|Any CPU.Build.0 = Release|Any CPU
+		{5F2C216B-F298-4D86-A768-900BFFFEA91F}.RR17|x64.ActiveCfg = Release|Any CPU
+		{5F2C216B-F298-4D86-A768-900BFFFEA91F}.RR17|x64.Build.0 = Release|Any CPU
+		{5F2C216B-F298-4D86-A768-900BFFFEA91F}.RR17|x86.ActiveCfg = Release|Any CPU
+		{5F2C216B-F298-4D86-A768-900BFFFEA91F}.RR17|x86.Build.0 = Release|Any CPU
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE
@@ -861,6 +937,7 @@ Global
 		{1A6202BA-6646-48D1-8F93-F55ED4CFF075} = {6B218122-CAE7-4A42-B73F-AF24B065D823}
 		{EEBDB1AA-C80B-4F44-89EB-FB9D7DC2B1AE} = {6B218122-CAE7-4A42-B73F-AF24B065D823}
 		{C14E2157-5E86-488A-89C9-31FB07D98D3C} = {33B095DB-1BBF-49CE-8D5D-8128D017D382}
+		{F3C60916-7F3E-45E5-A695-1ECF408AF7D3} = {33B095DB-1BBF-49CE-8D5D-8128D017D382}
 	EndGlobalSection
 	GlobalSection(ExtensibilityGlobals) = postSolution
 		SolutionGuid = {4FA684AA-776F-4C7E-BB48-9587186AC17A}

+ 145 - 0
MBI/ToolCommand/Command.cs

@@ -0,0 +1,145 @@
+using Autodesk.Revit.Attributes;
+using Autodesk.Revit.DB;
+using Autodesk.Revit.DB.Structure;
+using Autodesk.Revit.UI;
+using SAGA.DotNetUtils;
+using SAGA.DotNetUtils.Extend;
+using SAGA.DotNetUtils.Others;
+using SAGA.RevitUtils;
+using SAGA.RevitUtils.Extends;
+using System;
+using System.IO;
+
+namespace ToolCommand
+{
+    /// <summary>
+    /// 批量删除无用的空间
+    /// </summary>
+    [Transaction(TransactionMode.Manual)]
+    [Regeneration(RegenerationOption.Manual)]
+    public class DeleteZeroSpaceCommand : ExternalCommand
+    {
+        public override Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
+        {
+            try
+            {
+                int count = 0;
+                bool tip = MessageShowBase.Question("确定要删除本层周长为零的空间?\r\n是:修正本楼层\r\n否:取消修正。");
+                if (tip)
+                {
+                    count = DelZeroSpace.Operate();
+                    MessageShowBase.Infomation($"此次操作共删除{count}个空间");
+                }
+            }
+            catch (Exception e)
+            {
+                MessageShow.Show(e);
+                return Result.Cancelled;
+            }
+            return Result.Succeeded;
+        }
+    }
+    /// <summary>
+    /// 导出类别
+    /// </summary>
+    [Transaction(TransactionMode.Manual)]
+    [Regeneration(RegenerationOption.Manual)]
+    public class ExportCategoriesCommand : ExternalCommand
+    {
+        public override Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
+        {
+            try
+            {
+
+                var tip = MessageShow.Question("确定要导出所有的族类别?");
+                if (tip)
+                {
+                    ExportAllCategory export=new ExportAllCategory();
+                    export.Operate();
+                }
+            }
+            catch (Exception e)
+            {
+                MessageShow.Show(e);
+                return Result.Cancelled;
+            }
+            return Result.Succeeded;
+        }
+
+
+        /// <summary>
+        /// Onlys show the dialog when a document is open, as Dockable dialogs are only available
+        /// when a document is open.
+        /// </summary>
+        public bool IsCommandAvailable(UIApplication applicationData, CategorySet selectedCategories)
+        {
+            return true;
+        }
+    }
+    
+    #region 浏览坐标
+    [Transaction(TransactionMode.Manual)]
+    [Regeneration(RegenerationOption.Manual)]
+    public class FocusLocationCommand : ExternalCommand, IExternalCommandAvailability
+    {
+        public override Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
+        {
+            var uiApp = commandData.Application;
+            var uiDoc = uiApp.ActiveUIDocument;
+            var doc = uiDoc.Document;
+          
+        WinLocation win=new WinLocation();
+            if (win.ShowDialog() == true)
+            {
+                string location = win.Location;
+                if (ObjectExtend.IsNotNullEmpty(location))
+                {
+
+                    XYZ xyz= ConvertToXyz(location);
+                    PlaceHolder(doc, xyz.ConvertToApi());
+                }
+            }
+            return Result.Succeeded;
+        }
+        
+        private XYZ ConvertToXyz(string str)
+        {
+            XYZ xyz = null;
+            var strs = str.Split(',');
+            if (strs.Length == 3)
+            {
+                xyz=new XYZ(strs[0].ToDouble(), strs[1].ToDouble(), strs[2].ToDouble());
+            }
+
+            return xyz;
+        }
+        /// <summary>
+        /// 创建占位符
+        /// </summary>
+        /// <param name="doc"></param>
+        /// <param name="xyz"></param>
+        private void PlaceHolder(Document doc,XYZ xyz)
+        {
+            using (Transaction trans = new Transaction(doc, "创建信标"))
+            {
+                trans.Start();
+                try
+                {
+                    string familyFile = Path.Combine(AppBaseInfo.FamilyPath, "占位符.rfa");
+                    FamilySymbol fs = doc.GetFamilySymbol(familyFile, BuiltInCategory.OST_GenericModel);
+                    var fi = doc.Create.NewFamilyInstance(xyz, fs, StructuralType.NonStructural);
+                    ExternalDataWrapper.Current.UiApp.SetShowElements(fi);
+                    trans.Commit();
+                }
+                catch (Exception e)
+                {
+                    trans.RollBack();
+                }
+            }
+        }
+
+#endregion
+
+  
+    }
+}

+ 58 - 0
MBI/ToolCommand/DelZeroSpace.cs

@@ -0,0 +1,58 @@
+/* ==============================================================================
+ * 功能描述:删除周长为零的空间
+ * 创 建 者:Garrett
+ * 创建日期:2018/7/12 14:25:17
+ * ==============================================================================*/
+
+using System;
+using System.Linq;
+using Autodesk.Revit.DB;
+using SAGA.DotNetUtils.Others;
+using SAGA.RevitUtils.Extends;
+
+namespace ToolCommand
+{
+    /// <summary>
+    /// CheckEquipCategory
+    /// </summary>
+    public class DelZeroSpace
+    {
+        /// <summary>
+        /// 检查并处理
+        /// </summary>
+        /// <param name="floor"></param>
+        /// <returns></returns>
+        public static int Operate()
+        {
+            int count = 0;
+            try
+            {
+                var doc = ExternalDataWrapper.Current.Doc;
+                using (Transaction trans = new Transaction(doc, "删除"))
+                {
+                    trans.Start();
+                    try
+                    {
+                        var spaces = doc.GetSpaces().Where(t => t.IsDeleteSpace()).ToList();
+                        count = spaces.Count;
+                        doc.Delete(spaces.Select(t => t.Id).ToList());
+                        trans.Commit();
+                    }
+                    catch (Exception)
+                    {
+                        trans.RollBack();
+
+                    }
+                }
+            }
+            catch (Exception e)
+            {
+                MessageShowBase.Show(e);
+            }
+            finally
+            {
+            }
+            return count;
+        }
+    }
+}

+ 3 - 8
MBI/SAGA.MBI/ToolsData/ExportAllCategory.cs

@@ -3,28 +3,23 @@
  * 创 建 者:Garrett
  * 创建日期:2018/10/11 8:58:18
  * ==============================================================================*/
+
 using System;
-using System.Collections.Generic;
 using System.Diagnostics;
 using System.IO;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
 using Autodesk.Revit.DB;
 using Microsoft.Win32;
 using NPOI.SS.UserModel;
 using NPOI.XSSF.UserModel;
 using SAGA.DotNetUtils.Others;
-using SAGA.MBI.Calc;
 using SAGA.RevitUtils.Extends;
-using CellType = Autodesk.Revit.DB.CellType;
 
-namespace SAGA.MBI.ToolsData
+namespace ToolCommand
 {
     /// <summary>
     /// ExportAllCategory
     /// </summary>
-    class ExportAllCategory : IToolCommand
+    class ExportAllCategory
     {
         public void Operate()
         {

+ 36 - 0
MBI/ToolCommand/Properties/AssemblyInfo.cs

@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// 有关程序集的一般信息由以下
+// 控制。更改这些特性值可修改
+// 与程序集关联的信息。
+[assembly: AssemblyTitle("ToolCommand")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("ToolCommand")]
+[assembly: AssemblyCopyright("Copyright ©  2019")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// 将 ComVisible 设置为 false 会使此程序集中的类型
+//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
+//请将此类型的 ComVisible 特性设置为 true。
+[assembly: ComVisible(false)]
+
+// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
+[assembly: Guid("5f2c216b-f298-4d86-a768-900bfffea91f")]
+
+// 程序集的版本信息由下列四个值组成: 
+//
+//      主版本
+//      次版本
+//      生成号
+//      修订号
+//
+// 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号
+//通过使用 "*",如下所示:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]

+ 96 - 0
MBI/ToolCommand/ToolCommand.csproj

@@ -0,0 +1,96 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProjectGuid>{5F2C216B-F298-4D86-A768-900BFFFEA91F}</ProjectGuid>
+    <OutputType>Library</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>ToolCommand</RootNamespace>
+    <AssemblyName>ToolCommand</AssemblyName>
+    <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
+    <FileAlignment>512</FileAlignment>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>..\OutputDll\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>..\OutputDll\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="ICSharpCode.SharpZipLib, Version=1.0.0.999, Culture=neutral, PublicKeyToken=1b03e6acf1164f73, processorArchitecture=MSIL">
+      <HintPath>..\packages\SharpZipLib.1.0.0\lib\net45\ICSharpCode.SharpZipLib.dll</HintPath>
+    </Reference>
+    <Reference Include="NPOI, Version=2.4.1.0, Culture=neutral, PublicKeyToken=0df73ec7942b34e1, processorArchitecture=MSIL">
+      <HintPath>..\packages\NPOI.2.4.1\lib\net45\NPOI.dll</HintPath>
+    </Reference>
+    <Reference Include="NPOI.OOXML, Version=2.4.1.0, Culture=neutral, PublicKeyToken=0df73ec7942b34e1, processorArchitecture=MSIL">
+      <HintPath>..\packages\NPOI.2.4.1\lib\net45\NPOI.OOXML.dll</HintPath>
+    </Reference>
+    <Reference Include="NPOI.OpenXml4Net, Version=2.4.1.0, Culture=neutral, PublicKeyToken=0df73ec7942b34e1, processorArchitecture=MSIL">
+      <HintPath>..\packages\NPOI.2.4.1\lib\net45\NPOI.OpenXml4Net.dll</HintPath>
+    </Reference>
+    <Reference Include="NPOI.OpenXmlFormats, Version=2.4.1.0, Culture=neutral, PublicKeyToken=0df73ec7942b34e1, processorArchitecture=MSIL">
+      <HintPath>..\packages\NPOI.2.4.1\lib\net45\NPOI.OpenXmlFormats.dll</HintPath>
+    </Reference>
+    <Reference Include="PresentationCore" />
+    <Reference Include="PresentationFramework" />
+    <Reference Include="RevitAPI">
+      <HintPath>..\..\..\ServiceMBI\Dlls\RevitRefDll\RevitAPI.dll</HintPath>
+    </Reference>
+    <Reference Include="RevitAPIUI">
+      <HintPath>..\..\..\ServiceMBI\Dlls\RevitRefDll\RevitAPIUI.dll</HintPath>
+    </Reference>
+    <Reference Include="System" />
+    <Reference Include="System.Core" />
+    <Reference Include="System.Xaml" />
+    <Reference Include="System.Xml.Linq" />
+    <Reference Include="System.Data.DataSetExtensions" />
+    <Reference Include="Microsoft.CSharp" />
+    <Reference Include="System.Data" />
+    <Reference Include="System.Net.Http" />
+    <Reference Include="System.Xml" />
+    <Reference Include="WindowsBase" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="Command.cs" />
+    <Compile Include="DelZeroSpace.cs" />
+    <Compile Include="ExportAllCategory.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+    <Compile Include="WinLocation.xaml.cs">
+      <DependentUpon>WinLocation.xaml</DependentUpon>
+    </Compile>
+  </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\SAGA.DotNetUtils\SAGA.DotNetUtils.csproj">
+      <Project>{07b73c98-dcb0-4782-81fa-f50a30b563ab}</Project>
+      <Name>SAGA.DotNetUtils</Name>
+    </ProjectReference>
+    <ProjectReference Include="..\SAGA.RevitUtils\SAGA.RevitUtils.csproj">
+      <Project>{d6201677-b7e4-495a-81ab-33c5837121e6}</Project>
+      <Name>SAGA.RevitUtils</Name>
+    </ProjectReference>
+  </ItemGroup>
+  <ItemGroup>
+    <Page Include="WinLocation.xaml">
+      <Generator>MSBuild:Compile</Generator>
+      <SubType>Designer</SubType>
+    </Page>
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="packages.config" />
+  </ItemGroup>
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+</Project>

+ 15 - 0
MBI/ToolCommand/WinLocation.xaml

@@ -0,0 +1,15 @@
+<Window x:Class="ToolCommand.WinLocation"
+             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
+             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+        mc:Ignorable="d" Title="获取坐标"
+        Width="400" Height="80">
+    <Grid>
+        <Canvas>
+            <TextBox Text="" Height="24" Width="300" Name="txtLocation"></TextBox>
+            <Button Canvas.Left="300" Content="确定" Height="24" Width="80" Click="ButtonBase_OnClick"></Button>
+        </Canvas>
+    </Grid>
+    
+</Window>

+ 27 - 0
MBI/ToolCommand/WinLocation.xaml.cs

@@ -0,0 +1,27 @@
+using System.Windows;
+
+namespace ToolCommand
+{
+    /// <summary>
+    /// WinLocation.xaml 的交互逻辑
+    /// </summary>
+    public partial class WinLocation 
+    {
+        public WinLocation()
+        {
+            InitializeComponent();
+        }
+
+        public string Location
+        {
+            get
+            {
+                return txtLocation.Text;
+            }
+        }
+        private void ButtonBase_OnClick(object sender, RoutedEventArgs e)
+        {
+            this.DialogResult = true;
+        }
+    }
+}

+ 5 - 0
MBI/ToolCommand/packages.config

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<packages>
+  <package id="NPOI" version="2.4.1" targetFramework="net461" />
+  <package id="SharpZipLib" version="1.0.0" targetFramework="net461" />
+</packages>