!2312 功能:板添加排钻锁定功能

pull/2608/MERGE
黄诗津 7 months ago committed by ChenX
parent 20536fc8d3
commit b145c09fa4

@ -48,9 +48,9 @@ export class BatchModify implements Command
if (keyRes.Status !== PromptStatus.Keyword) return;
const store = RightPanelStore.GetInstance();
store.m_IsShow = true;
if (keyRes.StringResult === "S")
{
store.m_IsShow = true;
store.sealingStore.isNotUpdateStore = true;
let config = new DialogUserConfig(store.sealingStore, BoardModalType.Sealing);
await config.LoadAndInitConfig();
@ -64,10 +64,29 @@ export class BatchModify implements Command
}
else if (keyRes.StringResult === "D")
{
let unlockDrillBoard = brs.filter(br => !br.DrillLock);
if (unlockDrillBoard.length != brs.length)
{
AppToaster.show({
message: "选中的板存在独立排钻锁,独立排钻锁的板不可以修改",
timeout: 5000,
intent: Intent.WARNING,
});
}
if (!unlockDrillBoard.length)
{
AppToaster.show({
message: "当前没有可以修改的板",
timeout: 5000,
intent: Intent.WARNING,
});
return;
}
store.m_IsShow = true;
store.m_TabId = RightTabId.Drill;
setTimeout(() => //当前命令结束后在进入编辑
{
store.drillingStore.StartEditor(brs);
store.drillingStore.StartEditor(unlockDrillBoard);
}, 0);
}
else if (keyRes.StringResult === "R")

@ -174,7 +174,7 @@ export class UpdateBoardInfos implements Command
br.GroovesAddWidth = parseFloat(option[i]) || 0;
break;
case "upDrill":
if (option.highDrill.length === 4 && !br.IsSpecialShape)
if (option.highDrill.length === 4 && !br.IsSpecialShape && !br.DrillLock)
{
let index = DRILL_KEYS.indexOf(i);
ParseBoardRectHoleType(br, drillOption);
@ -183,7 +183,7 @@ export class UpdateBoardInfos implements Command
}
break;
case "downDrill":
if (option.highDrill.length === 4 && !br.IsSpecialShape)
if (option.highDrill.length === 4 && !br.IsSpecialShape && !br.DrillLock)
{
let index = DRILL_KEYS.indexOf(i);
ParseBoardRectHoleType(br, drillOption);
@ -192,7 +192,7 @@ export class UpdateBoardInfos implements Command
}
break;
case "leftDrill":
if (option.highDrill.length === 4 && !br.IsSpecialShape)
if (option.highDrill.length === 4 && !br.IsSpecialShape && !br.DrillLock)
{
let index = DRILL_KEYS.indexOf(i);
ParseBoardRectHoleType(br, drillOption);
@ -201,7 +201,7 @@ export class UpdateBoardInfos implements Command
}
break;
case "rightDrill":
if (option.highDrill.length === 4 && !br.IsSpecialShape)
if (option.highDrill.length === 4 && !br.IsSpecialShape && !br.DrillLock)
{
let index = DRILL_KEYS.indexOf(i);
ParseBoardRectHoleType(br, drillOption);

@ -416,28 +416,28 @@ export class BoardFindModify implements Command
}
break;
case "upDrill":
if (!br.IsSpecialShape)
if (!br.IsSpecialShape && !br.DrillLock)
{
let index = DRILL_KEYS.indexOf(i);
drillOption.up = option.highDrill[index];
}
break;
case "downDrill":
if (!br.IsSpecialShape)
if (!br.IsSpecialShape && !br.DrillLock)
{
let index = DRILL_KEYS.indexOf(i);
drillOption.down = option.highDrill[index];
}
break;
case "leftDrill":
if (!br.IsSpecialShape)
if (!br.IsSpecialShape && !br.DrillLock)
{
let index = DRILL_KEYS.indexOf(i);
drillOption.left = option.highDrill[index];
}
break;
case "rightDrill":
if (!br.IsSpecialShape)
if (!br.IsSpecialShape && !br.DrillLock)
{
let index = DRILL_KEYS.indexOf(i);
drillOption.right = option.highDrill[index];

@ -80,6 +80,7 @@ export class DeleteDrill implements Command
}
return;
case EDeleteDrillType.Face:
ens = ens.filter((br: Board) => !br.DrillLock); //锁定排钻的板不参与计算
DrawDrillingTool.GetInstance().ClearExitDrilling(ens as Board[]);
return;
case EDeleteDrillType.Nail:

@ -1242,7 +1242,7 @@ export class DrawDrillingTool extends Singleton
this._hasBackupOption = this.HasConfig(f.DrillType + "_备选");
}
}
private ClassifyBoardList(brList: Board[] | Set<Board>): Map<string, Board[]>
private ClassifyBoardList(brList: Board[]): Map<string, Board[]>
{
let brMap: Map<string, Board[]> = new Map();
//根据柜名房名分类
@ -1256,17 +1256,24 @@ export class DrawDrillingTool extends Singleton
}
return brMap;
}
/**
* :,
*/
ClearExitDrilling(brs: Board[])
{
for (let i = 0; i < brs.length; i++)
{
let br = brs[i];
br.ClearDrillList(undefined);//删除仅与自身关联的排钻
for (let j = i + 1; j < brs.length; j++)
{
//没修改的板件之间不清除排钻
if (br.TempData?.unChange && brs[j].TempData?.unChange)
continue;
if (brs[j].DrillAssociationLock.has(br.Id)) continue; //如果关联排钻锁Id存在,就不删除
br.ClearDrillList(brs[j].Id);
}
}
@ -1279,6 +1286,8 @@ export class DrawDrillingTool extends Singleton
for (let f of checkRes.CollisonFaces)
{
if (f.InterBoard.DrillLock || f.InterBoard.DrillAssociationLock.has(f.LocalBoard.Id)) continue; //如果有排钻锁就不用更新
this.Exec(f, false);
if (this._useBackup)
this.Exec(f, true);
@ -1303,6 +1312,7 @@ export class DrawDrillingTool extends Singleton
if (suitableOptions.length === 0)
{
app.Editor.Prompt("碰撞面长度" + f.Length + "没有合适的规则,或者当前配置不存在" + f.DrillType + "类型排钻", LogType.Error, [f.LocalBoard, f.InterBoard].filter(e => e));
app.Editor.Prompt("长度" + f.Length + "没有合适的规则,或者当前配置不存在" + f.DrillType + "类型排钻", LogType.Error);
return;
}
for (let suitableOption of suitableOptions)
@ -1379,28 +1389,18 @@ export class DrawDrillingTool extends Singleton
}
/**分类并排钻 */
async ClassifyAndDrilling(brList: Board[] | Set<Board>): Promise<void>
async ClassifyAndDrilling(brList: Board[]): Promise<void> //保持一下数据类型统一就这么难吗
{
if (brList instanceof Set)
{
if (brList.size < 2) return;
}
else if (brList.length < 2) return;
brList = brList.filter(br => !br.DrillLock); //锁定排钻的板不参与计算
if (brList.length < 2) return;
//清理掉已经存在的排钻
this.ClearExitDrilling([...brList]);
this.ClearExitDrilling(brList);
this._collsionFaces.length = 0;
//拆单尺寸的板件不排钻
if (brList instanceof Set)
{
for (let br of brList)
if (this.IsSplitBoard(br))
brList.delete(br);
}
else
arrayRemoveIf(brList, (br) => this.IsSplitBoard(br));
arrayRemoveIf(brList, (br) => this.IsSplitBoard(br));
let brMap = this.ClassifyBoardList(brList);
for (let [, bs] of brMap)

@ -0,0 +1,45 @@
import { Intent } from "@blueprintjs/core";
import { app } from "../../../ApplicationServices/Application";
import { Board } from "../../../DatabaseServices/Entity/Board";
import { Command } from "../../../Editor/CommandMachine";
import { AppToaster } from "../../../UI/Components/Toaster";
export class AllDrillUnlock implements Command
{
async exec()
{
//所有存在排钻锁的板
const associationBoards = app.Database.ModelSpace.Entitys.filter(br =>
{
if (!br.IsErase && br instanceof Board)
{
if (br.DrillLock === true || br.DrillAssociationLock.size > 0)
return true;
}
return false;
}) as Board[];
if (associationBoards.length)
{
for (const associationBoard of associationBoards)
{
associationBoard.ClearAllDrillLock();
}
AppToaster.show({
message: `解除所有排钻锁成功`,
intent: Intent.SUCCESS,
timeout: 3000,
});
}
else
{
AppToaster.show({
message: `当前没有板设置了排钻锁`,
intent: Intent.WARNING,
timeout: 3000,
});
}
}
}

@ -0,0 +1,67 @@
import { Intent } from "@blueprintjs/core";
import { app } from "../../../ApplicationServices/Application";
import { Log, LogType } from "../../../Common/Log";
import { Board } from "../../../DatabaseServices/Entity/Board";
import { Command } from "../../../Editor/CommandMachine";
import { PromptStatus } from "../../../Editor/PromptResult";
import { AppToaster } from "../../../UI/Components/Toaster";
export class AssociationLock implements Command
{
async exec()
{
const BoardRes = await app.Editor.GetEntity({
Msg: "请选择锁定排钻的板",
Filter: { filterTypes: [Board] }
});
if (BoardRes.Status !== PromptStatus.OK) return;
const FirstBoard = BoardRes.Entity as Board;
const FirstBoardId = FirstBoard.Id;
const drillAssociationLock = FirstBoard.DrillAssociationLock;
const associationBoards = [...drillAssociationLock].map(o => o.Object as Board); //读取第一块板关联锁定的板集合
const existAssociationBoards = associationBoards.filter(br => !br.IsErase); //存在的板
if (existAssociationBoards.length)
{
app.Editor.SetSelection(existAssociationBoards); //亮显关联的板
AppToaster.show({
message: `当前板已存在${existAssociationBoards.length}块关联的板,已显示当前关联过的板`,
intent: Intent.PRIMARY,
timeout: 3000,
});
}
const associationBoardRes = await app.Editor.GetSelection({
Msg: "请选择需要关联锁定排钻的板",
Filter: {
filterTypes: [Board],
filterFunction: (obj, ent) =>
{
if (ent.Id === FirstBoardId)
return false;
return true;
}
}
});
if (associationBoardRes.Status === PromptStatus.OK)
{
const associationBoards = associationBoardRes.SelectSet.SelectEntityList as Board[];
for (const associationBoard of associationBoards)
{
const associationBoardId = associationBoard.Id;
FirstBoard.AppendDrillAssociationLock(associationBoardId);
associationBoard.AppendDrillAssociationLock(FirstBoardId);
}
AppToaster.show({
message: `排钻关联锁定成功,共关联了${associationBoards.length}块板`,
intent: Intent.SUCCESS,
timeout: 3000,
});
Log(`排钻关联锁定成功,共关联了${associationBoards.length}块板`, LogType.Info, [...associationBoards]);
}
}
}

@ -0,0 +1,105 @@
import { app } from "../../../ApplicationServices/Application";
import { Log, LogType } from "../../../Common/Log";
import { Intent } from "../../../Common/Toaster";
import { Board } from "../../../DatabaseServices/Entity/Board";
import { Command } from "../../../Editor/CommandMachine";
import { PromptStatus } from "../../../Editor/PromptResult";
import { AppToaster } from "../../../UI/Components/Toaster";
export class AssociationUnlock implements Command
{
async exec()
{
const associationBoardIndex = app.Database.ModelSpace.Entitys.findIndex(ent =>
{
if (!ent.IsErase && ent instanceof Board)
{
return Boolean(ent.DrillAssociationLock.size);
}
return false;
});
if (associationBoardIndex === -1)
{
AppToaster.show({
message: "不存在关联排钻锁定的板",
intent: Intent.WARNING,
timeout: 2000,
});
return;
}
while (true)
{
const BoardRes = await app.Editor.GetEntity({
Msg: "请选择解除排钻锁定的板",
Filter: { filterTypes: [Board] }
});
if (BoardRes.Status !== PromptStatus.OK) return;
const FirstBoard = BoardRes.Entity as Board;
const drillAssociationLock = FirstBoard.DrillAssociationLock;
const associationBoards = [...drillAssociationLock.values()].map(o => o.Object as Board); //读取第一块板关联锁定的板集合
if (!associationBoards.length)
{
AppToaster.show({
message: "当前板不存在关联排钻锁定的板",
intent: Intent.WARNING,
timeout: 2000,
});
continue;
}
while (true)
{
const DisassociateBoardRes = await app.Editor.GetSelection({
Msg: "请选择需要解除关联锁定的板",
Filter: {
filterTypes: [Board],
filterFunction: (obj, ent) =>
{
return associationBoards.some(br => br.objectId === ent.objectId);
}
},
KeyWordList: [{ key: "A", msg: "选中所有关联的板" }]
});
if (DisassociateBoardRes.Status === PromptStatus.Keyword)
{
if (DisassociateBoardRes.StringResult === "A")
{
app.Editor.SetSelection(associationBoards); //亮显关联的板
}
}
else if (DisassociateBoardRes.Status === PromptStatus.OK)
{
const disassociateBoards = DisassociateBoardRes.SelectSet.SelectEntityList as Board[]; //取消关联的板
DisassociateBoard(disassociateBoards, FirstBoard);
return;
}
else
return;
}
}
//解除板排钻锁关联
function DisassociateBoard(brs: Board[], FirstBoard: Board)
{
for (const br of brs)
{
const associationBoardId = br.Id;
FirstBoard.ClearDrillAssociationLock(associationBoardId);
br.ClearDrillAssociationLock(FirstBoard.Id);
}
AppToaster.show({
message: `排钻关联解除锁定成功,共解除了${brs.length}块板`,
intent: Intent.SUCCESS,
timeout: 3000,
});
Log(`排钻关联解除锁定成功,共解除了${brs.length}块板`, LogType.Info, [...brs]);
}
}
}

@ -0,0 +1,114 @@
import { Intent } from "@blueprintjs/core";
import { app } from "../../../ApplicationServices/Application";
import { Log, LogType } from "../../../Common/Log";
import { Board } from "../../../DatabaseServices/Entity/Board";
import { Command } from "../../../Editor/CommandMachine";
import { PromptStatus } from "../../../Editor/PromptResult";
import { AppToaster } from "../../../UI/Components/Toaster";
export class IndependentLockAndUnLock implements Command
{
private isLock: boolean;
constructor(isLock: boolean)
{
this.isLock = isLock;
}
async exec()
{
const lockBoards = app.Database.ModelSpace.Entitys.filter(ent =>
{
if (!ent.IsErase && ent instanceof Board)
{
return Boolean(ent.DrillLock === true);
}
return false;
}) as Board[];
if (this.isLock)
{
if (lockBoards.length)
{
app.Editor.SetSelection(lockBoards); //亮显关联的板
AppToaster.show({
message: `已存在${lockBoards.length}块排钻锁定的板,以显示锁定的板`,
intent: Intent.PRIMARY,
timeout: 3000,
});
}
let brRes = await app.Editor.GetSelection({
Msg: "请选择需要排钻锁定的板",
Filter: { filterTypes: [Board] },
});
if (brRes.Status === PromptStatus.OK)
{
const brs = brRes.SelectSet.SelectEntityList as Board[];
for (let ent of brs)
{
ent.DrillLock = this.isLock;
}
AppToaster.show({
message: `成功锁定${brs.length}块板`,
intent: Intent.SUCCESS,
timeout: 3000,
});
Log(`成功锁定${brs.length}块板`, LogType.Info, [...brs]);
}
}
else
{
if (!lockBoards.length)
{
AppToaster.show({
message: `当前图纸没有排钻锁定的板`,
intent: Intent.WARNING,
timeout: 3000,
});
return;
}
while (true)
{
let brRes = await app.Editor.GetSelection({
Msg: "请选择需要解除排钻锁定的板",
Filter: {
filterTypes: [Board],
filterFunction: (obj, ent) =>
{
return (ent as Board).DrillLock;
}
},
KeyWordList: [{ key: "A", msg: "选中所有已锁定排钻的板" }]
});
if (brRes.Status === PromptStatus.Keyword)
{
if (brRes.StringResult === "A")
{
app.Editor.SetSelection(lockBoards); //亮显关联的板
}
}
else if (brRes.Status === PromptStatus.OK)
{
const brs = brRes.SelectSet.SelectEntityList as Board[];
for (let ent of brs)
{
ent.DrillLock = this.isLock;
}
AppToaster.show({
message: `成功解除锁定${brs.length}块板`,
intent: Intent.SUCCESS,
timeout: 3000,
});
Log(`成功解除锁定${brs.length}块板`, LogType.Info, [...brs]);
break;
}
else
break;
}
}
}
}

@ -106,7 +106,6 @@ export class DrillingReactor
{
if (!e.IsErase)
{
e.ClearAllDrillList();
brs.add(e);
}
}
@ -148,10 +147,11 @@ export class DrillingReactor
brs.add(br);
}
const arrBrs = [...brs];
const tool = DrawDrillingTool.GetInstance();
await tool.ClassifyAndDrilling(brs);
await tool.ClassifyAndDrilling(arrBrs);
for (let br of brs)
for (let br of arrBrs)
{
if (br.TempData?.unChange)
br.TempData = undefined;

@ -167,6 +167,11 @@ export enum CommandNames
DimStyle = "DIMSTYLE",
TextStyle = "TEXTSTYLE",
ToggleDrillingReactor = "TOGGLEDRILLINGREACTOR",
IndependentDrillLock = "INDEPENDENTDRILLLOCK",
AssociationDrillLock = "ASSOCIATIONDRILLLOCK",
IndependentDrillUnlock = "INDEPENDENTDRILLUNLOCK",
AssociationDrillUnlock = "ASSOCIATIONDRILLUNLOCK",
AllDrillUnlock = "ALLDRILLUNLOCK",
Esc = "ESC",
Wireframe = "WIREFRAME",
Conceptual = "CONCEPTUAL",

@ -121,6 +121,8 @@ export class Board extends ExtrudeSolid
private _2DModelingList: I2DModeling[] = [];
private _3DModelingList: I3DModeling[] = [];
private _CustomNumber: number = null;//自定义编号
private _DrillLock = false; //排钻独立锁
private _DrillAssociationLock = new Set<ObjectId>(); //排钻关联锁
//仅在渲染器中使用倒角
//del_exp_start//del_exp_end protected bevelEnabled: boolean = true;
@ -287,6 +289,39 @@ export class Board extends ExtrudeSolid
return this._DrillList;
}
get DrillLock()
{
return this._DrillLock;
}
set DrillLock(v: boolean)
{
this.WriteAllObjectRecord();
this._DrillLock = v;
}
get DrillAssociationLock(): Set<ObjectId>
{
return this._DrillAssociationLock;
}
AppendDrillAssociationLock(o: ObjectId)
{
this.WriteAllObjectRecord();
this._DrillAssociationLock.add(o);
}
ClearDrillAssociationLock(o: ObjectId)
{
this.WriteAllObjectRecord();
this._DrillAssociationLock.delete(o);
}
ClearAllDrillLock()
{
this.WriteAllObjectRecord();
this._DrillLock = false;
this._DrillAssociationLock.clear();
}
get LayerNails()
{
return this._LayerNails;
@ -694,6 +729,14 @@ export class Board extends ExtrudeSolid
if (d && d.Object)
d.Object.Erase();
}
for (const br of this._DrillAssociationLock) //删除排钻锁关联板的信息
{
if (br?.Object instanceof Board)
{
br.Object.ClearDrillAssociationLock(this.Id);
}
}
this.ClearLayerNails();
}
get RotateMat()
@ -2068,12 +2111,26 @@ export class Board extends ExtrudeSolid
let count = file.Read();
processData.highBoardEdgeRemark = file.ReadArray(count);
}
this._DrillAssociationLock.clear();
if (ver > 14)
{
this._DrillLock = file.Read();
//读取关联排钻锁映射
const size = file.Read();
for (let i = 0; i < size; i++)
{
const id = file.ReadObjectId();
this._DrillAssociationLock.add(id);
}
}
}
WriteFile(file: CADFiler)
{
super.WriteFile(file);
file.Write(14);
file.Write(15);
// file.Write(this._SpaceOCS.toArray()); ver < 6
file.Write(this._BoardType);
file.Write(this._Name);
@ -2133,6 +2190,17 @@ export class Board extends ExtrudeSolid
{
file.Write(r);
}
//ver>14
{
file.Write(this._DrillLock);
const count = this._DrillAssociationLock.size;
file.Write(count);
for (const id of this._DrillAssociationLock)
{
file.WriteObjectId(id);
}
}
}
}

@ -221,6 +221,10 @@ import { ApplyModel2ToBoard } from "../Add-on/DrawBoard/ApplyModel2ToBoard";
import { ParseHandle } from "../Add-on/DrawBoard/ParseHandle";
import { ParseHinge } from "../Add-on/DrawBoard/ParseHinge";
import { Command_BoardInfoDimTool } from "../Add-on/DrawDim/BoardInfoDimTool";
import { AllDrillUnlock } from "../Add-on/DrawDrilling/DrillLock/AllDrillUnlock";
import { AssociationLock } from "../Add-on/DrawDrilling/DrillLock/AssociationLock";
import { AssociationUnlock } from "../Add-on/DrawDrilling/DrillLock/AssociationUnlock";
import { IndependentLockAndUnLock } from "../Add-on/DrawDrilling/DrillLock/IndependentLock";
import { Command_FBXImport } from "../Add-on/FBXLoad";
import { Command_Show2DPathLine } from "../Add-on/Show2DPathLine/Show2DPathLine";
import { Command_Show2DPathObject } from "../Add-on/Show2DPathLine/Show2DPathObject";
@ -825,6 +829,12 @@ export function registerCommand()
commandMachine.RegisterCommand(CommandNames.EditorBBS, new ShowEditorBBS());
commandMachine.RegisterCommand(CommandNames.ToggleDrillingReactor, new ToggleDrillingReactor());
commandMachine.RegisterCommand(CommandNames.IndependentDrillLock, new IndependentLockAndUnLock(true));
commandMachine.RegisterCommand(CommandNames.IndependentDrillUnlock, new IndependentLockAndUnLock(false));
commandMachine.RegisterCommand(CommandNames.AssociationDrillLock, new AssociationLock());
commandMachine.RegisterCommand(CommandNames.AssociationDrillUnlock, new AssociationUnlock());
commandMachine.RegisterCommand(CommandNames.AllDrillUnlock, new AllDrillUnlock());
commandMachine.RegisterCommand(CommandNames.CuttingFace, new CuttingByFace());
commandMachine.RegisterCommand(CommandNames.CuttingRectFace, new CuttingByRectFace());

@ -484,6 +484,7 @@ interface I5InputComponent extends ISetItemOption
highDrillOption?: IHightDrillOption;
isRemarks?: boolean;
edgeRemarks?: string[];
otherBoardData?: { [key: string]: any; };
}
/**
@ -494,6 +495,9 @@ export class Input5Or4Component extends React.Component<I5InputComponent, {}>
{
render()
{
const isDrillLock = this.props.otherBoardData?.isDrillLock;
const isAssociationDrillLock = this.props.otherBoardData?.isAssociationDrillLock;
const options = [...userConfig.DrillConfigs.keys(), "不排"];
const { isRemarks, highDrillOption, isShowEditor, type,
upKey, leftKey, downKey, rightKey, centerKey,
@ -515,8 +519,9 @@ export class Input5Or4Component extends React.Component<I5InputComponent, {}>
isShow && <HTMLSelect
className="select-drillType"
options={options}
style={{ margin: "0 3px", width: 60, height: 20, padding: "0 19px 0 5px" }}
value={this.props.highDrillOption.up}
disabled={isDrillLock && !isAssociationDrillLock}
style={{ marginLeft: 3, width: 60, height: 20, padding: "0 19px 0 5px" }}
value={highDrillOption.up}
onChange={e =>
{
highDrillOption.up = e.currentTarget.value;
@ -558,6 +563,7 @@ export class Input5Or4Component extends React.Component<I5InputComponent, {}>
isShow && <HTMLSelect
className="select-drillType"
options={options}
disabled={isDrillLock && !isAssociationDrillLock}
style={{ width: 60, height: 20, padding: "0 19px 0 5px" }}
value={highDrillOption.left}
onChange={e =>
@ -607,6 +613,7 @@ export class Input5Or4Component extends React.Component<I5InputComponent, {}>
isShow && <HTMLSelect
className="select-drillType"
options={options}
disabled={isDrillLock && !isAssociationDrillLock}
style={{ width: 60, height: 20, padding: "0 19px 0 5px" }}
value={highDrillOption.right}
onChange={e =>
@ -645,8 +652,9 @@ export class Input5Or4Component extends React.Component<I5InputComponent, {}>
isShow && <HTMLSelect
className="select-drillType"
options={options}
style={{ margin: "0 3px", width: 60, height: 20, padding: "0 19px 0 5px" }}
value={this.props.highDrillOption.down}
disabled={isDrillLock && !isAssociationDrillLock}
style={{ marginLeft: 3, width: 60, height: 20, padding: "0 19px 0 5px" }}
value={highDrillOption.down}
onChange={e =>
{
highDrillOption.down = e.currentTarget.value;
@ -682,6 +690,7 @@ interface IDrillTypeSelect
br: Board;
isShowHigh?: boolean;
onFocus?: Function;
otherBoardData?: { [key: string]: any; };
drillOption: IHightDrillOption;
}
@ -796,15 +805,17 @@ export class DrillTypeSelectCom extends React.Component<IDrillTypeSelect, { isDa
render()
{
const isHeightDrillLock = this.props.otherBoardData?.isHeightDrillLock;
const options = this.Options;
const select = <HTMLSelect
className="select-drillType"
value={this.props.opt.drillType}
disabled={isHeightDrillLock}
style={{
padding: "0 5px",
width: this.props.br && this.props.isShowHigh && "100%",
outline: this.state.isDanger && "1px red solid"
outline: this.state.isDanger && "1px red solid",
}}
options={options}
onChange={this.handleChange}
@ -821,6 +832,7 @@ export class DrillTypeSelectCom extends React.Component<IDrillTypeSelect, { isDa
<Button
text="高级"
intent="success"
disabled={isHeightDrillLock}
style={{
minHeight: 18,
height: 18,

@ -1,4 +1,4 @@
import { Alert, Button, Checkbox, Classes, HTMLSelect, Intent, Tag } from '@blueprintjs/core';
import { Alert, Button, Checkbox, Classes, HTMLSelect, Intent, Tag, Tooltip } from '@blueprintjs/core';
import { IObservableValue, observable } from 'mobx';
import { observer } from 'mobx-react';
import * as React from 'react';
@ -290,6 +290,23 @@ export class BoardProcessModal extends React.Component<BoardProcessProps, {}>{
}
return options;
}
getDrillLockInfo = () =>
{
const { isAssociationDrillLock = false, isDrillLock = false } = this.props.otherBoardData;
let msg = "";
let flag = "";
if (isAssociationDrillLock && isDrillLock)
flag = "独立锁和关联锁";
else if (isDrillLock)
flag = "独立锁";
else if (isAssociationDrillLock)
flag = "关联锁";
if (flag)
msg = `当前板存在${flag}`;
return msg;
};
async UNSAFE_componentWillMount()
{
this.updateTags();
@ -405,6 +422,7 @@ export class BoardProcessModal extends React.Component<BoardProcessProps, {}>{
<DrillTypeSelectCom
opt={this.props.opt}
br={this.props.br}
otherBoardData={this.props.otherBoardData}
isShowHigh={isShowHighEditor}
drillOption={this.props.drillOption}
/>
@ -450,16 +468,33 @@ export class BoardProcessModal extends React.Component<BoardProcessProps, {}>{
</div>
</label>
{
this.props.br && <Checkbox
label="是否拆单"
inline
checked={this.props.otherBoardData.isChaiDan}
style={CheckBoxStyle}
onChange={(e) =>
{
this.props.otherBoardData.isChaiDan = !this.props.otherBoardData.isChaiDan;
}}
/>
this.props.br &&
<>
<Checkbox
label="是否拆单"
inline
checked={this.props.otherBoardData.isChaiDan}
style={CheckBoxStyle}
onChange={(e) =>
{
this.props.otherBoardData.isChaiDan = !this.props.otherBoardData.isChaiDan;
}}
/>
<Tooltip content={`${this.getDrillLockInfo()} 注意:排钻锁解除时会同时解除独立锁和关联锁,锁定只会锁定独立锁,点击确定后生效`}>
<Checkbox
label="排钻锁"
inline
checked={this.props.otherBoardData.isHeightDrillLock}
style={CheckBoxStyle}
onChange={(e) =>
{
const islock = this.props.otherBoardData.isHeightDrillLock;
this.props.otherBoardData.isHeightDrillLock = !islock;
this.props.otherBoardData.isDrillLock = !islock;
}}
/>
</Tooltip>
</>
}
</div>
{
@ -515,6 +550,7 @@ export class BoardProcessModal extends React.Component<BoardProcessProps, {}>{
isShowEditor={true}
isRemarks={isEdgeRemarks}
highDrillOption={this.props.drillOption}
otherBoardData={this.props.otherBoardData}
/>
</>
}

@ -41,6 +41,7 @@ export function AddCommonBoardProps(Com: React.ComponentType<ICommonOptionProps>
return class extends React.Component<{ board: Board; }, {}>
{
static displayName = 'BoardOption';
private curDrillLock = false; //记录打开时的状态
public _ConfigOption: SingleBoardOption = observable({
name: "", type: 0, rotateX: 0, rotateY: 0, rotateZ: 0, openDir: BoardOpenDir.None
});
@ -64,7 +65,7 @@ export function AddCommonBoardProps(Com: React.ComponentType<ICommonOptionProps>
public canDrawSpecial = observable.box(true);
public canModeling = observable.box(true);
public remarks: [string, string][] = observable(Array.from({ length: 12 }, () => ["", ""]) as [string, string][]);
public otherBoardData = observable({ isChaiDan: true });
public otherBoardData = observable({ isChaiDan: true, isDrillLock: false, isHeightDrillLock: false });
public _UIConfigOPtion: IUiOption<SingleBoardOption> = observable({
name: "", type: "0", rotateX: "0", rotateY: "0", rotateZ: "0"
});
@ -166,8 +167,14 @@ export function AddCommonBoardProps(Com: React.ComponentType<ICommonOptionProps>
this.remarks[i][1] = this._ProcessOption.remarks[i][1];
}
this.otherBoardData.isChaiDan = this.CurrentBoard.IsChaiDan;
Object.assign(this.otherBoardData, {
isChaiDan: this.CurrentBoard.IsChaiDan,
isDrillLock: this.CurrentBoard.DrillLock,
isAssociationDrillLock: this.CurrentBoard.DrillAssociationLock.size > 0,
isHeightDrillLock: this.CurrentBoard.DrillLock || this.CurrentBoard.DrillAssociationLock.size > 0,
});
this.curDrillLock = this.otherBoardData.isHeightDrillLock;
});
public InitRectBoardDrillOption = action(() =>
{
@ -272,6 +279,34 @@ export function AddCommonBoardProps(Com: React.ComponentType<ICommonOptionProps>
board.IsChaiDan = this.otherBoardData.isChaiDan;
if (this.otherBoardData.isHeightDrillLock != this.curDrillLock)
{
if (this.otherBoardData.isHeightDrillLock)
{
this.CurrentBoard.DrillLock = true;
AppToaster.show({
message: "成功锁定当前板排钻独立锁",
timeout: 2000,
intent: Intent.SUCCESS,
});
}
else
{
const currentBoard = this.CurrentBoard;
const associationBoards = [...currentBoard.DrillAssociationLock.values()].map(o => o.Object as Board);
for (const board of associationBoards)
{
board.ClearDrillAssociationLock(currentBoard.Id);
}
currentBoard.ClearAllDrillLock();
AppToaster.show({
message: "成功解锁当前板排钻独立锁和关联锁",
timeout: 2000,
intent: Intent.SUCCESS,
});
}
}
app.Editor.ModalManage.Destory();
board.AutoUpdate = oldAutoUpdate;

@ -1110,6 +1110,56 @@ export const CommandList: ICommand[] = [
chName: "开关排钻反应器",
chDes: "开关排钻反应器",
},
{
icon: IconEnum.IndependentDrillLock,
typeId: "pz",
link: `#`,
defaultCustom: CommandNames.IndependentDrillLock,
command: CommandNames.IndependentDrillLock,
type: "排钻",
chName: "独立排钻锁",
chDes: "独立排钻锁",
},
{
icon: IconEnum.IndependentDrillUnlock,
typeId: "pz",
link: `#`,
defaultCustom: CommandNames.IndependentDrillUnlock,
command: CommandNames.IndependentDrillUnlock,
type: "排钻",
chName: "解除独立排钻锁",
chDes: "解除独立排钻锁",
},
{
icon: IconEnum.AssociationDrillLock,
typeId: "pz",
link: `#`,
defaultCustom: CommandNames.AssociationDrillLock,
command: CommandNames.AssociationDrillLock,
type: "排钻",
chName: "关联排钻锁",
chDes: "关联排钻锁",
},
{
icon: IconEnum.AssociationDrillUnlock,
typeId: "pz",
link: `#`,
defaultCustom: CommandNames.AssociationDrillUnlock,
command: CommandNames.AssociationDrillUnlock,
type: "排钻",
chName: "解除关联排钻锁",
chDes: "解除关联排钻锁",
},
{
icon: IconEnum.AllDrillUnlock,
typeId: "pz",
link: `#`,
defaultCustom: CommandNames.AllDrillUnlock,
command: CommandNames.AllDrillUnlock,
type: "排钻",
chName: "解除所有排钻锁",
chDes: "解除所有排钻锁",
},
// {
// icon: IconEnum.HideDrill,
// typeId: "pz",

Loading…
Cancel
Save