防止轮廓点引用错误

pull/68/head
Zoe 6 years ago
parent cb5cf129a7
commit dde2c6081c

@ -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,6 +1235,8 @@ export class PolyOffestUtil3
{
let pars = [nextPt, intPt].map(p => cir1.GetParamAtPoint(p));
let splitCus = cir1.GetSplitCurves(pars);
if (splitCus.length === 2)
{
let cu = splitCus[0].Length < splitCus[1].Length ? splitCus[0] : splitCus[1];
//如果不是首尾相连,就反转后在存入数组
@ -1235,6 +1244,7 @@ export class PolyOffestUtil3
newPlList.push(cu);
nextPt.copy(intPt);
}
}
if (!equaln(startDist, endDist))
{

Loading…
Cancel
Save