!2704 修复:修改见光面封边功能支持弧形板

pull/2715/MERGE
林三 5 months ago committed by ChenX
parent 06b83c7ddf
commit a448b0a683

@ -70,6 +70,13 @@ class SetSmoothEdgeFaces extends BoardGetFace
}
}
}
override GetArcBoardFaces()
{
this.FaceSealingDataMap = new Map();
this.highSealingData = [];
this.sealCus = [];
super.GetArcBoardFaces(this.FaceSealingDataMap, this.highSealingData, this.sealCus);
}
GetSmoothFaces(bg: this, scale = 0)
{
for (let f1 of this.Faces)
@ -86,6 +93,10 @@ class SetSmoothEdgeFaces extends BoardGetFace
let localBoard = (f1.type !== f2.type && f1.type === BoardFaceType.NoSide) ? f1.LocalBoard : f2.LocalBoard;
let scaleCopy = scale;
if (f1.LocalBoard.IsArcBoard && f1.type === BoardFaceType.Side || f2.LocalBoard.IsArcBoard && f2.type === BoardFaceType.Side)
scaleCopy = 0;
let nor1 = new Vector3().setFromMatrixColumn(mtx, 2);
let nor2 = new Vector3().setFromMatrixColumn(mtx2, 2);
@ -107,7 +118,7 @@ class SetSmoothEdgeFaces extends BoardGetFace
let f2CoverBoxes = bg._CoveredWidthFaceMap.get(f2) ?? [];
if (f1.type === f2.type)
{
let intRes = f1.IsIntersect(f2, scale, f1CoverBoxes);
let intRes = f1.IsIntersect(f2, scaleCopy, f1CoverBoxes);
if (intRes.isInt)
{
this.SmoothFace.add(f1);
@ -116,7 +127,7 @@ class SetSmoothEdgeFaces extends BoardGetFace
else
this._CoveredWidthFaceMap.set(f1, intRes.coverBoxesList);
intRes = f2.IsIntersect(f1, scale, f2CoverBoxes);
intRes = f2.IsIntersect(f1, scaleCopy, f2CoverBoxes);
if (intRes.isInt)
{
bg.SmoothFace.add(f2);
@ -127,7 +138,7 @@ class SetSmoothEdgeFaces extends BoardGetFace
}
else
{
let intRes = f1.IsIntersect(f2, scale, f1.type === BoardFaceType.Side ? f1CoverBoxes : f2CoverBoxes);
let intRes = f1.IsIntersect(f2, scaleCopy, f1.type === BoardFaceType.Side ? f1CoverBoxes : f2CoverBoxes);
if (intRes.isInt)
{
if (f1.type === BoardFaceType.Side)
@ -183,6 +194,32 @@ class SetSmoothEdgeFaces extends BoardGetFace
SetBoardTopDownLeftRightSealData(this.Board, this.highSealingData, this.sealCus);
this.Board.BoardProcessOption.highSealed = this.highSealingData;
}
WriteArcBoardSealingData(option: ISmoothEdgeOption)
{
let useIndex = new Set<number>();
for (let f of this.Faces)
{
if (f.type === BoardFaceType.Side && this.SmoothFace.has(f))
{
let index = this.FaceSealingDataMap.get(f);
if (index !== undefined)
{
this.highSealingData[index].size = option.edge;
useIndex.add(index);
}
}
}
for (let i = 0; i < this.highSealingData.length; i++)
{
if (!useIndex.has(i))
this.highSealingData[i].size = option.smoothEdge;
}
SetBoardTopDownLeftRightSealData(this.Board, this.highSealingData, this.sealCus);
this.Board.BoardProcessOption.highSealed = this.highSealingData;
}
}
export function SetSmoothEdges(brs: Board[], option: ISmoothEdgeOption)
@ -220,6 +257,9 @@ export function SetSmoothEdges(brs: Board[], option: ISmoothEdgeOption)
for (let brGe of BoardGeList)
{
if (brGe.Board.IsArcBoard)
brGe.WriteArcBoardSealingData(option);
else
brGe.WriteSealingData(option);
}
}

@ -9,6 +9,8 @@ import { Board } from "../../DatabaseServices/Entity/Board";
import { Curve } from "../../DatabaseServices/Entity/Curve";
import { Polyline } from "../../DatabaseServices/Entity/Polyline";
import { Region } from "../../DatabaseServices/Entity/Region";
import { GetBoardHighSeal } from "../../GraphicsSystem/CalcEdgeSealing";
import { IHighSealedItem } from "../../UI/Store/OptionInterface/IHighSealedItem";
import { AsVector2, ZAxis, angle, equaln, equalv3 } from "../GeUtils";
import { CanDrawHoleFuzz } from "./CanDrawHoleFuzz";
import { Face } from "./Face";
@ -30,7 +32,7 @@ export class BoardGetFace
{
if (this.Board.IsArcBoard)
{
this.GetCurveBoardSideFaces();
this.GetArcBoardFaces();
return;
}
//正反面
@ -103,7 +105,7 @@ export class BoardGetFace
}
//获取曲线板的正反 侧面
GetCurveBoardSideFaces()
GetArcBoardFaces(faceSealingDataMap?: Map<Face, number>, highSealingData?: IHighSealedItem[], sealCu?: Curve[])
{
let br = this.Board;
const opt = br.BoardProcessOption;
@ -135,9 +137,17 @@ export class BoardGetFace
const FaceDir = br.SweepVisibleFace === FaceDirection.Front ? -1 : 1;
let ContourCurve = br.ContourCurve.Clone() as Polyline;
const ContourCurve = br.ContourCurve.Clone() as Polyline;
//弧形板旋转角度
ContourCurve.ApplyMatrix(sweepArcBoardBuild.OCS2RotateMtx);
if (highSealingData)
{
let cus = (br.ContourCurve.Clone() as Polyline).Explode();
highSealingData.push(...GetBoardHighSeal(br, cus));
sealCu.push(...cus);
}
let contourLength = br.ParseBoardLengthInArcSweep();
for (let i = 0; i < conCus.length; i++)
@ -238,14 +248,23 @@ export class BoardGetFace
ocs = new Matrix4().multiplyMatrices((new Matrix4().makeRotationAxis(ZNormal, ro)), ocs).setPosition(conCu.StartPoint);
ocs.multiply(new Matrix4().getInverse(RX)).multiply(mtx);
this.Faces.push(new Face({
let f = new Face({
type: BoardFaceType.Side,
localBoard: br,
matrix4: ocs,
length: cu.Length,
width: br.Thickness * FaceDir,
drillType: HighDrill.length > 0 && HighDrill[j]
}));
});
if (faceSealingDataMap)
{
let pt = cu.GetPointAtParam(0.5).add(new Vector3(currentLength));
let index = Math.floor(ContourCurve.GetParamAtPoint(pt));
if (!isNaN(index))
faceSealingDataMap.set(f, index);
}
this.Faces.push(f);
}
}
}

@ -253,7 +253,20 @@ export class Face
}
else
{
let retBox = new Box3Ext(new Vector3(), new Vector3(sideFace.Length, sideFace.Width));
let minV: Vector3;
let maxV: Vector3;
if (sideFace.Width > 0)
{
minV = new Vector3();
maxV = new Vector3(sideFace.Length, sideFace.Width);
}
else
{
minV = new Vector3(0, sideFace.Width);
maxV = new Vector3(sideFace.Length, 0);
}
let retBox = new Box3Ext(minV, maxV);
let p1 = new Vector3().setFromMatrixPosition(diffMtx);
let p2 = new Vector3(noSideFace.Length, noSideFace.Width).applyMatrix4(diffMtx);
@ -263,7 +276,7 @@ export class Face
{
retBox.intersect(box3);
let size = retBox.getSize(new Vector3());
if (equaln(size.x * size.y, 0) || size.y / sideFace.Width <= fuzz)
if (equaln(size.x * size.y, 0) || Math.abs(size.y / sideFace.Width) <= fuzz)
return { isInt: false, coverBoxesList: currentCoverBoxes };
if (size.x / sideFace.Length > fuzz)

Loading…
Cancel
Save