优化更新

This commit is contained in:
GG Z
2025-02-10 20:53:40 +08:00
parent 83b846f15f
commit 9696128f03
62 changed files with 2567 additions and 1608 deletions

View File

@@ -1,12 +1,11 @@
using System.Security.Cryptography;
using Autodesk.Revit.Attributes;
using Autodesk.Revit.Attributes;
using Autodesk.Revit.DB;
using Autodesk.Revit.DB.Electrical;
using Autodesk.Revit.DB.Mechanical;
using Autodesk.Revit.DB.Plumbing;
using Nice3point.Revit.Toolkit.External;
using Nice3point.Revit.Toolkit.Utils;
namespace Sai.RvKits.RvMEP;
@@ -77,6 +76,42 @@ public class CorrectMEPCurveSlopeCmd : ExternalCommand
}
}, "修正坡度");
}
private void CorrectSlope()
{
var ids = UiDocument.Selection.GetElementIds();
Document.Modify(
set => set.Transaction).Commit((doc, t) =>
{
foreach (var id in ids)
{
var elem = Document.GetElement(id);
if (elem is MEPCurve mep)
{
var loc = mep.GetCurve() as Line;
var x = Math.Round(loc.Direction.X);
var y = Math.Round(loc.Direction.Y);
var z = Math.Round(loc.Direction.Z);
//if (Math.Abs(x) < 10E-5)
//{
// x = 0;
//}
//if (Math.Abs(y) < 10E-5)
//{
// y = 0;
//}
//if (Math.Abs(z) < 10E-5)
//{
// z = 0;
//}
var dir = new XYZ(x, y, z);
var endPoint = loc.Origin + dir * loc.Length;
var li = Line.CreateBound(loc.Origin, endPoint);
var locx = mep.GetLocationCurve();
locx.Curve = li;
}
}
});
}
private void ModifyMEPCurve(MEPCurve mepCurve)
{
var loc = mepCurve.Location as LocationCurve;