|
@@ -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();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
|
|
|
|
|
|
}
|