|
@@ -16,6 +16,7 @@ using Autodesk.Revit.DB.Plumbing;
|
|
|
using Autodesk.Revit.UI;
|
|
|
using FWindSoft.DataFramework;
|
|
|
using SAGA.DotNetUtils;
|
|
|
+using SAGA.DotNetUtils.Geometry;
|
|
|
using SAGA.DotNetUtils.Logger;
|
|
|
using SAGA.DotNetUtils.Others;
|
|
|
using SAGA.MBI.Common;
|
|
@@ -37,7 +38,7 @@ namespace SAGA.MBI
|
|
|
{
|
|
|
|
|
|
#region 工具
|
|
|
-
|
|
|
+
|
|
|
/// <summary>
|
|
|
/// 立管对齐
|
|
|
/// </summary>
|
|
@@ -50,7 +51,7 @@ namespace SAGA.MBI
|
|
|
try
|
|
|
{
|
|
|
int count = 0;
|
|
|
- WinSelectCheckFloors win =new WinSelectCheckFloors();
|
|
|
+ WinSelectCheckFloors win = new WinSelectCheckFloors();
|
|
|
if (win.ShowDialog() == true)
|
|
|
{
|
|
|
VerticalPipeAlign.Instance.Execute();
|
|
@@ -87,15 +88,15 @@ namespace SAGA.MBI
|
|
|
switch (tip)
|
|
|
{
|
|
|
case DialogResult.Yes:
|
|
|
- count=DelZeroSpace.OperateAll();
|
|
|
+ count = DelZeroSpace.OperateAll();
|
|
|
break;
|
|
|
case DialogResult.No:
|
|
|
- count=DelZeroSpace.OperateCurFloor();
|
|
|
+ count = DelZeroSpace.OperateCurFloor();
|
|
|
break;
|
|
|
default:
|
|
|
break;
|
|
|
}
|
|
|
- if(tip== DialogResult.Yes||tip== DialogResult.No)
|
|
|
+ if (tip == DialogResult.Yes || tip == DialogResult.No)
|
|
|
MessageShowBase.Infomation($"此次操作共删除{count}个空间");
|
|
|
|
|
|
}
|
|
@@ -123,9 +124,60 @@ namespace SAGA.MBI
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
- var fi = ExternalDataWrapper.Current.UiApp.GetSelectedElement() as FamilyInstance;
|
|
|
+ List<Geometry2D.PointD> newPoints = new List<Geometry2D.PointD>();
|
|
|
+ newPoints.Add(new Geometry2D.PointD(0, 0));
|
|
|
+ newPoints.Add(new Geometry2D.PointD(400, 0));
|
|
|
+ newPoints.Add(new Geometry2D.PointD(400, 400));
|
|
|
+ newPoints.Add(new Geometry2D.PointD(200, 200));
|
|
|
+ newPoints.Add(new Geometry2D.PointD(0, 400));
|
|
|
+
|
|
|
+ //外点 ==2
|
|
|
+ var testPoint = new Geometry2D.PointD(-100, 200);
|
|
|
+ int flag = Geometry2D.InSidePolygon( newPoints.ToArray(),testPoint );
|
|
|
+ //==0
|
|
|
+ var testPoint2 = new Geometry2D.PointD(50, 200);
|
|
|
+ int flag2 = Geometry2D.InSidePolygon(newPoints.ToArray(), testPoint2);
|
|
|
+
|
|
|
+ List<Geometry2D.PointD> newPoints3 = new List<Geometry2D.PointD>();
|
|
|
+ newPoints3.Add(new Geometry2D.PointD(0, 0));
|
|
|
+ newPoints3.Add(new Geometry2D.PointD(400, 0));
|
|
|
+ newPoints3.Add(new Geometry2D.PointD(400, 200));
|
|
|
+ newPoints3.Add(new Geometry2D.PointD(200, 200));
|
|
|
+ newPoints3.Add(new Geometry2D.PointD(150, 200));
|
|
|
+ newPoints3.Add(new Geometry2D.PointD(100, 200));
|
|
|
+ newPoints3.Add(new Geometry2D.PointD(50, 200));
|
|
|
+ newPoints3.Add(new Geometry2D.PointD(0, 400));
|
|
|
+ //内点==0
|
|
|
+ var testPointI3 = new Geometry2D.PointD(25, 200);
|
|
|
+ int flagI3 = Geometry2D.InSidePolygon(newPoints3.ToArray(), testPointI3);
|
|
|
+ //外点==2
|
|
|
+ var testPointO3 = new Geometry2D.PointD(-25, 200);
|
|
|
+ int flagO3 = Geometry2D.InSidePolygon(newPoints3.ToArray(), testPointO3);
|
|
|
+
|
|
|
+ var fi = commandData.Application.PickElement("请选择图元") as FamilyInstance;
|
|
|
+ if (fi == null) return Result.Succeeded;
|
|
|
var space = fi.GetReferenceSpace();
|
|
|
- MessageShowBase.Infomation($"设备所在空间Id为{space?.Id}");
|
|
|
+ string str = "", str2 = "";
|
|
|
+ do
|
|
|
+ {
|
|
|
+ if (space != null)
|
|
|
+ {
|
|
|
+ List<XYZ> spaceVertex = space.GetBoundaryVertexes().FirstOrDefault();
|
|
|
+ if (spaceVertex == null)
|
|
|
+ {
|
|
|
+ str = "Boundary 为Null";
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ var xyz = fi.GetLocationPointMBIXYZ();
|
|
|
+ str = "Geometry Intersection Result:" + xyz.PointInPolygonByRay(spaceVertex);
|
|
|
+
|
|
|
+ str2 = "Geometry2D Intersection Result:" + Geometry2D.InSidePolygon(
|
|
|
+ spaceVertex.Select(t => t.ToPointD()).ToArray(), xyz.ToPointD());
|
|
|
+ }
|
|
|
+
|
|
|
+ } while (false);
|
|
|
+ MessageShowBase.Infomation($"设备所在空间Id为{space?.Id}" + "\r\n" + $"{str}" + "\r\n" + $"{str2}");
|
|
|
}
|
|
|
catch (Exception e)
|
|
|
{
|
|
@@ -541,7 +593,7 @@ namespace SAGA.MBI
|
|
|
[Regeneration(RegenerationOption.Manual)]
|
|
|
public class AddSiSpaceCommand : ExternalCommand
|
|
|
{
|
|
|
-
|
|
|
+
|
|
|
public override Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
|
|
|
{
|
|
|
List<string> errorIds = new List<string>();
|
|
@@ -578,12 +630,12 @@ namespace SAGA.MBI
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
- MessageBox.Show("总共修改:"+totalIds.Count);
|
|
|
+ MessageBox.Show("总共修改:" + totalIds.Count);
|
|
|
if (errorIds.Any()) ;
|
|
|
{
|
|
|
- MessageBox.Show("错误Ids:" + string.Join(";",errorIds));
|
|
|
+ MessageBox.Show("错误Ids:" + string.Join(";", errorIds));
|
|
|
}
|
|
|
}
|
|
|
}
|