diff --git a/src/Add-on/Fillet.ts b/src/Add-on/Fillet.ts index 61adf77ee..b6c14e17b 100644 --- a/src/Add-on/Fillet.ts +++ b/src/Add-on/Fillet.ts @@ -364,35 +364,47 @@ export class CommandFillet implements Command if (res && res.arc) { let pln = pl.Clone(); + //修正凸度 if (res.cu1 instanceof Arc) pln.SetBulgeAt(parF1, res.cu1.Bul); if (res.cu2 instanceof Arc) pln.SetBulgeAt(parF2, res.cu2.Bul); - let sp = res.arc.StartPoint.applyMatrix4(pln.OCSInv); - let ep = res.arc.EndPoint.applyMatrix4(pln.OCSInv); - if (rem === 1) + let sp2d = Vec3DTo2D(res.arc.StartPoint.applyMatrix4(pln.OCSInv)); + let ep2d = Vec3DTo2D(res.arc.EndPoint.applyMatrix4(pln.OCSInv)); + + let isNeighbor = rem === 1; + + //#IOX26 + if (isNeighbor && res.cu1 instanceof Arc && res.cu2 instanceof Arc) { - pln.SetPointAt(parF2, Vec3DTo2D(ep)); - pln.AddVertexAt(parF2, Vec3DTo2D(sp)); + let ins = res.cu1.IntersectWith(res.cu2, IntersectOption.OnBothOperands); + if (ins.length === 1 && !equalv3(pln.StartPoint, ins[0])) + isNeighbor = false; + } + + if (isNeighbor) + { + pln.SetPointAt(parF2, ep2d); + pln.AddVertexAt(parF2, sp2d); pln.SetBulgeAt(parF2, res.arc.Bul); } else//首尾 { - let oldBul = pln.GetBuilgeAt(0); - pln.StartPoint = sp; - pln.SetBulgeAt(0, oldBul); + pln.SetPointAt(0, sp2d); + let plPtCount = pln.NumberOfVertices; if (pln.EndParam === plPtCount)//CloseMark { - pln.AddVertexAt(plPtCount, Vec3DTo2D(ep)); + pln.AddVertexAt(plPtCount, ep2d); pln.SetBulgeAt(plPtCount, -res.arc.Bul); } else { - pln.EndPoint = ep; + pln.SetPointAt(plPtCount - 1, ep2d); + pln.SetBulgeAt(plPtCount - 1, -res.arc.Bul); - pln.AddVertexAt(plPtCount, Vec3DTo2D(sp)); + pln.AddVertexAt(plPtCount, sp2d); } } diff --git a/src/DatabaseServices/Polyline.ts b/src/DatabaseServices/Polyline.ts index 297ceb979..b35c2f2a9 100644 --- a/src/DatabaseServices/Polyline.ts +++ b/src/DatabaseServices/Polyline.ts @@ -235,17 +235,26 @@ export class Polyline extends Curve return Vec2DTo3D(this.m_LineData[0].pt).applyMatrix4(this.OCS); return new Vector3(); } - set StartPoint(v: Vector3) + set StartPoint(p: Vector3) { this.WriteAllObjectRecord(); - this.SetPointAt(0, Vec3DTo2D(v)); - let bul = this.GetBuilgeAt(0) - if (bul !== 0) + p = p.clone().applyMatrix4(this.OCSInv); + + if (this.m_LineData.length === 0) + this.AddVertexAt(0, Vec3DTo2D(p)); + else if (this.m_LineData.length === 1) + this.SetPointAt(0, Vec3DTo2D(p)); + else { - let arc = this.GetCurveAtParam(0) as Arc; - arc.StartPoint = v; - //前面线的凸度调整 - this.SetBulgeAt(0, Math.tan(arc.AllAngle / 4) * Math.sign(bul)); + let bul = this.GetBuilgeAt(0) + if (bul !== 0) + { + let arc = this.GetCurveAtParam(0) as Arc; + arc.StartPoint = p; + //前面线的凸度调整 + this.SetBulgeAt(0, Math.tan(arc.AllAngle / 4) * Math.sign(bul)); + } + this.SetPointAt(0, Vec3DTo2D(p)); } } get EndPoint() @@ -255,21 +264,24 @@ export class Polyline extends Curve return Vec2DTo3D(this.m_LineData[this.EndParam].pt).applyMatrix4(this.OCS); return new Vector3(); } - set EndPoint(v: Vector3) + set EndPoint(p: Vector3) { - this.WriteAllObjectRecord(); - this.SetPointAt(this.EndParam, Vec3DTo2D(v)); - if (this.EndParam === 0) + if (this.m_LineData.length < 2 || this.CloseMark) return; + this.WriteAllObjectRecord(); + p = p.clone().applyMatrix4(this.OCSInv); + let bul = this.GetBuilgeAt(this.EndParam - 1) if (bul !== 0) { - let arc = this.GetCurveAtParam(0) as Arc; - arc.EndPoint = v; + let arc = this.GetCurveAtParam(this.EndParam - 1) as Arc; + arc.ApplyMatrix(this.OCSInv); + arc.EndPoint = p; //前面线的凸度调整 this.SetBulgeAt(this.EndParam - 1, Math.tan(arc.AllAngle / 4) * Math.sign(bul)); } + this.SetPointAt(this.EndParam, Vec3DTo2D(p)); } get StartParam() {