|
|
|
@ -17,7 +17,6 @@ import { Shape } from "../../DatabaseServices/Shape";
|
|
|
|
|
import { ShapeManager } from "../../DatabaseServices/ShapeManager";
|
|
|
|
|
import { Box3Ext } from "../../Geometry/Box";
|
|
|
|
|
import { Route } from "../../Geometry/CurveMap";
|
|
|
|
|
import { GetSideFaceMtx } from "../../Geometry/DrillParse/BoardGetFace";
|
|
|
|
|
import { CanDrawHoleFuzz } from "../../Geometry/DrillParse/CanDrawHoleFuzz";
|
|
|
|
|
import { AsVector2, equaln, isParallelTo } from "../../Geometry/GeUtils";
|
|
|
|
|
import { RegionParse } from "../../Geometry/RegionParse";
|
|
|
|
@ -574,13 +573,18 @@ export function GetModelingFromCustomDrill(br: Board)
|
|
|
|
|
if (!ocs) continue;
|
|
|
|
|
|
|
|
|
|
brInv = new Matrix4().getInverse(ocs);
|
|
|
|
|
let holeBox = hole.GetBoundingBoxInMtx(brInv);
|
|
|
|
|
holeBoxMap.set(hole, holeBox);
|
|
|
|
|
if (hole.BoundingBox.clone().intersect(br.BoundingBox).isSolid(0.1))
|
|
|
|
|
holes.push(hole);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
let holeBox = hole.GetBoundingBoxInMtx(brInv);
|
|
|
|
|
holeBoxMap.set(hole, holeBox);
|
|
|
|
|
if (holeBox.clone().intersect(bbox).isSolid(0.1))
|
|
|
|
|
holes.push(hole);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -661,12 +665,12 @@ export function GetModelingFromCustomDrill(br: Board)
|
|
|
|
|
if (br.IsArcBoard)
|
|
|
|
|
{
|
|
|
|
|
//弧形板需要单独增加差值
|
|
|
|
|
shape.Position.add(addPos);
|
|
|
|
|
shape.Position = shape.Position.add(addPos);
|
|
|
|
|
|
|
|
|
|
if (br.SweepAngle)
|
|
|
|
|
{
|
|
|
|
|
let ocsInv = new Matrix4().getInverse(br.ArcBuild.OCS2RotateMtx);
|
|
|
|
|
shape.Position.applyMatrix4(ocsInv);
|
|
|
|
|
shape.ApplyMatrix(ocsInv);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -682,45 +686,48 @@ export function GetModelingFromCustomDrill(br: Board)
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (min.z <= 0 || max.z >= br.Thickness) continue;
|
|
|
|
|
let spt = hole.Position.applyMatrix4(brInv).setZ(0);
|
|
|
|
|
|
|
|
|
|
if (outline.PtOnCurve(spt)) continue;
|
|
|
|
|
let line = new Line(spt, hole.Position.add(hole.Normal.multiplyScalar(hole.Height)).applyMatrix4(brInv).setZ(0));
|
|
|
|
|
let pt = outline.IntersectWith(line, 0)[0];
|
|
|
|
|
if (!pt) continue;
|
|
|
|
|
|
|
|
|
|
let index = Math.floor(outline.GetParamAtPoint(pt));
|
|
|
|
|
let thickness = line.StartPoint.distanceTo(pt);
|
|
|
|
|
|
|
|
|
|
let shape = hole.Shape.ApplyMatrix(hole.OCS).ApplyMatrix(brInv);
|
|
|
|
|
let vec = line.GetFirstDeriv(0).normalize().multiplyScalar(thickness);
|
|
|
|
|
shape.Position = shape.Position.add(vec);
|
|
|
|
|
|
|
|
|
|
//侧面造型仅在多段线直线上
|
|
|
|
|
let cu = (outline as Polyline).GetCurveAtIndex(index);
|
|
|
|
|
shape.ApplyMatrix(new Matrix4().getInverse(GetSideFaceMtx(cu)));
|
|
|
|
|
|
|
|
|
|
if (br.IsArcBoard)
|
|
|
|
|
{
|
|
|
|
|
//弧形板需要单独增加差值
|
|
|
|
|
shape.Position.add(addPos);
|
|
|
|
|
|
|
|
|
|
if (br.SweepAngle)
|
|
|
|
|
{
|
|
|
|
|
let ocsInv = new Matrix4().getInverse(br.ArcBuild.OCS2RotateMtx);
|
|
|
|
|
shape.Position.applyMatrix4(ocsInv);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sideModeling.push({
|
|
|
|
|
shape,
|
|
|
|
|
thickness,
|
|
|
|
|
dir: index,
|
|
|
|
|
knifeRadius: hole.KnifeRadius,
|
|
|
|
|
addLen: 0,
|
|
|
|
|
originEn: hole,
|
|
|
|
|
});
|
|
|
|
|
//侧面非圆造型
|
|
|
|
|
//TODO: 拆成侧面造型孔
|
|
|
|
|
|
|
|
|
|
// if (min.z <= 0 || max.z >= br.Thickness) continue;
|
|
|
|
|
// let spt = hole.Position.applyMatrix4(brInv).setZ(0);
|
|
|
|
|
|
|
|
|
|
// if (outline.PtOnCurve(spt)) continue;
|
|
|
|
|
// let line = new Line(spt, hole.Position.add(hole.Normal.multiplyScalar(hole.Height)).applyMatrix4(brInv).setZ(0));
|
|
|
|
|
// let pt = outline.IntersectWith(line, 0)[0];
|
|
|
|
|
// if (!pt) continue;
|
|
|
|
|
|
|
|
|
|
// let index = Math.floor(outline.GetParamAtPoint(pt));
|
|
|
|
|
// let thickness = line.StartPoint.distanceTo(pt);
|
|
|
|
|
|
|
|
|
|
// let shape = hole.Shape.ApplyMatrix(hole.OCS).ApplyMatrix(brInv);
|
|
|
|
|
// let vec = line.GetFirstDeriv(0).normalize().multiplyScalar(thickness);
|
|
|
|
|
// shape.Position = shape.Position.add(vec);
|
|
|
|
|
|
|
|
|
|
// //侧面造型仅在多段线直线上
|
|
|
|
|
// let cu = (outline as Polyline).GetCurveAtIndex(index);
|
|
|
|
|
// shape.ApplyMatrix(new Matrix4().getInverse(GetSideFaceMtx(cu)));
|
|
|
|
|
|
|
|
|
|
// if (br.IsArcBoard)
|
|
|
|
|
// {
|
|
|
|
|
// //弧形板需要单独增加差值
|
|
|
|
|
// shape.Position = shape.Position.add(addPos);
|
|
|
|
|
|
|
|
|
|
// if (br.SweepAngle)
|
|
|
|
|
// {
|
|
|
|
|
// let ocsInv = new Matrix4().getInverse(br.ArcBuild.Rotate2OCSMtx);
|
|
|
|
|
// shape.ApplyMatrix(ocsInv);
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// sideModeling.push({
|
|
|
|
|
// shape,
|
|
|
|
|
// thickness,
|
|
|
|
|
// dir: index,
|
|
|
|
|
// knifeRadius: hole.KnifeRadius,
|
|
|
|
|
// addLen: 0,
|
|
|
|
|
// originEn: hole,
|
|
|
|
|
// });
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|