修复:当造型轮廓被旋转时,生成的造型槽位置不正确(同时影响了圆弧板)

pull/2678/MERGE
ChenX 6 months ago
parent 8f90bdbb79
commit c92f902299

@ -305,7 +305,7 @@ export class ArcBoardBuild
if (this._FaceDir === FaceDirection.Front)
zValue = 0;
let pl = new Polyline().Rectangle(dist1 + dist2, 10000).Move(new Vector3(d - dist1, -100, zValue));
let pl = new Polyline().Rectangle(dist1 + dist2, 10000).Move(new Vector3(d - dist1, -100, 0));
if (this._SweepAngle !== 0)
pl.ApplyMatrix(this.Rotate2OCSMtx);
@ -313,7 +313,7 @@ export class ArcBoardBuild
let data: IModeling = {
shape: new Shape(Contour.CreateContour(pl)),
thickness: thickness,
dir: FaceDirection.Front,
dir: 1 - this._FaceDir,//见光面和开槽面相反 这里翻转它
knifeRadius: 3,
addLen: 0,
};
@ -324,17 +324,14 @@ export class ArcBoardBuild
let d = dists[i];
let zValue = arcBoardOption.retainedThickness;
let thickness = br.Thickness - zValue;
if (this._FaceDir === FaceDirection.Front)
zValue = 0;
let pl = new Polyline().Rectangle(1, 10000).Move(new Vector3(d - 0.5, -100, zValue));
let pl = new Polyline().Rectangle(1, 10000).Move(new Vector3(d - 0.5, -100, 0));
if (this._SweepAngle !== 0)
pl.ApplyMatrix(this.Rotate2OCSMtx);
let data: IModeling = {
shape: new Shape(Contour.CreateContour(pl)),
thickness: thickness,
dir: FaceDirection.Front,
dir: 1 - this._FaceDir,//见光面和开槽面相反 这里翻转它
knifeRadius: 3,
addLen: 0,
};
@ -347,7 +344,7 @@ export class ArcBoardBuild
br.Modeling2D = this._board.Modeling2D;
br.Modeling3D = this._board.Modeling3D;
// TestDraw(br.Clone());
//TestDraw(br.Clone());
let csg = br.CSG;

@ -889,7 +889,12 @@ export class Board extends ExtrudeSolid
g.AppendGroove(subG);
}
//不需要处理正反面的原因是因为Get时保留了曲线的高度,导致生成的槽位置已经在指定位置
let gz = 0;//槽的z轴位置 (由于旋转轮廓或者镜像轮廓在Set时会被清除掉坐标系,我们还是需要正确的搞定z轴)
if (model.dir === FaceDirection.Front)
gz = this.thickness - g.Thickness;
let moveZ = gz - g.Position.z;
if (!equaln(moveZ, 0))
g.Move({ x: 0, y: 0, z: moveZ });
g.ApplyMatrix(this.OCSNoClone);

@ -531,8 +531,8 @@ export class ExtrudeSolid extends Entity
{
this.contourCurve.Position = this.contourCurve.Position.sub(box.min);
let v = box.min.applyMatrix4(this.OCS.setPosition(ZeroVec));
this._Matrix.setPosition(this.Position.add(v));
TransformVector(box.min, this.OCSNoClone);
this._Matrix.setPosition(this.Position.add(box.min));
}
}

Loading…
Cancel
Save