!1540 功能:新增开关排钻反应器命令 / Config命令配置到F1面板;底部工具栏也可切换排钻反应器开关 测试命令: toggleDrillingReactor / Config

pull/1540/MERGE
林三 3 years ago committed by ChenX
parent 97729f4fc3
commit a204db7e61

@ -28,14 +28,13 @@ const ForbidReactorCmd = new Set([
export class DrillingReactor export class DrillingReactor
{ {
Enable = true;
constructor() constructor()
{ {
app.CommandReactor.OnCommandEnd(async (cmdName: string, changeObjects, createObjects) => app.CommandReactor.OnCommandEnd(async (cmdName: string, changeObjects, createObjects) =>
{ {
if (app.Viewer.isLayout) return; if (app.Viewer.isLayout) return;
this.Enable = userConfig.openDrillingReactor; let enable = userConfig.openDrillingReactor;
if (cmdName === CommandNames.Copy) if (cmdName === CommandNames.Copy)
{ {
let holeGroupSet: WeakSet<ObjectId> = new WeakSet(); let holeGroupSet: WeakSet<ObjectId> = new WeakSet();
@ -71,9 +70,19 @@ export class DrillingReactor
} }
} }
if (!this.Enable || ForbidReactorCmd.has(cmdName)) if (!enable || ForbidReactorCmd.has(cmdName))
return; return;
if (cmdName === CommandNames.Insert && !userConfig.openReDrilling)
{
AppToaster.show({
message: "当前禁用插入图纸时触发排钻!(如果需要开启,请在用户设置中配置!)",
intent: Intent.SUCCESS,
timeout: 3000
}, "dis_insert_redri");
return;
}
let meatEnts = new Set<Board>(); let meatEnts = new Set<Board>();
for (let e of changeObjects) for (let e of changeObjects)
{ {

@ -0,0 +1,18 @@
import { Intent } from "../../Common/Toaster";
import { Command } from "../../Editor/CommandMachine";
import { userConfig } from "../../Editor/UserConfig";
import { AppToaster } from "../../UI/Components/Toaster";
export class ToggleDrillingReactor implements Command
{
Transparency = true;
async exec()
{
userConfig.openDrillingReactor = !userConfig.openDrillingReactor;
AppToaster.show({
message: `${userConfig.openDrillingReactor ? "开启" : "关闭"}排钻反应器`,
timeout: 5000,
intent: Intent.SUCCESS,
}, "ToggleDrillingReactor");
}
}

@ -125,6 +125,7 @@ export enum CommandNames
ChangeLayout = "CHANGELAYOUT", ChangeLayout = "CHANGELAYOUT",
RightPanel = "RIGHTPANEL", RightPanel = "RIGHTPANEL",
Config = "CONFIG", Config = "CONFIG",
ToggleDrillingReactor = "TOGGLEDRILLINGREACTOR",
Esc = "ESC", Esc = "ESC",
Wireframe = "WIREFRAME", Wireframe = "WIREFRAME",
Conceptual = "CONCEPTUAL", Conceptual = "CONCEPTUAL",

@ -234,6 +234,7 @@ import { ShowKinfeManageModal } from './../Add-on/showModal/ShowKnifeManageModal
import { commandMachine } from './CommandMachine'; import { commandMachine } from './CommandMachine';
import hotkeys from "hotkeys-js"; import hotkeys from "hotkeys-js";
import { Command_ChangeLayout, Command_ModuleBar, Command_PropertiesBar, Command_RightPanel } from "../UI/Components/CommandPanel/SystemCommand/UICpmmand"; import { Command_ChangeLayout, Command_ModuleBar, Command_PropertiesBar, Command_RightPanel } from "../UI/Components/CommandPanel/SystemCommand/UICpmmand";
import { ToggleDrillingReactor } from "../Add-on/DrawDrilling/ToggleDrillingReactor";
export function registerCommand() export function registerCommand()
{ {
commandMachine.RegisterCommand(CommandNames.Puge, new Command_Purge()); commandMachine.RegisterCommand(CommandNames.Puge, new Command_Purge());
@ -645,6 +646,7 @@ export function registerCommand()
commandMachine.RegisterCommand(CommandNames.CheckDrawHole, new CheckDrawHole()); commandMachine.RegisterCommand(CommandNames.CheckDrawHole, new CheckDrawHole());
commandMachine.RegisterCommand(CommandNames.FindModelKnifeRadius, new FindModeingKnifeRadius()); commandMachine.RegisterCommand(CommandNames.FindModelKnifeRadius, new FindModeingKnifeRadius());
commandMachine.RegisterCommand(CommandNames.EditorBBS, new ShowEditorBBS()); commandMachine.RegisterCommand(CommandNames.EditorBBS, new ShowEditorBBS());
commandMachine.RegisterCommand(CommandNames.ToggleDrillingReactor, new ToggleDrillingReactor());
commandMachine.RegisterCommand(CommandNames.CuttingFace, new CuttingByFace()); commandMachine.RegisterCommand(CommandNames.CuttingFace, new CuttingByFace());
commandMachine.RegisterCommand(CommandNames.CuttingRectFace, new CuttingByRectFace()); commandMachine.RegisterCommand(CommandNames.CuttingRectFace, new CuttingByRectFace());

@ -40,14 +40,14 @@ export class UserConfig implements IConfigStore
height: 2440, height: 2440,
width: 1220, width: 1220,
}; };
@observable private _drillConfigs: Map<string, DrillingOption[]> = new Map(); @observable _drillConfigs: Map<string, DrillingOption[]> = new Map();
@observable openDrillingReactor = true; @observable openDrillingReactor = true;
@observable openReDrilling = false;//插入图纸的时候,响应排钻反应器
@observable openAutoCuttingReactor = true; @observable openAutoCuttingReactor = true;
/**打开将检测排钻是否在板件内*/ /**打开将检测排钻是否在板件内*/
@observable openExactDrill = true;
winerackConfig: IWineRackOption; winerackConfig: IWineRackOption;
userConfigName: { [key: string]: string; } = {}; userConfigName: { [key: string]: string; } = {};
private modeling2HoleRad = 20; //圆造型小于等于该值拆成孔数据 _modeling2HoleRad = 20; //圆造型小于等于该值拆成孔数据
@observable isAdmin = false; @observable isAdmin = false;
isMaster = false; isMaster = false;
rights = []; rights = [];
@ -139,6 +139,7 @@ export class UserConfig implements IConfigStore
InitOption() InitOption()
{ {
this.openDrillingReactor = true; this.openDrillingReactor = true;
this.openReDrilling = false;
this.openAutoCuttingReactor = true; this.openAutoCuttingReactor = true;
Object.assign(this.maxSize, { Object.assign(this.maxSize, {
height: 2440, height: 2440,
@ -165,6 +166,7 @@ export class UserConfig implements IConfigStore
option: { option: {
version: this._version, version: this._version,
openDrillingReactor: this.openDrillingReactor, openDrillingReactor: this.openDrillingReactor,
openReDrilling: this.openReDrilling,
openAutoCuttingReactor: this.openAutoCuttingReactor, openAutoCuttingReactor: this.openAutoCuttingReactor,
maxSize: toJS(this.maxSize), maxSize: toJS(this.maxSize),
kjlConfig: toJS(this.kjlConfig), kjlConfig: toJS(this.kjlConfig),
@ -189,10 +191,11 @@ export class UserConfig implements IConfigStore
UpdateOption(config: IConfigOption) UpdateOption(config: IConfigOption)
{ {
this.openDrillingReactor = config.option.openDrillingReactor; this.openDrillingReactor = config.option.openDrillingReactor;
this.openReDrilling = config.option.openReDrilling;
this.openAutoCuttingReactor = config.option.openAutoCuttingReactor; this.openAutoCuttingReactor = config.option.openAutoCuttingReactor;
Object.assign(this.maxSize, config.option.maxSize); Object.assign(this.maxSize, config.option.maxSize);
Object.assign(this.kjlConfig, config.option.kjlConfig); Object.assign(this.kjlConfig, config.option.kjlConfig);
this.modeling2HoleRad = config.option.modeling2HoleRad; this._modeling2HoleRad = config.option.modeling2HoleRad;
if (config.option.version > 1) if (config.option.version > 1)
{ {
@ -231,7 +234,7 @@ export class UserConfig implements IConfigStore
this.autoLines = config.option.autoLines; this.autoLines = config.option.autoLines;
} }
else else
this.chaidanOption.modeling2HoleRad = this.modeling2HoleRad; this.chaidanOption.modeling2HoleRad = this._modeling2HoleRad;
if (config.option.version > 9) if (config.option.version > 9)
this.dimTextHeight = config.option.dimTextHeight; this.dimTextHeight = config.option.dimTextHeight;

@ -945,6 +945,15 @@ export const CommandList: ICommand[] = [
chName: "检测没孔的板件", chName: "检测没孔的板件",
chDes: "检测没孔的板件", chDes: "检测没孔的板件",
}, },
{
typeId: "pz",
link: `#`,
defaultCustom: CommandNames.ToggleDrillingReactor,
command: CommandNames.ToggleDrillingReactor,
type: "排钻",
chName: "开关排钻反应器",
chDes: "开关排钻反应器",
},
// { // {
// icon: IconEnum.HideDrill, // icon: IconEnum.HideDrill,
// typeId: "pz", // typeId: "pz",
@ -1810,6 +1819,15 @@ export const CommandList: ICommand[] = [
chName: "排钻配置导入(所有)", chName: "排钻配置导入(所有)",
chDes: "排钻配置导入(所有)", chDes: "排钻配置导入(所有)",
}, },
{
typeId: "util",
link: `#`,
defaultCustom: CommandNames.Config,
command: CommandNames.Config,
type: "工具",
chName: "系统配置",
chDes: "系统配置面板",
},
//#endregion //#endregion
//#region 文件命令 //#region 文件命令

@ -191,7 +191,7 @@ export class ConfigDialog extends React.Component<{ store: ConfigStore; }>
<Tab id={EOptionTabId.File} title="文件" /> <Tab id={EOptionTabId.File} title="文件" />
<Tab id={EOptionTabId.Show} title="显示" panel={<DisplayConfigPanel store={store} />} /> <Tab id={EOptionTabId.Show} title="显示" panel={<DisplayConfigPanel store={store} />} />
<Tab id={EOptionTabId.Sys} title="系统" panel={<SystemConfigPanel />} /> <Tab id={EOptionTabId.Sys} title="系统" panel={<SystemConfigPanel />} />
<Tab id={EOptionTabId.Draw} title="绘图" panel={<DrawConfigPanel store={store} config={userConfig} />} /> <Tab id={EOptionTabId.Draw} title="绘图" panel={<DrawConfigPanel store={store} />} />
<Tab id={EOptionTabId.ChaiDan} title="拆单" panel={<ChaiDanPanel />} /> <Tab id={EOptionTabId.ChaiDan} title="拆单" panel={<ChaiDanPanel />} />
</Tabs> </Tabs>
</div> </div>

@ -1,45 +1,45 @@
import { Card, Checkbox, Classes, H5, Label } from '@blueprintjs/core'; import { Card, Checkbox, Classes, H5, Label } from '@blueprintjs/core';
import { observable } from 'mobx';
import { observer } from 'mobx-react'; import { observer } from 'mobx-react';
import * as React from 'react'; import * as React from 'react';
import { UpdateCompositeEntityBoard } from '../../../../Add-on/ShowLines';
import { app } from '../../../../ApplicationServices/Application'; import { app } from '../../../../ApplicationServices/Application';
import { UserConfig, IMaxSizeProps, userConfig } from '../../../../Editor/UserConfig';
import { observable, has } from 'mobx';
import { DataAdapter } from './../../../../Common/DataAdapter';
import { ToasterInput } from '../../Toaster';
import { CheckObjectType } from '../../../../Common/CheckoutVaildValue'; import { CheckObjectType } from '../../../../Common/CheckoutVaildValue';
import { IUiOption } from '../../../Store/BoardInterface'; import { ColorMaterial } from '../../../../Common/ColorPalette';
import { safeEval } from '../../../../Common/eval';
import { Board } from '../../../../DatabaseServices/Entity/Board'; import { Board } from '../../../../DatabaseServices/Entity/Board';
import { CompositeEntity } from '../../../../DatabaseServices/Entity/CompositeEntity'; import { CompositeEntity } from '../../../../DatabaseServices/Entity/CompositeEntity';
import { safeEval } from '../../../../Common/eval'; import { IMaxSizeProps, userConfig } from '../../../../Editor/UserConfig';
import { UpdateCompositeEntityBoard } from '../../../../Add-on/ShowLines'; import { IUiOption } from '../../../Store/BoardInterface';
import { ToasterInput } from '../../Toaster';
import { DataAdapter } from './../../../../Common/DataAdapter';
import { ConfigStore } from './ConfigDialog'; import { ConfigStore } from './ConfigDialog';
import { ColorMaterial } from '../../../../Common/ColorPalette';
interface IConfigProps interface IConfigProps
{ {
config: UserConfig;
store: ConfigStore; store: ConfigStore;
} }
@observer @observer
export class DrawConfigPanel extends React.Component<IConfigProps, {}> { export class DrawConfigPanel extends React.Component<IConfigProps, {}> {
@observable maxSizeConfig: IUiOption<IMaxSizeProps>; @observable maxSizeConfig: IUiOption<IMaxSizeProps>;
private oldShowLine: boolean; _oldShowLine: boolean;
private toggleDrillingReactor = () => _toggleDrillingReactor = () =>
{ {
const userConfig = this.props.config;
userConfig.openDrillingReactor = !userConfig.openDrillingReactor; userConfig.openDrillingReactor = !userConfig.openDrillingReactor;
app._drillingReactor.Enable = userConfig.openDrillingReactor; };
_reDrilling = () =>
{
userConfig.openReDrilling = !userConfig.openReDrilling;
}; };
UNSAFE_componentWillMount() UNSAFE_componentWillMount()
{ {
const cof = this.props.config; this.maxSizeConfig = DataAdapter.ConvertUIData(userConfig.maxSize);
this.maxSizeConfig = DataAdapter.ConvertUIData(cof.maxSize); this._oldShowLine = userConfig.showLines;
this.oldShowLine = userConfig.showLines;
} }
componentWillUnmount() componentWillUnmount()
{ {
if (this.oldShowLine !== userConfig.showLines) if (this._oldShowLine !== userConfig.showLines)
{ {
for (let en of app.Database.ModelSpace.Entitys) for (let en of app.Database.ModelSpace.Entitys)
{ {
@ -56,7 +56,6 @@ export class DrawConfigPanel extends React.Component<IConfigProps, {}> {
} }
public render() public render()
{ {
const userConfig = this.props.config;
const { kjlConfig } = userConfig; const { kjlConfig } = userConfig;
return ( return (
<Card> <Card>
@ -66,7 +65,13 @@ export class DrawConfigPanel extends React.Component<IConfigProps, {}> {
<Checkbox <Checkbox
label="排钻反应器" label="排钻反应器"
checked={userConfig.openDrillingReactor} checked={userConfig.openDrillingReactor}
onChange={this.toggleDrillingReactor} onChange={this._toggleDrillingReactor}
/>
<Checkbox
label="插入图纸时重排"
disabled={!userConfig.openDrillingReactor}
checked={userConfig.openReDrilling}
onChange={this._reDrilling}
/> />
<Checkbox <Checkbox
label="板边缘大孔过滤" label="板边缘大孔过滤"

@ -11,6 +11,7 @@ import { commandMachine } from '../../Editor/CommandMachine';
import { CommandState } from '../../Editor/CommandState'; import { CommandState } from '../../Editor/CommandState';
import { SnapMenuFixed } from '../../Editor/SnapMenuFixed'; import { SnapMenuFixed } from '../../Editor/SnapMenuFixed';
import { TempEditor } from '../../Editor/TempEditor'; import { TempEditor } from '../../Editor/TempEditor';
import { userConfig } from '../../Editor/UserConfig';
import { DownPanelStore } from '../Store/DownPanelStore'; import { DownPanelStore } from '../Store/DownPanelStore';
import { TopPanelStore } from '../Store/TopPanelStore'; import { TopPanelStore } from '../Store/TopPanelStore';
import { userConfigStore } from '../Store/UserConfigStore'; import { userConfigStore } from '../Store/UserConfigStore';
@ -224,6 +225,12 @@ export class DownPanel extends React.Component<{ store?: DownPanelStore; }, {}>
Log("有实体正在绘制或者正处于编辑模式下"); Log("有实体正在绘制或者正处于编辑模式下");
return; return;
} }
if (key === "toggleDrillingReactor")
{
commandMachine.ExecCommand(CommandNames.ToggleDrillingReactor);
e.currentTarget.blur();
return;
}
this.props.store[key] = e.currentTarget.checked; this.props.store[key] = e.currentTarget.checked;
e.currentTarget.blur(); e.currentTarget.blur();
this.props.store.Upload(); this.props.store.Upload();
@ -309,6 +316,14 @@ export class DownPanel extends React.Component<{ store?: DownPanelStore; }, {}>
style={switchStyle}> style={switchStyle}>
<SnapMenuFixed /> <SnapMenuFixed />
</div> </div>
<Switch
checked={userConfig.openDrillingReactor}
label="排钻反应器"
data-key="toggleDrillingReactor"
onChange={this.handleChange}
style={switchStyle}
alignIndicator={Alignment.RIGHT}
/>
<Switch <Switch
checked={this.props.store.isLayout} checked={this.props.store.isLayout}
label="切换布局" label="切换布局"

Loading…
Cancel
Save