Browse Source

xls:提交

xulisong 6 years ago
parent
commit
4e2ebad9eb
2 changed files with 32 additions and 4 deletions
  1. 1 0
      .gitignore
  2. 31 4
      MBI/SAGA.MBI/TestCommand.cs

+ 1 - 0
.gitignore

@@ -11,3 +11,4 @@
 *.g.cs
 */obj/*
 *.dat
+*.pdb

+ 31 - 4
MBI/SAGA.MBI/TestCommand.cs

@@ -20,6 +20,7 @@ using SAGA.MBI.WinView.Login;
 using SAGA.MBI.WinView.Upload;
 using SAGA.RevitUtils;
 using SAGA.RevitUtils.Extends;
+using SAGA.RevitUtils.MEP;
 using WPfPointInfo;
 
 namespace SAGA.MBI
@@ -92,13 +93,39 @@ namespace SAGA.MBI
             try
             {
 
-                var pickElements=ExternalDataWrapper.Current.UiApp.PickElements("请选择水管", new PipeFilter());
-                if (pickElements == null)
+                var pickElement=ExternalDataWrapper.Current.UiApp.PickElement("请选择水管", new PipeFilter());
+
+
+
+                if (pickElement == null)
                 {
                        return Result.Succeeded;
                 }
-                var pipes = pickElements.OfType<Pipe>();
-                
+
+                using (Transaction tran = new Transaction(ExternalDataWrapper.Current.Doc,"连接"))
+                 
+                {
+                    try
+                    {
+                        tran.Start();
+                        var equioment = ExternalDataWrapper.Current.UiApp.PickElement("选择设备");
+                        var pipeConnector = pickElement.GetConnectors(Domain.DomainPiping).FirstOrDefault(c => !c.IsConnected);
+                        var equipmentConnector = equioment.GetConnectors(Domain.DomainPiping).FirstOrDefault(c => !c.IsConnected);
+
+                        if (pipeConnector != null && equipmentConnector != null)
+                        {
+                            pipeConnector.ConnectTo(equipmentConnector);
+                        }
+                        tran.Commit();
+                    }
+                    catch (Exception ex)
+                    {
+                        MessageShow.Show(ex);
+                        tran.RollBack();
+                    }
+                }
+               
+
 
 
             }