|
@@ -7,6 +7,7 @@ using System.Text;
|
|
|
using System.Text.RegularExpressions;
|
|
|
using System.Threading;
|
|
|
using System.Threading.Tasks;
|
|
|
+using System.Windows.Forms;
|
|
|
using System.Windows.Media;
|
|
|
using Autodesk.Revit.Attributes;
|
|
|
using Autodesk.Revit.DB;
|
|
@@ -14,6 +15,7 @@ using Autodesk.Revit.DB.Plumbing;
|
|
|
using Autodesk.Revit.UI;
|
|
|
using Autodesk.Revit.UI.Selection;
|
|
|
using SAGA.DotNetUtils;
|
|
|
+using SAGA.DotNetUtils.Data;
|
|
|
using SAGA.DotNetUtils.Extend;
|
|
|
using SAGA.DotNetUtils.Geometry;
|
|
|
using SAGA.DotNetUtils.Logger;
|
|
@@ -22,8 +24,11 @@ using SAGA.MBI.Calc;
|
|
|
using SAGA.MBI.DataArrange;
|
|
|
using SAGA.MBI.Interaction;
|
|
|
using SAGA.MBI.ModeInfoEdit;
|
|
|
+using SAGA.MBI.Model;
|
|
|
using SAGA.MBI.RevitExport;
|
|
|
+using SAGA.MBI.Test;
|
|
|
using SAGA.MBI.Tools;
|
|
|
+using SAGA.MBI.ToolsData;
|
|
|
using SAGA.MBI.WinView.Login;
|
|
|
using SAGA.MBI.WinView.Upload;
|
|
|
using SAGA.RevitUtils;
|
|
@@ -119,7 +124,7 @@ namespace SAGA.MBI
|
|
|
double maxz = spaceVertex.Max(t => t.Z);
|
|
|
//if (z.IsBetween(minz, maxz))
|
|
|
{
|
|
|
- if(Geometry2D.InSidePolygon(spaceVertex.Select(t=>t.ToPointD()).ToArray(),point)!=2)
|
|
|
+ if (Geometry2D.InSidePolygon(spaceVertex.Select(t => t.ToPointD()).ToArray(), point) != 2)
|
|
|
//if (xyz.PointInPolygonByRay(spaceVertex) != -1)
|
|
|
{
|
|
|
gcount++;
|
|
@@ -171,7 +176,7 @@ namespace SAGA.MBI
|
|
|
{
|
|
|
contexts.Add(new CalcContext(floor.MFloor));
|
|
|
}
|
|
|
- MBIModelInfoUpload.UpdateMbiInfo(contexts);
|
|
|
+ MBIModelInfoUpload.UpdateMbiInfo(contexts);
|
|
|
break;
|
|
|
}
|
|
|
case System.Windows.Forms.DialogResult.No:
|
|
@@ -181,7 +186,7 @@ namespace SAGA.MBI
|
|
|
MBIModelInfoUpload.UploadMbiInfo(floorId);
|
|
|
break;
|
|
|
}
|
|
|
- }
|
|
|
+ }
|
|
|
}
|
|
|
catch (Exception e)
|
|
|
{
|
|
@@ -262,14 +267,14 @@ namespace SAGA.MBI
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
- var pickElement=ExternalDataWrapper.Current.UiApp.PickElement("请选择水管", new PipeFilter());
|
|
|
+ var pickElement = ExternalDataWrapper.Current.UiApp.PickElement("请选择水管", new PipeFilter());
|
|
|
if (pickElement == null)
|
|
|
{
|
|
|
- return Result.Succeeded;
|
|
|
+ return Result.Succeeded;
|
|
|
}
|
|
|
|
|
|
- using (Transaction tran = new Transaction(ExternalDataWrapper.Current.Doc,"连接"))
|
|
|
-
|
|
|
+ using (Transaction tran = new Transaction(ExternalDataWrapper.Current.Doc, "连接"))
|
|
|
+
|
|
|
{
|
|
|
try
|
|
|
{
|
|
@@ -289,7 +294,7 @@ namespace SAGA.MBI
|
|
|
MessageShow.Show(ex);
|
|
|
tran.RollBack();
|
|
|
}
|
|
|
- }
|
|
|
+ }
|
|
|
}
|
|
|
catch (Exception e)
|
|
|
{
|
|
@@ -335,10 +340,10 @@ namespace SAGA.MBI
|
|
|
tran.Start();
|
|
|
var doc = ExternalDataWrapper.Current.Doc;
|
|
|
var s = pickElement.GetLocationPointMBIXYZ();
|
|
|
- DirectShape ds = DirectShape.CreateElement(doc,new ElementId(BuiltInCategory.OST_GenericModel));
|
|
|
+ DirectShape ds = DirectShape.CreateElement(doc, new ElementId(BuiltInCategory.OST_GenericModel));
|
|
|
var solid = SolidUtil.CreateSphereAtPoint(s, 1);
|
|
|
ds.AppendShape(new List<GeometryObject>() { solid });
|
|
|
- SolidUtil.SetColor(ds,new Color(255, 0, 0));
|
|
|
+ SolidUtil.SetColor(ds, new Color(255, 0, 0));
|
|
|
tran.Commit();
|
|
|
ExternalDataWrapper.Current.UiApp.SetShowElements(new List<Element>() { ds });
|
|
|
}
|
|
@@ -358,7 +363,7 @@ namespace SAGA.MBI
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
+
|
|
|
public class EquipmentFilter : ISelectionFilter
|
|
|
{
|
|
|
public bool AllowElement(Element elem)
|
|
@@ -390,11 +395,11 @@ namespace SAGA.MBI
|
|
|
var doc = ExternalDataWrapper.Current.App.OpenDocumentFile(floor.FullPath);
|
|
|
var eles = doc.GetAllElements();
|
|
|
|
|
|
- string path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory),$"{floor}_{System.DateTime.Now.Millisecond}.txt");
|
|
|
+ string path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory), $"{floor}_{System.DateTime.Now.Millisecond}.txt");
|
|
|
//File.Create(path);
|
|
|
foreach (Element element in eles)
|
|
|
{
|
|
|
- File.AppendAllText(path,$"{element.Id}:{element.Name}\r\n");
|
|
|
+ File.AppendAllText(path, $"{element.Id}:{element.Name}\r\n");
|
|
|
}
|
|
|
}
|
|
|
catch (Exception e)
|
|
@@ -446,7 +451,7 @@ namespace SAGA.MBI
|
|
|
var tempRefs = connector.GetReferenceConnectors();
|
|
|
foreach (var tempRef in tempRefs)
|
|
|
{
|
|
|
- if (ConnectorType.Physical.HasFlag(tempRef.ConnectorType)&& tempRef.IsConnectedTo(connector))
|
|
|
+ if (ConnectorType.Physical.HasFlag(tempRef.ConnectorType) && tempRef.IsConnectedTo(connector))
|
|
|
{
|
|
|
connector.DisconnectFrom(tempRef);
|
|
|
|
|
@@ -469,7 +474,7 @@ namespace SAGA.MBI
|
|
|
foreach (var connector in connectors)
|
|
|
{
|
|
|
var newLength = refCon.Origin.Subtract(connector.Origin).GetLength();
|
|
|
- if (newLength < maxLength&&!connector.IsConnected)
|
|
|
+ if (newLength < maxLength && !connector.IsConnected)
|
|
|
{
|
|
|
maxLength = newLength;
|
|
|
bConnector = connector;
|
|
@@ -491,7 +496,7 @@ namespace SAGA.MBI
|
|
|
return Result.Cancelled;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
return Result.Succeeded;
|
|
|
}
|
|
|
|
|
@@ -509,18 +514,18 @@ namespace SAGA.MBI
|
|
|
public class UpdateLevelNameCommand : ExternalCommand
|
|
|
{
|
|
|
public override Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
|
|
|
- {
|
|
|
+ {
|
|
|
var result = System.Windows.Forms.DialogResult.No;//MessageShow.Question2("是修改整个项目(【是】整个项目;【否】当前打开模型)");
|
|
|
switch (result)
|
|
|
{
|
|
|
case System.Windows.Forms.DialogResult.Yes:
|
|
|
- {
|
|
|
- var floors = DalUploadFloor.GetHasFileFloors();
|
|
|
- List<CalcContext> contexts = new List<CalcContext>();
|
|
|
- foreach (UploadFloor floor in floors)
|
|
|
{
|
|
|
- contexts.Add(new CalcContext(floor.MFloor));
|
|
|
- }
|
|
|
+ var floors = DalUploadFloor.GetHasFileFloors();
|
|
|
+ List<CalcContext> contexts = new List<CalcContext>();
|
|
|
+ foreach (UploadFloor floor in floors)
|
|
|
+ {
|
|
|
+ contexts.Add(new CalcContext(floor.MFloor));
|
|
|
+ }
|
|
|
|
|
|
#region 修改所有项目文件
|
|
|
foreach (var context in contexts)
|
|
@@ -543,15 +548,15 @@ namespace SAGA.MBI
|
|
|
|
|
|
#endregion
|
|
|
break;
|
|
|
- }
|
|
|
+ }
|
|
|
case System.Windows.Forms.DialogResult.No:
|
|
|
- {
|
|
|
- MbiElementManager.ExecuteExport(ExternalDataWrapper.Current.Doc);
|
|
|
- UpdateLevleName(ExternalDataWrapper.Current.Doc);
|
|
|
- break;
|
|
|
- }
|
|
|
+ {
|
|
|
+ MbiElementManager.ExecuteExport(ExternalDataWrapper.Current.Doc);
|
|
|
+ UpdateLevleName(ExternalDataWrapper.Current.Doc);
|
|
|
+ break;
|
|
|
+ }
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
return Result.Succeeded;
|
|
|
}
|
|
|
|
|
@@ -604,13 +609,44 @@ namespace SAGA.MBI
|
|
|
catch (Exception e)
|
|
|
{
|
|
|
tran.RollBack();
|
|
|
- MessageShow.Infomation(string.Format("{0}:失败",document.PathName));
|
|
|
+ MessageShow.Infomation(string.Format("{0}:失败", document.PathName));
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
+ /// <summary>
|
|
|
+ /// 同步幕墙的本地名称、本地编码到幕墙嵌板中?
|
|
|
+ /// </summary>
|
|
|
+ [Transaction(TransactionMode.Manual)]
|
|
|
+ [Regeneration(RegenerationOption.Manual)]
|
|
|
+ public class CopyLocalNameCurtainToPanelCommand : ExternalCommand
|
|
|
+ {
|
|
|
+ public override Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
|
|
|
+ {
|
|
|
+ try
|
|
|
+ {
|
|
|
+ //var tip = MessageShow.Question2("确定要执行同步幕墙的本地名称、本地编码到幕墙嵌板中?\r\n是:修正全部楼层\r\n否:修正当前楼层\r\n取消:取消修正。");
|
|
|
+ var tip = MessageShow.Question("确定要执行同步幕墙的本地名称、本地编码到幕墙嵌板中?\r\n是:修正当前楼层\r\n否:取消修正。");
|
|
|
+ switch (tip)
|
|
|
+ {
|
|
|
+ case true:
|
|
|
+ MFloor floor = ExternalDataWrapper.Current.Doc.GetCurMFloor();
|
|
|
+ if (floor != null)
|
|
|
+ SingleInstance<CopyWallLocalName>.Instance.Execute(floor);
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch (Exception e)
|
|
|
+ {
|
|
|
+ MessageShow.Show(e);
|
|
|
+ return Result.Cancelled;
|
|
|
+ }
|
|
|
+ return Result.Succeeded;
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
-
|
|
|
}
|