!1606 优化:酒格补板可选择跟随缩进

pull/1604/MERGE
林三 3 years ago committed by ChenX
parent 8d4aee88af
commit 7a64387581

@ -36,6 +36,7 @@ const option: IWineRackOption = {
isDrawLy: false, isDrawLy: false,
isDrawVer: false, isDrawVer: false,
brThick2: 18, brThick2: 18,
followNarrow: false,
}; };
describe("酒格功能测试", () => describe("酒格功能测试", () =>

@ -1,11 +1,11 @@
import { Vector3 } from "three"; import { Vector3 } from "three";
import { EBoardKeyList } from "../../Common/BoardKeyList";
import { safeEval } from "../../Common/eval"; import { safeEval } from "../../Common/eval";
import { Singleton } from "../../Common/Singleton"; import { Singleton } from "../../Common/Singleton";
import { Board } from "../../DatabaseServices/Entity/Board"; import { Board } from "../../DatabaseServices/Entity/Board";
import { ISpaceParse } from "../../Geometry/SpaceParse/ISpaceParse"; import { ISpaceParse } from "../../Geometry/SpaceParse/ISpaceParse";
import { DrillType, FaceDirection, IHighSealedItem, BoardType } from "../../UI/Store/BoardInterface"; import { BoardType, DrillType, FaceDirection, IHighSealedItem } from "../../UI/Store/BoardInterface";
import { EFullDir, EFullType, EWRackArrayType, IWineRackOption } from "../../UI/Store/WineRackInterface"; import { EFullDir, EFullType, EWRackArrayType, IWineRackOption } from "../../UI/Store/WineRackInterface";
import { EBoardKeyList } from "../../Common/BoardKeyList";
export const SIN45 = Math.sin(Math.PI / 4); export const SIN45 = Math.sin(Math.PI / 4);
@ -126,6 +126,13 @@ export class DrawWineRackTool extends Singleton
length += (config.leftCut + config.rightCut); length += (config.leftCut + config.rightCut);
position.add(new Vector3(actWidth + config.rightCut, -config.frontCut, actHeight + config.topCut)); position.add(new Vector3(actWidth + config.rightCut, -config.frontCut, actHeight + config.topCut));
} }
//补板跟随
if (config.followNarrow)
{
//处理前缩
position.add(new Vector3(0, config.frontCut));
width -= config.frontCut;
}
let br = Board.CreateBoard(length, width, config.brThick2); let br = Board.CreateBoard(length, width, config.brThick2);
this.GetBoardProcessOption(br); this.GetBoardProcessOption(br);
br.BoardProcessOption.bigHoleDir = FaceDirection.Back; br.BoardProcessOption.bigHoleDir = FaceDirection.Back;
@ -150,6 +157,13 @@ export class DrawWineRackTool extends Singleton
br.BoardProcessOption.bigHoleDir = FaceDirection.Back; br.BoardProcessOption.bigHoleDir = FaceDirection.Back;
position.x += actWidth; position.x += actWidth;
} }
//补板跟随
if (config.followNarrow)
{
br.WriteAllObjectRecord();
position.y += config.frontCut;
br.Width -= config.frontCut;
}
//这里要跟外面平 //这里要跟外面平
position.y -= config.frontCut; position.y -= config.frontCut;

@ -113,11 +113,14 @@ export class TemplateWineRackRecord extends TemplateRecord
this.option.isDrawLy = file.Read(); this.option.isDrawLy = file.Read();
this.option.isDrawVer = file.Read(); this.option.isDrawVer = file.Read();
this.option.brThick2 = file.Read(); this.option.brThick2 = file.Read();
if (ver > 1)
this.option.followNarrow = file.Read();
} }
//对象将自身数据写入到文件. //对象将自身数据写入到文件.
WriteFile(file: CADFiler) WriteFile(file: CADFiler)
{ {
file.Write(1); file.Write(2);
super.WriteFile(file); super.WriteFile(file);
file.Write(this.option.type); file.Write(this.option.type);
file.Write(this.option.arrayType); file.Write(this.option.arrayType);
@ -148,6 +151,7 @@ export class TemplateWineRackRecord extends TemplateRecord
file.Write(this.option.isDrawLy); file.Write(this.option.isDrawLy);
file.Write(this.option.isDrawVer); file.Write(this.option.isDrawVer);
file.Write(this.option.brThick2); file.Write(this.option.brThick2);
file.Write(this.option.followNarrow);
} }
//#endregion //#endregion
} }

@ -73,7 +73,7 @@ export const DefaultBehindBoardConfig: BehindBoardOption = {
Object.freeze(DefaultBehindBoardConfig); Object.freeze(DefaultBehindBoardConfig);
export const DefaultWineRackConfig: IWineRackOption = { export const DefaultWineRackConfig: IWineRackOption = {
version: 1, version: 2,
type: EWineRackType.Oblique, type: EWineRackType.Oblique,
arrayType: EWRackArrayType.ByWidth, arrayType: EWRackArrayType.ByWidth,
fullType: EFullType.ByWidth, fullType: EFullType.ByWidth,
@ -100,6 +100,7 @@ export const DefaultWineRackConfig: IWineRackOption = {
isDrawLy: false, isDrawLy: false,
isDrawVer: false, isDrawVer: false,
brThick2: 18, brThick2: 18,
followNarrow: false,
}; };
Object.freeze(DefaultWineRackConfig); Object.freeze(DefaultWineRackConfig);

@ -28,6 +28,7 @@ export interface IConfigOption<T = AnyObject>
doorsInfo?: (IDrawerInfo | IDoorInfo)[]; doorsInfo?: (IDrawerInfo | IDoorInfo)[];
processGroupCategory?: string[];//加工组(工序组)数据 processGroupCategory?: string[];//加工组(工序组)数据
autoCutOption?: IDrawBoardAutoCutOption;//绘制板件时是否自动切割&&关联切割 autoCutOption?: IDrawBoardAutoCutOption;//绘制板件时是否自动切割&&关联切割
followNarrow?: boolean;//酒格补板是否内缩
other?: any; other?: any;
} }

@ -1,22 +1,22 @@
import { Button, Checkbox, Classes, H5, Intent, Radio, RadioGroup } from '@blueprintjs/core';
import { IconNames } from '@blueprintjs/icons';
import { observer } from 'mobx-react'; import { observer } from 'mobx-react';
import * as React from 'react'; import * as React from 'react';
import * as xaop from 'xaop'; import * as xaop from 'xaop';
import { Button, Classes, H5, Checkbox, RadioGroup, Radio, Intent } from '@blueprintjs/core';
import { WineRackStore } from '../../Store/WineRackStore';
import { SetBoardDataBlock, SetBoardDataItem, Input5Or4Component } from './BoardCommon';
import { CheckObjectType } from '../../../Common/CheckoutVaildValue';
import { EWineRackType, EWRackArrayType, EFullType, EFullDir } from '../../Store/WineRackInterface';
import { IconNames } from '@blueprintjs/icons';
import { app } from '../../../ApplicationServices/Application'; import { app } from '../../../ApplicationServices/Application';
import { commandMachine, CommandWrap } from '../../../Editor/CommandMachine'; import { CheckObjectType } from '../../../Common/CheckoutVaildValue';
import { BoardModalType } from './BoardModal'; import { safeEval } from '../../../Common/eval';
import { AppToaster, ToasterValueError } from '../Toaster';
import { KeyBoard } from '../../../Common/KeyEnum'; import { KeyBoard } from '../../../Common/KeyEnum';
import { FixedNotZero } from '../../../Common/Utils'; import { FixedNotZero } from '../../../Common/Utils';
import { commandMachine, CommandWrap } from '../../../Editor/CommandMachine';
import { userConfig } from '../../../Editor/UserConfig'; import { userConfig } from '../../../Editor/UserConfig';
import { safeEval } from '../../../Common/eval'; import { EFullDir, EFullType, EWineRackType, EWRackArrayType } from '../../Store/WineRackInterface';
import { CommonModal } from '../Modal/ModalContainer'; import { WineRackStore } from '../../Store/WineRackStore';
import { GetCompoentObjectIdString } from '../ComponentObjectId'; import { GetCompoentObjectIdString } from '../ComponentObjectId';
import { CommonModal } from '../Modal/ModalContainer';
import { AppToaster, ToasterValueError } from '../Toaster';
import { Input5Or4Component, SetBoardDataBlock, SetBoardDataItem } from './BoardCommon';
import { BoardModalType } from './BoardModal';
@observer @observer
export class WineRackModal extends React.Component<{ store?: WineRackStore; }, {}> export class WineRackModal extends React.Component<{ store?: WineRackStore; }, {}>
@ -373,6 +373,15 @@ export class WineRackModal extends React.Component<{ store?: WineRackStore; }, {
m_Option.isDrawVer = !m_Option.isDrawVer; m_Option.isDrawVer = !m_Option.isDrawVer;
}} /> }} />
</div> </div>
<Checkbox
checked={m_Option.followNarrow}
inline={true}
label="补板是否跟着缩进"
onChange={() =>
{
m_Option.followNarrow = !m_Option.followNarrow;
}}
/>
</> </>
} }
</div> </div>

@ -1,5 +1,5 @@
import { IBaseOption } from "./BoardInterface";
import { EBoardKeyList } from "../../Common/BoardKeyList"; import { EBoardKeyList } from "../../Common/BoardKeyList";
import { IBaseOption } from "./BoardInterface";
export enum EWineRackType export enum EWineRackType
{ {
@ -57,6 +57,7 @@ export interface IWineRackOption extends IBaseOption
isDrawLy: boolean; isDrawLy: boolean;
isDrawVer: boolean; isDrawVer: boolean;
brThick2: number; //补板厚 brThick2: number; //补板厚
followNarrow: boolean;//酒格补板前缩跟随
} }
export interface IR2WROption export interface IR2WROption

@ -10,7 +10,7 @@ import { IWineRackOption } from "./WineRackInterface";
export class WineRackStore extends BoardStore<IWineRackOption> export class WineRackStore extends BoardStore<IWineRackOption>
{ {
EditorTemplate: TemplateWineRackRecord; EditorTemplate: TemplateWineRackRecord;
@observable m_Option: IWineRackOption = Object.assign({}, DefaultWineRackConfig); @observable m_Option: IWineRackOption = Object.assign({ }, DefaultWineRackConfig);
HasInvailValue() HasInvailValue()
{ {
return CheckoutValid.HasInvailValue(this.UIOption, CheckObjectType.WR); return CheckoutValid.HasInvailValue(this.UIOption, CheckObjectType.WR);
@ -23,7 +23,8 @@ export class WineRackStore extends BoardStore<IWineRackOption>
SaveConfig() SaveConfig()
{ {
//新的配置 //新的配置
let newConfig: IConfigOption = {}; let newConfig: IConfigOption<IWineRackOption> = { };
this.m_Option.version = 2;
newConfig.option = toJS(this.m_Option); newConfig.option = toJS(this.m_Option);
return newConfig; return newConfig;
} }
@ -32,5 +33,9 @@ export class WineRackStore extends BoardStore<IWineRackOption>
Object.assign(this.m_Option, cof.option); Object.assign(this.m_Option, cof.option);
if (this.m_UiOption) if (this.m_UiOption)
Object.assign(this.m_UiOption, DataAdapter.ConvertUIData(cof.option)); Object.assign(this.m_UiOption, DataAdapter.ConvertUIData(cof.option));
if (cof.option.version < 2)
this.m_Option.followNarrow = false;
else
this.m_Option.followNarrow = cof.option.followNarrow;
} }
} }

Loading…
Cancel
Save