多项功能优化

This commit is contained in:
GG Z
2024-12-22 10:26:12 +08:00
parent 77655c9ef5
commit 83b846f15f
66 changed files with 5424 additions and 2927 deletions

View File

@@ -44,10 +44,15 @@ namespace Sai.RvKits.RvMEP
e is not InsulationLiningBase &&
e is not FlexDuct &&
e is not FlexPipe &&
!(e.GetLocCurve() as Line).Direction.IsParallelTo(XYZ.BasisZ)),
!(e.GetCurve() as Line).Direction.IsParallelTo(XYZ.BasisZ)),
"请选择要整理的管线")
.Select(e => e.Id)
.ToList();
if (ids.Count <= 1)
{
return;
}
var baseId = uidoc.Selection
.PickObject(
Autodesk.Revit.UI.Selection.ObjectType.Element,
@@ -55,13 +60,8 @@ namespace Sai.RvKits.RvMEP
"请选择基准管线")
.ElementId;
if (ids.Count <= 1)
{
return;
}
var baseElement = doc.GetElement(baseId);
var baseLine = baseElement.GetLocCurve() as Line;
var baseLine = baseElement.GetCurve() as Line;
baseLine.MakeUnbound();
if (IsHorizon)
{
@@ -72,10 +72,10 @@ namespace Sai.RvKits.RvMEP
foreach (var id in ids)
{
var elem = doc.GetElement(id);
var l = elem.GetLocCurve() as Line;
var l = elem.GetCurve() as Line;
if (!l.Direction.IsParallelTo(baseLine.Direction))
{
MessageBox.Show("错误", "所选管线不平行");
MessageBox.Show("所选管线不平行", "错误");
return;
}
var d = baseLine.Distance(l.Origin);
@@ -225,14 +225,14 @@ namespace Sai.RvKits.RvMEP
{
//通过LocationCurve确定相对位置关系
var orderIds = ids.Select(id => doc.GetElement(id) as MEPCurve)
.OrderBy(c => (c.GetLocCurve() as Line).Origin.Z).Select(e => e.Id).ToList();
.OrderBy(c => (c.GetCurve() as Line).Origin.Z).Select(e => e.Id).ToList();
//中心距
if (MEPCurveCenter)
{
var baseIndex = orderIds.IndexOf(baseId);
for (var i = 0; i < orderIds.Count; i++)
{
var currentZ = (doc.GetElement(orderIds[i]).GetLocCurve() as Line).Origin.Z;
var currentZ = (doc.GetElement(orderIds[i]).GetCurve() as Line).Origin.Z;
var dis = Math.Abs(baseLine.Origin.Z - currentZ);
var actualDis = Math.Abs((baseIndex - i)) * Gap / 304.8;
//判断方向
@@ -255,7 +255,7 @@ namespace Sai.RvKits.RvMEP
{
ids.Remove(baseId);
var groups = ids.Select(id => doc.GetElement(id) as MEPCurve)
.OrderBy(c => (c.GetLocCurve() as Line).Origin.Z).GroupBy(e => (e.GetLocCurve() as Line).Origin.Z > baseLine.Origin.Z);
.OrderBy(c => (c.GetCurve() as Line).Origin.Z).GroupBy(e => (e.GetCurve() as Line).Origin.Z > baseLine.Origin.Z);
var baseTop = baseElement.get_BoundingBox(null).Max.Z;
var baseBottom = baseElement.get_BoundingBox(null).Min.Z;
if (baseElement is Pipe or Duct)