diff --git a/src/Add-on/BoardEditor/SetThinBehindBoard.ts b/src/Add-on/BoardEditor/SetThinBehindBoard.ts new file mode 100644 index 000000000..d82cc78f2 --- /dev/null +++ b/src/Add-on/BoardEditor/SetThinBehindBoard.ts @@ -0,0 +1,22 @@ +import { app } from "../../ApplicationServices/Application"; +import { Board } from "../../DatabaseServices/Entity/Board"; +import { Command } from "../../Editor/CommandMachine"; +import { PromptStatus } from "../../Editor/PromptResult"; +import { BoardType } from "../../UI/Store/BoardInterface"; + +export class SetThinBehindBoard implements Command +{ + async exec() + { + let ssRes = await app.Editor.GetSelection({ + Msg: "选择薄背板", Filter: { + filterFunction: (obj, ent) => + { + return (ent instanceof Board) && (ent.BoardType === BoardType.Behind) && (ent.Thickness < 15); + } + }, UseSelect: true + }); + if (ssRes.Status === PromptStatus.OK) + app.Editor.SetSelection(ssRes.SelectSet.SelectEntityList); + } +} diff --git a/src/Common/CommandNames.ts b/src/Common/CommandNames.ts index d9f804f94..bbe624d47 100644 --- a/src/Common/CommandNames.ts +++ b/src/Common/CommandNames.ts @@ -81,6 +81,7 @@ export enum CommandNames LRBoard = "LEFTRIGHTBOARD", TBBoard = "TOPBOTTOMBOARD", BehindBoard = "BEHINDBOARD", + ThinBehindBoard = "THINBEHINDBOARD", LayerBoard = "LAYERBOARD", VertialBoard = "VERTIALBOARD", SingleBoard = "SINGLEBOARD", diff --git a/src/Editor/CommandRegister.ts b/src/Editor/CommandRegister.ts index a6080660d..575ee16bc 100644 --- a/src/Editor/CommandRegister.ts +++ b/src/Editor/CommandRegister.ts @@ -16,6 +16,7 @@ import { ReferenceCutting } from "../Add-on/BoardCutting/ReferenceCutting"; import { Command_ChangeBoardColorByPBFace } from "../Add-on/BoardEditor/ChangeBoardColorByPBFace"; import { Command_ClearBoard2DModeling } from "../Add-on/BoardEditor/ClearBoard2DModeling"; import { SetBoardLines, SetComposingFace } from "../Add-on/BoardEditor/SetBoardLines"; +import { SetThinBehindBoard } from "../Add-on/BoardEditor/SetThinBehindBoard"; import { Command_TextModifyTool } from "../Add-on/BoardEditor/TextModifyTool"; import { UpdateBoardInfos } from "../Add-on/BoardEditor/UpdateBoardInfos"; import { BoardFindModify } from "../Add-on/BoardFindModify"; @@ -433,6 +434,7 @@ export function registerCommand() //改板 commandMachine.RegisterCommand(CommandNames.SetBRXAxis, new Command_SetBRXAxis); + commandMachine.RegisterCommand(CommandNames.ThinBehindBoard, new SetThinBehindBoard()); //修改颜色命令 for (let i = 0; i <= 255; i++) commandMachine.RegisterCommand((i).toString(), new ChangeColor(i)); diff --git a/src/UI/Components/CommandPanel/CommandList.ts b/src/UI/Components/CommandPanel/CommandList.ts index 1e6ae587a..f51f4d018 100644 --- a/src/UI/Components/CommandPanel/CommandList.ts +++ b/src/UI/Components/CommandPanel/CommandList.ts @@ -793,6 +793,14 @@ export const CommandList: ICommand[] = [ chName: "模拟造型走刀+排钻+封边", chDes: "", }, + { + typeId: "bjbj", + defaultCustom: "BBB", + command: CommandNames.ThinBehindBoard, + type: "板件编辑", + chName: "选择薄背板", + chDes: "选择薄背板(厚度小于15)", + }, //灯光命令 { diff --git a/src/UI/Components/TopToolBar/TopToolBar.tsx b/src/UI/Components/TopToolBar/TopToolBar.tsx index 5960d2560..fe902d179 100644 --- a/src/UI/Components/TopToolBar/TopToolBar.tsx +++ b/src/UI/Components/TopToolBar/TopToolBar.tsx @@ -57,6 +57,7 @@ export class TopToolBar extends React.Component<{}, {}> { svg: IconEnum.ZYC, title: "左右侧板", command: CommandNames.LRBoard }, { svg: IconEnum.DDB, title: "顶底板", command: CommandNames.TBBoard }, { svg: IconEnum.BB, title: "背板", command: CommandNames.BehindBoard }, + { svg: IconEnum.BB, title: "薄背板", command: CommandNames.ThinBehindBoard }, { svg: IconEnum.LB, title: "立板", command: CommandNames.VertialBoard }, { svg: IconEnum.CB, title: "层板", command: CommandNames.LayerBoard }, { svg: IconEnum.SKT, title: "收口条", command: CommandNames.CloseStrip },