!1202 优化:见光面封边,封边,排钻,干涉问题

pull/1202/MERGE
ZoeLeeFZ 4 years ago committed by ChenX
parent 6ada6850d3
commit 915e40c37b

@ -34,4 +34,4 @@ exports[`异型板件,非相切圆弧 1`] = `635612.2751433642`;
exports[`异型板件,非相切圆弧 2`] = `626242.2196800549`; exports[`异型板件,非相切圆弧 2`] = `626242.2196800549`;
exports[`椭圆弧封边 1`] = `23838.801571523727`; exports[`椭圆弧封边 1`] = `23816.280001572693`;

@ -14,12 +14,23 @@ import { SaveAsModal } from "../UI/Components/Modal/SavaAsModal";
import { AppToaster } from "../UI/Components/Toaster"; import { AppToaster } from "../UI/Components/Toaster";
import { Purge } from './Purge'; import { Purge } from './Purge';
import { userConfig } from '../Editor/UserConfig'; import { userConfig } from '../Editor/UserConfig';
import { TempEditor } from '../Editor/TempEditor';
export class Save implements Command export class Save implements Command
{ {
NoHistory = true; NoHistory = true;
async exec() async exec()
{ {
if (TempEditor.EditorIng)
{
AppToaster.show({
message: "请先退出编辑模式在保存",
timeout: 3000,
intent: Intent.WARNING
}, "warning");
return;
}
if (app.Saved) if (app.Saved)
{ {
app.Editor.Prompt("文件已保存!"); app.Editor.Prompt("文件已保存!");

@ -66,11 +66,8 @@ class SetSmoothEdgeFaces extends BoardGetFace
{ {
for (let f1 of this.Faces) for (let f1 of this.Faces)
{ {
if (this.SmoothFace.has(f1)) continue;
for (let f2 of bg.Faces) for (let f2 of bg.Faces)
{ {
if (bg.SmoothFace.has(f2)) continue;
//都是正面,或者不允许侧面同侧面并且2板件类型不一样就跳过 //都是正面,或者不允许侧面同侧面并且2板件类型不一样就跳过
if (f1.type === f2.type if (f1.type === f2.type
&& (f1.type === BoardFaceType.NoSide || bg.Board.BoardType !== this.Board.BoardType) && (f1.type === BoardFaceType.NoSide || bg.Board.BoardType !== this.Board.BoardType)
@ -99,6 +96,14 @@ class SetSmoothEdgeFaces extends BoardGetFace
continue; continue;
} }
if (f1.type === f2.type)
{
if (f1.IsIntersect(f2, scale))
this.SmoothFace.add(f1);
if (f2.IsIntersect(f1, scale))
bg.SmoothFace.add(f2);
}
else
if (f1.IsIntersect(f2, scale)) if (f1.IsIntersect(f2, scale))
{ {
if (f1.type === BoardFaceType.Side) if (f1.type === BoardFaceType.Side)

@ -72,9 +72,10 @@ export class CheckInterfereTool
let RelativeHardware: Set<ObjectId>; let RelativeHardware: Set<ObjectId>;
if (e1 instanceof Board) if (e1 instanceof Board)
{ {
RelevanceMeats = new Set(e1.RelevanceMeats); let tempEn = e1.__OriginalEnt__ ?? e1;
RelevanceKnifs = new Set(e1.RelevanceKnifs); RelevanceMeats = new Set(tempEn.RelevanceMeats);
RelativeHardware = new Set(e1.RelativeHardware); RelevanceKnifs = new Set(tempEn.RelevanceKnifs);
RelativeHardware = new Set(tempEn.RelativeHardware);
} }
let RelevanceBoards: Set<ObjectId>; let RelevanceBoards: Set<ObjectId>;

@ -85,7 +85,7 @@ export class Face
//如果不是矩形,用布尔运算,如果 //如果不是矩形,用布尔运算,如果
if (!noSideFace.IsRect || !canUseBoxCalc) if (!noSideFace.IsRect || !canUseBoxCalc)
{ {
let sideReg = sideFace.Region; let sideReg = sideFace.Region.Clone();
if (!sideReg || !noSideFace.Region) return []; if (!sideReg || !noSideFace.Region) return [];
let toReg = noSideFace.Region.Clone().ApplyMatrix(diffMtx); let toReg = noSideFace.Region.Clone().ApplyMatrix(diffMtx);
@ -171,7 +171,7 @@ export class Face
return false; return false;
let pts = c1.IntersectWith(c2, 0); let pts = c1.IntersectWith(c2, 0);
if (pts.length <= 1) return false; if (pts.length <= 1) return true;
new Box3Ext().setFromPoints(pts).getSize(size); new Box3Ext().setFromPoints(pts).getSize(size);

@ -195,11 +195,11 @@ export function GetBoardHighSeal(br: Board, sealcus: Curve[])
{ {
let derv = c.GetFistDeriv(0).multiplyScalar(dir); let derv = c.GetFistDeriv(0).multiplyScalar(dir);
let an = angle(derv); let an = angle(derv);
if (an > -1e-6 && an < Math.PI / 2) if (equaln(an, 0) || (an < Math.PI / 4 + 1e-8 && an > Math.PI * 7 / 4))
highSeals.push({ size: sealDown }); highSeals.push({ size: sealDown });
else if (an > Math.PI / 2 - 1e-6 && an < Math.PI) else if (an > Math.PI / 4 && an < Math.PI * 3 / 4 + 1e-8)
highSeals.push({ size: sealRight }); highSeals.push({ size: sealRight });
else if (an > Math.PI - 1e-6 && an < Math.PI * 3 / 2) else if (an > Math.PI * 3 / 4 && an < Math.PI * 5 / 4 + 1e-8)
highSeals.push({ size: sealUp }); highSeals.push({ size: sealUp });
else else
highSeals.push({ size: sealLeft }); highSeals.push({ size: sealLeft });

@ -84,6 +84,12 @@ export class IndexedDbStore
this.dbRequest.onsuccess = (event) => this.dbRequest.onsuccess = (event) =>
{ {
this.db = this.dbRequest.result; this.db = this.dbRequest.result;
this.db.onclose = (ev) =>
{
console.error("数据库已经关闭关闭");
this.db = null;
this.opening = false;
};
this.resFunctionList.forEach(res => res(true)); this.resFunctionList.forEach(res => res(true));
}; };

Loading…
Cancel
Save