!2324 配置:在用户配置中,增加了可以自动修改板的开门方向的设置

pull/2879/head
林伟强 3 months ago committed by ChenX
parent d688dac512
commit 2b12307cf3

@ -0,0 +1,24 @@
import { Intent } from "@blueprintjs/core";
import { Command } from "../Editor/CommandMachine";
import { userConfig } from "../Editor/UserConfig";
import { BoardModalType } from "../UI/Components/Board/BoardModalType";
import { AppToaster } from "../UI/Components/Toaster";
import { userConfigStore } from "../UI/Store/UserConfigStore";
export class ForceOpendirOrNameChange implements Command
{
async exec()
{
userConfig.forceOpendirOrNameChange = !userConfig.forceOpendirOrNameChange;
await userConfigStore.SaveConfig(BoardModalType.UserConfig, userConfig, { toaster: false });
if (AppToaster)
AppToaster.clear();
AppToaster.show({
message: `${userConfig.forceOpendirOrNameChange ? "开启" : "关闭"}:在双击修改板件属性界面修改门板开门方向时,自动修改对应的板名称(或修改门板名称时,自动修改对应的开门方向)`,
timeout: 5000,
intent: Intent.SUCCESS,
});
}
}

@ -291,6 +291,7 @@ export enum CommandNames
OneKeyLayout = "ONEKEYLAYOUT",
SwitchLines = "SWITCHLINES",
SwitchOpenDirLines = "SWITCHOPENDIRLINES",//切换开门方向纹路
ForceOpendirOrNameChange = "FORCEOPENDIECHANGE",//强制修改板名或开门方向
OneKeyPrint = "ONEKEYPRINT",//一键打印
SetHoleNoneType = "SETHOLENONETYPE",
FindMaxSizeBoard = "FINDMAXSIZEBOARDS",

@ -231,6 +231,7 @@ import { AddAloneDrillLock } from "../Add-on/DrawDrilling/DrillLock/AloneDrillLo
import { RemoveAssocDrillLock } from "../Add-on/DrawDrilling/DrillLock/RemoveAssocDrillLock";
import { RemoveDrillLock } from "../Add-on/DrawDrilling/DrillLock/RemoveDrillLock";
import { Command_FBXImport } from "../Add-on/FBXLoad";
import { ForceOpendirOrNameChange } from "../Add-on/ForceOpenDirChange";
import { Command_HighlightNode, Command_HighlightNodeAndChilds } from "../Add-on/HighlightNode";
import { Command_Show2DPathLine } from "../Add-on/Show2DPathLine/Show2DPathLine";
import { Command_Show2DPathObject } from "../Add-on/Show2DPathLine/Show2DPathObject";
@ -830,6 +831,7 @@ export function registerCommand()
commandMachine.RegisterCommand(CommandNames.SwitchLines, new SwitchLines());
commandMachine.RegisterCommand(CommandNames.SwitchOpenDirLines, new ShowOpenDirLiens());
commandMachine.RegisterCommand(CommandNames.ForceOpendirOrNameChange, new ForceOpendirOrNameChange());
commandMachine.RegisterCommand(CommandNames.MView2, new Draw2Viewport());
commandMachine.RegisterCommand(CommandNames.MView3, new Draw3Viewport());
commandMachine.RegisterCommand(CommandNames.OneKeyPrint, new OneKeyPrint());

@ -44,7 +44,7 @@ export interface IChat
export class UserConfig implements IConfigStore
{
private readonly _version = 39; //🌟🌟每次更新必须向上添加一次版本号🌟🌟
private readonly _version = 40; //🌟🌟每次更新必须向上添加一次版本号🌟🌟
@observable designer = ""; //一键布局的设计师
_renderType: RenderType = RenderType.Wireframe;
@observable maxSize: IMaxSizeProps = {
@ -183,6 +183,8 @@ export class UserConfig implements IConfigStore
noLid: "5",
allLid: "14"
};
@observable forceOpendirOrNameChange: boolean = false;//板名称与开门方向强制修改
constructor()
{
this.Init();
@ -349,6 +351,7 @@ export class UserConfig implements IConfigStore
templateDisplayCount: this.templateDisplayCount,
hingeLidRule: toJS(this.hingeLidRule),
boardCustomNumberTextHeight: this.boardCustomNumberTextHeight,
forceOpendirOrNameChange: this.forceOpendirOrNameChange
}
};
}
@ -527,6 +530,11 @@ export class UserConfig implements IConfigStore
}
else
this.boardCustomNumberTextHeight = 60;
if (config.option.version > 39)
{
this.forceOpendirOrNameChange = config.option.forceOpendirOrNameChange;
}
}
}

@ -1052,22 +1052,34 @@ export const BoardOpenDirSelect = observer((data: { opt?: BoardConfigOption, cla
export function ShowToasterOpenDirAndNameCheck(opt: { name: string; openDir?: BoardOpenDir; }, text: string, callback: () => void)
{
AppToaster.show({
message: <>
{`当前开门方向为${openDirOptions.find(v => v.value === opt.openDir).label},板名称为${opt.name},请检查是否正确`}
&nbsp;&nbsp;
<button
onClick={() =>
{
callback();
AppToaster.dismiss("openDirCheck");
}}>
{text}
</button>
</>,
timeout: 8000,
intent: Intent.WARNING,
}, "openDirCheck");
if (userConfig.forceOpendirOrNameChange)
{
callback();
AppToaster.show({
message: "当前已强制修改板名称或开门方向,请检查是否正确",
timeout: 3000,
intent: Intent.WARNING,
}, "openDirCheck");
}
else
{
AppToaster.show({
message: <>
{`当前开门方向为${openDirOptions.find(v => v.value === opt.openDir).label},板名称为${opt.name},请检查是否正确`}
&nbsp;&nbsp;
<button
onClick={() =>
{
callback();
AppToaster.dismiss("openDirCheck");
}}>
{text}
</button>
</>,
timeout: 8000,
intent: Intent.WARNING,
}, "openDirCheck");
}
}
export const openDirOptions = [

@ -2405,6 +2405,15 @@ export const CommandList: ICommand[] = [
chName: "切换开门方向纹路显示",
chDes: "切换开门方向纹路显示",
},
{
typeId: "util",
link: `#`,
defaultCustom: CommandNames.ForceOpendirOrNameChange,
command: CommandNames.ForceOpendirOrNameChange,
type: "工具",
chName: "强制修改开门方向或板名",
chDes: "在双击修改板件属性界面修改门板开门方向时,自动修改对应的板名称(或修改门板名称时,自动修改对应的开门方向)",
},
{
typeId: "util",
link: `#`,

@ -120,6 +120,9 @@ export class DrawConfigPanel extends React.Component<IConfigProps, {}> {
<Checkbox label="显示二维刀路路径" checked={userConfig.show2DPathLine} onChange={() => userConfig.show2DPathLine = !userConfig.show2DPathLine} />
<Checkbox label="显示二维刀路差集" checked={userConfig.show2DPathObject} onChange={() => userConfig.show2DPathObject = !userConfig.show2DPathObject} />
<H5></H5>
<Tooltip content={"在双击修改板件属性界面修改门板开门方向时,自动修改对应的板名称(或修改门板名称时,自动修改对应的开门方向)"} position='top'>
<Checkbox label='强制修改开门方向或板名' checked={userConfig.forceOpendirOrNameChange} onChange={() => userConfig.forceOpendirOrNameChange = !userConfig.forceOpendirOrNameChange} />
</Tooltip>
<Checkbox label="显示开门方向纹路" checked={userConfig.showOpenDirLines} onChange={() => userConfig.showOpenDirLines = !userConfig.showOpenDirLines} />
</div>
<div>

Loading…
Cancel
Save