diff --git a/src/GraphicsSystem/OffestPolyline.ts b/src/GraphicsSystem/OffestPolyline.ts index 19f1aeb0b..0ef4350de 100644 --- a/src/GraphicsSystem/OffestPolyline.ts +++ b/src/GraphicsSystem/OffestPolyline.ts @@ -10,6 +10,7 @@ import { Polyline, PolylineProps } from '../DatabaseServices/Polyline'; import { equal, equaln } from "../Geometry/GeUtils"; import { isTargetCurInSourceCur, isTargetCurOutOrOnSourceCur } from "./BoolOperateUtils"; import { IntersectOption } from "./IntersectWith"; +import { app } from "../ApplicationServices/Application"; interface offestRes { index: number, @@ -1072,10 +1073,16 @@ export class PolyOffestUtil3 { contours.push(this.buildContourByTwoSideOfest(plList1[i].pl, plList2[i].pl)); } + // contours.forEach(c => + // { + // c.Outline.ColorIndex = 3; + // app.m_Database.ModelSpace.Append(c.Outline); + // }) let newPls = this.trimAndJointOffestPolyline(plList1, this.m_Polyline); let cus = this.trimByContours(newPls, contours); + // return cus; if (this.m_Polyline.IsClose && this.offDir < 0) { cus = cus.filter(pl => isTargetCurInSourceCur(this.m_Polyline, pl)) @@ -1107,7 +1114,7 @@ export class PolyOffestUtil3 { if (!pl1 || !pl2) { - let arc = pl1 ? pl1 as Arc : pl2 as Arc; + let arc = pl1 ? pl1.Clone() as Arc : pl2.Clone() as Arc; let l1 = new Line(arc.Center, arc.StartPoint); let l2 = new Line(arc.Center, arc.EndPoint); return new Contour([arc, l1, l2]); @@ -1115,8 +1122,8 @@ export class PolyOffestUtil3 else { let dir = Math.sign(this.m_OffestDist) - let arc1 = new Arc().ParseFromBul(pl1.StartPoint, pl2.StartPoint, -dir); - let arc2 = new Arc().ParseFromBul(pl1.EndPoint, pl2.EndPoint, dir); + let arc1 = new Arc().ParseFromBul(pl1.StartPoint.clone(), pl2.StartPoint.clone(), -dir); + let arc2 = new Arc().ParseFromBul(pl1.EndPoint.clone(), pl2.EndPoint.clone(), dir); return new Contour([pl1.Clone() as Curve, pl2.Clone() as Curve, arc1, arc2]); } @@ -1228,12 +1235,15 @@ export class PolyOffestUtil3 { let pars = [nextPt, intPt].map(p => cir1.GetParamAtPoint(p)); let splitCus = cir1.GetSplitCurves(pars); - let cu = splitCus[0].Length < splitCus[1].Length ? splitCus[0] : splitCus[1]; + if (splitCus.length === 2) + { + let cu = splitCus[0].Length < splitCus[1].Length ? splitCus[0] : splitCus[1]; - //如果不是首尾相连,就反转后在存入数组 - if (!equal(cu.StartPoint, arrayLast(newPlList).EndPoint)) cu.Reverse(); - newPlList.push(cu); - nextPt.copy(intPt); + //如果不是首尾相连,就反转后在存入数组 + if (!equal(cu.StartPoint, arrayLast(newPlList).EndPoint)) cu.Reverse(); + newPlList.push(cu); + nextPt.copy(intPt); + } } if (!equaln(startDist, endDist))