!1953 修复:镜像板修改板尺寸后,板边数据错误

pull/1941/MERGE
ChenX 2 years ago
parent ecdfb7b76b
commit fa8cf28bda

@ -12,5 +12,19 @@ test('板件镜像', () =>
br.ApplyMatrix(MakeMirrorMtx(new Vector3(0, 0, 1))); br.ApplyMatrix(MakeMirrorMtx(new Vector3(0, 0, 1)));
let f = new CADFiler; let f = new CADFiler;
f.WriteObject(br); f.WriteObject(br);
expect(f).toMatchSnapshot(); expect(f.Data).toMatchSnapshot();
});
test('板镜像后板边数据错误', () =>
{
let d =
{ "file": [1, "Board", 8, 2, 100, false, 1, 8, 0, [0, 1, 0, 0, -1, 0, 1.2246467991473532e-16, 0, 1.2246467991473532e-16, 0, 1, 0, 523.6891679748768, 34.536891679748834, 0, 1], 0, 0, true, [1, 0, -1.2246467991473532e-16, 0, 0, 1, 0, 0, 1.2246467991473532e-16, 0, 1, 0, 1704.1891679749642, 34.536891679748834, 0, 1], 0, 3, 569.9999999999945, 65, 17.5, false, "Polyline", 8, 2, 0, false, 0, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 569.9999999999945, 0, 1], 0, 0, true, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 2, 6, [26.888366718995428, -569.9999999999945], 0, [26.888366718995428, -526.2850109890051], 0, [65, -526.2850109890051], 0, [65, 0], 0, [0, 0], 0, [0, -569.9999999999945], 0, true, 0, 3, 0, 0, 0, 0, 0, 10, 0, "辅助条(上收口)", "", "", "", "", "", 0, 0, "**多种**", 2, 6, 1, 2, 1, 2, 3, 4, "2", "4", "3", "1", "", "", "", 6, "二合一", "铰链孔", "三合一", "二合一", "铰链孔", "不排", true, false, 0, 0, 0, 0, 0, 0, 0, 0, true, 0, 0], "basePt": { "x": -46.31083202511775, "y": 34.536891679748834, "z": 0 }, "ucs": [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1] };
let br = LoadBoardsFromFileData(d)[0];
br.ApplyMatrix(MakeMirrorMtx(new Vector3(1, 0, 0)));
br.Width = 88;
let f = new CADFiler;
f.WriteObject(br);
expect(f.Data).toMatchSnapshot();
}); });

@ -1,182 +1,371 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`板件镜像 1`] = ` exports[`板件镜像 1`] = `
CADFiler { Array [
"_datas": Array [ "Board",
"Board", 8,
8, 2,
2, 0,
0, false,
false, 0,
0, 2,
2, 0,
0, Array [
Array [ 0,
0, 1,
1, 0,
0, 0,
0, -1,
-1, 0,
0, 0,
0, 0,
0, 0,
0, 0,
0, -1,
-1, 0,
0, 3435.3422864514687,
3435.3422864514687, 444.811074718357,
444.811074718357, -21.352872036479766,
-21.352872036479766, 1,
1, ],
], 0,
0, 0,
0, true,
true, Array [
Array [ 1,
1, 0,
0, 0,
0, 0,
0, 0,
0, 1,
1, 0,
0, 0,
0, 0,
0, 0,
0, -1,
-1, 0,
0, 2671.3422864514687,
2671.3422864514687, 444.811074718357,
444.811074718357, -21.352872036479766,
-21.352872036479766, 1,
1, ],
], 0,
0, 3,
3, 764,
500.00000000000006,
18,
true,
"Polyline",
8,
2,
0,
false,
0,
7,
0,
Array [
1,
0,
0,
0,
0,
1,
0,
0,
0,
0,
1,
0,
0,
0,
0,
1,
],
0,
0,
true,
Array [
6.123233995736766e-17,
-1,
0,
0,
1,
6.123233995736766e-17,
0,
0,
0,
0,
1,
0,
0,
764,
0,
1,
],
0,
2,
4,
Array [
0,
764, 764,
],
0,
Array [
500,
764,
],
0,
Array [
500.00000000000006, 500.00000000000006,
18,
true,
"Polyline",
8,
2,
0,
false,
0,
7,
0,
Array [
1,
0,
0,
0,
0,
1,
0,
0,
0,
0,
1,
0,
0,
0,
0,
1,
],
0, 0,
],
0,
Array [
4.678150772742889e-14,
0, 0,
true, ],
Array [ 0,
6.123233995736766e-17, true,
-1, 0,
0, 3,
0, 1,
1, 1,
6.123233995736766e-17, 1,
0, 0,
0, 0,
0, 10,
0, 0,
1, "晨丰顶板",
0, "未命名",
0, "晨丰一字柜测试",
764, "",
0, "水曲柳(默认材质)",
1, "",
], 0,
1,
"**多种**",
2,
4,
2,
1,
4,
3,
"2",
"4",
"3",
"1",
"",
"",
"",
4,
"三合一",
"铰链孔",
"二合一",
"不排",
true,
true,
0,
0,
0,
0,
0,
0,
0,
0,
true,
0,
0,
]
`;
exports[`板镜像后板边数据错误 1`] = `
Array [
"Board",
8,
2,
0,
false,
0,
8,
0,
Array [
0, 0,
2, 1,
4,
Array [
0,
764,
],
0, 0,
Array [
500,
764,
],
0, 0,
Array [ 1,
500.00000000000006,
0,
],
0, 0,
Array [ 1.2246467991473532e-16,
4.678150772742889e-14,
0,
],
0, 0,
true, -1.2246467991473532e-16,
0, 0,
3,
1, 1,
0,
-523.6891679748768,
34.536891679748834,
0,
1, 1,
],
0,
0,
true,
Array [
-1,
0,
-1.2246467991473532e-16,
0,
0,
1, 1,
0, 0,
0, 0,
10, -1.2246467991473532e-16,
0,
1,
0, 0,
"晨丰顶板", -1704.1891679749642,
"未命名", 34.536891679748834,
"晨丰一字柜测试",
"",
"水曲柳(默认材质)",
"",
0, 0,
1, 1,
"**多种**", ],
2, 0,
4, 3,
2, 569.9999999999945,
88,
17.5,
false,
"Polyline",
8,
2,
0,
false,
0,
7,
0,
Array [
1, 1,
4,
3,
"2",
"4",
"3",
"1",
"",
"",
"",
4,
"三合一",
"铰链孔",
"二合一",
"不排",
true,
true,
0, 0,
0, 0,
0, 0,
0, 0,
1,
0,
0,
0, 0,
0, 0,
1,
0, 0,
0, 0,
true, 569.9999999999945,
0, 0,
1,
],
0,
0,
true,
Array [
1,
0,
0,
0,
0,
1,
0,
0,
0,
0,
1,
0,
0,
0,
0,
1,
],
0,
2,
6,
Array [
26.888366718995428,
-569.9999999999945,
],
0,
Array [
26.888366718995428,
-526.2850109890051,
],
0,
Array [
88,
-526.2850109890051,
],
0,
Array [
88,
0,
],
0,
Array [
0,
0,
],
0,
Array [
0, 0,
-569.9999999999945,
], ],
"readIndex": 0, 0,
} true,
0,
3,
0,
0,
0,
0,
0,
10,
0,
"辅助条(上收口)",
"",
"",
"",
"",
"",
0,
0,
"**多种**",
2,
6,
1,
2,
1,
2,
3,
4,
"2",
"4",
"3",
"1",
"",
"",
"",
6,
"二合一",
"铰链孔",
"三合一",
"二合一",
"铰链孔",
"不排",
true,
false,
0,
0,
0,
0,
0,
0,
0,
0,
true,
0,
0,
]
`; `;

@ -874,13 +874,43 @@ export class Board extends ExtrudeSolid
return this; return this;
} }
let hasSplitSize = (this.BoardProcessOption[EBoardKeyList.SpliteHeight]
&& this.BoardProcessOption[EBoardKeyList.SpliteWidth]
&& this.BoardProcessOption[EBoardKeyList.SpliteThickness]
);
let highSeals = GetBoardHighSeal(this, GetBoardSealingCurves(this)); let highSeals = GetBoardHighSeal(this, GetBoardSealingCurves(this));
super.ApplyMirrorMatrix(m); super.ApplyMirrorMatrix(m);
if (this.contourCurve && this.contourCurve.Area2 < 0)
{
this.contourCurve.Reverse();
highSeals.reverse();
this.BoardProcessOption.highSealed?.reverse();
this.BoardProcessOption.highDrill?.reverse();
if (hasSplitSize)
{
[
this.BoardProcessOption.sealedUp,
this.BoardProcessOption.sealedLeft,
this.BoardProcessOption.sealedDown,
this.BoardProcessOption.sealedRight,
]
=
[
this.BoardProcessOption.sealedUp,
this.BoardProcessOption.sealedRight,
this.BoardProcessOption.sealedDown,
this.BoardProcessOption.sealedLeft,
];
}
}
this.BoardProcessOption.highSealed = highSeals; this.BoardProcessOption.highSealed = highSeals;
if (this.isRect) if (!hasSplitSize && this.isRect)
HandleRectBoardSealingData(this, highSeals); HandleRectBoardSealingData(this, highSeals);
//重新构建SpaceOCS //重新构建SpaceOCS
this._SpaceOCS.multiplyMatrices(this._Matrix, new Matrix4().getInverse(this.RotateMat)); this._SpaceOCS.multiplyMatrices(this._Matrix, new Matrix4().getInverse(this.RotateMat));

@ -238,17 +238,32 @@ export function CalcEdgeSealing(cus: Curve[], highSeals?: IHighSealedItem[])
return true; return true;
} }
export function GetBoardHighSeal(br: Board, sealcus: Curve[]) //与GetBoardSealingCurves相关
export function GetBoardHighSeal(br: Board, sealcus: Curve[]): IHighSealedItem[]
{ {
let highSeals = br.BoardProcessOption.highSealed.slice().filter(d => d.size !== null && d.size !== undefined); if (br.BoardProcessOption[EBoardKeyList.SpliteHeight]
let sealDown = parseFloat(br.BoardProcessOption[EBoardKeyList.DownSealed]); && br.BoardProcessOption[EBoardKeyList.SpliteWidth]
let sealUp = parseFloat(br.BoardProcessOption[EBoardKeyList.UpSealed]); && br.BoardProcessOption[EBoardKeyList.SpliteThickness]
let sealLeft = parseFloat(br.BoardProcessOption[EBoardKeyList.LeftSealed]); )
let sealRight = parseFloat(br.BoardProcessOption[EBoardKeyList.RightSealed]); {
return [
{ size: parseFloat(br.BoardProcessOption.sealedDown) },
{ size: parseFloat(br.BoardProcessOption.sealedRight) },
{ size: parseFloat(br.BoardProcessOption.sealedUp) },
{ size: parseFloat(br.BoardProcessOption.sealedLeft) },
];
}
let highSeals = br.BoardProcessOption.highSealed.filter(d => d.size !== null && d.size !== undefined);
//若未设置高级封边,把上下左右封边存入高级封边 //若未设置高级封边,把上下左右封边存入高级封边
if (sealcus.length !== highSeals.length || !br.IsSpecialShape) if (sealcus.length !== highSeals.length || !br.IsSpecialShape)
{ {
let sealDown = parseFloat(br.BoardProcessOption[EBoardKeyList.DownSealed]);
let sealUp = parseFloat(br.BoardProcessOption[EBoardKeyList.UpSealed]);
let sealLeft = parseFloat(br.BoardProcessOption[EBoardKeyList.LeftSealed]);
let sealRight = parseFloat(br.BoardProcessOption[EBoardKeyList.RightSealed]);
highSeals.length = 0; highSeals.length = 0;
let dir = Math.sign(br.ContourCurve.Area2); let dir = Math.sign(br.ContourCurve.Area2);
for (let c of sealcus) for (let c of sealcus)

@ -197,6 +197,14 @@ export class BoardProcessModal extends React.Component<BoardProcessProps, {}>{
return (obj as ProcessingGroupRecord).Name; return (obj as ProcessingGroupRecord).Name;
}); });
}; };
private isSplit()
{
return (
this.props.br.BoardProcessOption.spliteHeight
&& this.props.br.BoardProcessOption.spliteWidth
&& this.props.br.BoardProcessOption.spliteThickness
) ? true : false;
}
async UNSAFE_componentWillMount() async UNSAFE_componentWillMount()
{ {
this.updateTags(); this.updateTags();
@ -381,7 +389,7 @@ export class BoardProcessModal extends React.Component<BoardProcessProps, {}>{
<h6 className={"edge-sealing " + Classes.HEADING}> <h6 className={"edge-sealing " + Classes.HEADING}>
{ {
isShowHighEditor && this.props.isSpecial.get() && isShowHighEditor && this.props.isSpecial.get() && !this.isSplit() &&
<Button <Button
text="高级编辑" text="高级编辑"
style={{ style={{
@ -397,7 +405,7 @@ export class BoardProcessModal extends React.Component<BoardProcessProps, {}>{
} }
</h6> </h6>
{ {
(!this.props.br || !this.props.isSpecial.get()) && <Input5Or4Component (!this.props.br || (!this.props.isSpecial.get() || this.isSplit())) && <Input5Or4Component
type={CheckObjectType.BR} type={CheckObjectType.BR}
showDirectionIcon={true} showDirectionIcon={true}
hasCenter={false} hasCenter={false}
@ -415,4 +423,5 @@ export class BoardProcessModal extends React.Component<BoardProcessProps, {}>{
</div> </div>
); );
} }
} }

Loading…
Cancel
Save