!2617 优化:修改排钻智能偏移后提示类型

pull/2610/MERGE
林三 7 months ago committed by ChenX
parent 9e1243f3a0
commit 5c33ca0fd1

@ -56,8 +56,8 @@ export class DrawDrillingTool extends Singleton
private _hasBackupOption = false;
private _useBackup = false;
private _isDrillTouch = false;//排钻或木销与造型碰撞
private _HasAutoDeviation = false; //有自动偏移
private _AutoDeviation = false; //智能偏移
// private _DrillSpaceDist = 0; //智能偏移最大距离
constructor()
{
@ -530,7 +530,7 @@ export class DrawDrillingTool extends Singleton
};
}
private _InteractionLog = (msg: string) =>
private _InteractionLog = (msg: string, logType = LogType.Warning) =>
{
InteractionLog([
{
@ -547,7 +547,7 @@ export class DrawDrillingTool extends Singleton
{
msg: msg
}
], LogType.Warning);
], logType);
};
private BuildDrill()
@ -573,16 +573,11 @@ export class DrawDrillingTool extends Singleton
}
else if (this._AutoDeviation && !this.m_Face.Segment1D.find(([a, b]) => dist >= a && dist <= b)?.length)
{
this._isDrillTouch = true;
//智能偏移
let { closestNum, closestDist } = FindClosestInterval(dist, this.m_Face.Segment1D, this.m_Option.spacing === SpacingType.Multiple32 ? 32 : 16, this.m_Face.Length);
//偏移距离过大时 跳过绘制
// if (closestNum && closestDist > this._DrillSpaceDist)
// {
// this._InteractionLog("有排钻与造型碰撞偏移,偏移位置过大,跳过绘制");
// continue;
// }
this._InteractionLog("有排钻与造型碰撞,自动偏移");
let { closestNum } = FindClosestInterval(dist, this.m_Face.Segment1D, this.m_Option.spacing === SpacingType.Multiple32 ? 32 : 16, this.m_Face.Length);
this._HasAutoDeviation = true;
this._InteractionLog("有排钻与造型碰撞,或不在合适位置,自动偏移", LogType.Info);
dist = closestNum;
}
else if (this.CheckModelingCollision(localBox3, intBox3, dist))
@ -673,13 +668,13 @@ export class DrawDrillingTool extends Singleton
{
if (!FindInWall(dist, this.m_Face.Segment1D))
{
this._isDrillTouch = true;
this._HasAutoDeviation = true;
//智能偏移
let { closestNum, closestDist } = FindClosestInterval(dist, this.m_Face.Segment1D, this.m_Option.spacing === SpacingType.Multiple32 ? 32 : 16, this.m_Face.Length);
// if (closestNum && closestDist < this._DrillSpaceDist)
{
dist = closestNum;
this._InteractionLog("有木销与造型碰撞,自动偏移");
this._InteractionLog("有木销与造型碰撞,自动偏移", LogType.Info);
}
// else
// {
@ -924,7 +919,8 @@ export class DrawDrillingTool extends Singleton
this.m_Face.Segment1D = Segment1dSubtraction2(oldSegment1D, [posSegment1D]);
//放置的位置加入不可释放区间
this.m_Face.FixedInterval.push(posSegment1D);
this._InteractionLog(`${isWoodPinss ? "木销" : "通孔排钻"}偏移后与造型碰撞,自动偏移`);
this._InteractionLog(`${isWoodPinss ? "木销" : "通孔排钻"}偏移后与造型碰撞,自动偏移`, LogType.Info);
this._HasAutoDeviation = true;
}
// else
// {
@ -1282,6 +1278,7 @@ export class DrawDrillingTool extends Singleton
let checkRes = new CollisionDetection(await this.GetSpliteBoards(brs));
this._isDrillTouch = false;
this._HasAutoDeviation = false;
for (let f of checkRes.CollisonFaces)
{
@ -1295,11 +1292,20 @@ export class DrawDrillingTool extends Singleton
if (this._isDrillTouch)
{
AppToaster.show({
message: `有部分排钻或木销与造型碰撞,${this.m_Option.autoDeviation ? "自动偏移" : "跳过绘制"},详情查看左下角`,
message: `有部分排钻或木销与造型碰撞, 跳过绘制,详情查看左下角`,
timeout: 10000,
intent: Intent.DANGER,
}, "DrillTouchToaster");
}
if (this._HasAutoDeviation)
{
AppToaster.show({
message: `有部分排钻自动偏移到合适位置,详情查看左下角`,
timeout: 10000,
intent: Intent.PRIMARY
}, "DrillTouchToaster");
}
}
private Exec(f: Face, isBackup = false)

Loading…
Cancel
Save