多项功能优化

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

@@ -39,8 +39,8 @@ public static class MEPAssist
public static Dictionary<MEPCurve, XYZ> GetNearestPoints(this MEPCurve mepCurve, MEPCurve mepCurve1)
{
Dictionary<MEPCurve, XYZ> dictionary = [];
var line1 = mepCurve.GetLocCurve() as Line;
var line2 = mepCurve1.GetLocCurve() as Line;
var line1 = mepCurve.GetCurve() as Line;
var line2 = mepCurve1.GetCurve() as Line;
var a = line1.Direction.DotProduct(line2.Direction);
var b = line1.Direction.DotProduct(line1.Direction);
var c = line2.Direction.DotProduct(line2.Direction);
@@ -76,7 +76,6 @@ public static class MEPAssist
/// </summary>
/// <param name="mepCurve">用来复制的管线</param>
/// <param name="line">定位线</param>
/// <param name="canNewElbow">可以创建弯头</param>
/// <returns></returns>
public static MEPCurve CopyAndSetLocationCurve(this MEPCurve mepCurve, Line line)
{
@@ -193,7 +192,7 @@ public static class MEPAssist
document.Regenerate();
//投影点
if (
electricMepCurve.GetLocCurve() is not Line line
electricMepCurve.GetCurve() is not Line line
|| electricMepCurve is FlexDuct
|| electricMepCurve is FlexPipe
|| electricMepCurve is PipeInsulation
@@ -205,7 +204,7 @@ public static class MEPAssist
}
var projectPoint = line.Project(point).XYZPoint;
if ((electricMepCurve.GetLocCurve() as Line).IsInsideEx(point, application.ShortCurveTolerance))
if ((electricMepCurve.GetCurve() as Line).IsInsideEx(point, application.ShortCurveTolerance))
{
var startLine = Line.CreateBound(line.GetEndPoint(0), projectPoint);
var endLine = Line.CreateBound(projectPoint, line.GetEndPoint(1));
@@ -377,12 +376,12 @@ public static class MEPAssist
public static void ConnectTo(this MEPCurve mainMepCurve, MEPCurve branchMepCurve)
{
var document = mainMepCurve.Document;
var unboundBranchCurve = branchMepCurve.GetLocCurve();
var unboundBranchCurve = branchMepCurve.GetCurve();
unboundBranchCurve.MakeUnbound();
var unboundMainCurve = mainMepCurve.GetLocCurve();
var unboundMainCurve = mainMepCurve.GetCurve();
unboundMainCurve.MakeUnbound();
var intersection = unboundBranchCurve.IntersectionPoint(unboundMainCurve) ?? throw new InvalidOperationException("主次分支管线不存在交点");
var line = mainMepCurve.GetLocCurve() as Line;
var line = mainMepCurve.GetCurve() as Line;
//根据交点在管线内的位置,判断是形成弯头还是三通
if (line.IsInsideEx(intersection, 0.5)) //三通
{
@@ -459,9 +458,9 @@ public static class MEPAssist
{
var doc = pipe.Document;
var v = doc.ActiveView as View3D;
List<T> li = new();
List<T> li = [];
//线段长度
var pline = pipe.GetLocCurve() as Line;
var pline = pipe.GetCurve() as Line;
var p1 = pline.GetEndPoint(0);
var p2 = pline.GetEndPoint(1);
//线段方向