警告:对于超短板件,现在会提示用户

pull/1319/head
ChenX 4 years ago
parent 90e7f0af92
commit 2393e6e433

@ -13,15 +13,21 @@ export class BoardLinesReactor
{ {
if (app.Viewer.isLayout) return; if (app.Viewer.isLayout) return;
let hasMaxSize = false; let hasMaxSize = false;
let hasShortBoard = false;
for (let ent of changeObjects) for (let ent of changeObjects)
{ {
if (this.AutoChangeBoardLines(ent)) if (this.AutoChangeBoardLines(ent))
hasMaxSize = true; hasMaxSize = true;
else if (BoardIsShort(ent))
hasShortBoard = true;
} }
for (let ent of createObjects) for (let ent of createObjects)
if (this.AutoChangeBoardLines(ent)) if (this.AutoChangeBoardLines(ent))
hasMaxSize = true; hasMaxSize = true;
else if (BoardIsShort(ent))
hasShortBoard = true;
if (hasMaxSize && userConfig.maxSize.isShow) if (hasMaxSize && userConfig.maxSize.isShow)
{ {
AppConfirm.show({ AppConfirm.show({
@ -29,6 +35,12 @@ export class BoardLinesReactor
hasCancel: false, hasCancel: false,
}); });
} }
if (hasShortBoard)
AppConfirm.show({
message: "检测到有超短板件",
hasCancel: false,
});
}); });
} }
@ -74,3 +86,10 @@ export function BoardIsLong(br: Board, lines = br.BoardProcessOption.lines): boo
return Math.max(br.Height, br.Width) > maxHeight return Math.max(br.Height, br.Width) > maxHeight
|| Math.min(br.Height, br.Width) > maxWidth; || Math.min(br.Height, br.Width) > maxWidth;
} }
export function BoardIsShort(br: CADObject): boolean
{
if (br instanceof Board)
return br.Width < 2 || br.Height < 2 || br.Thickness < 1;
return false;
}

Loading…
Cancel
Save