!2370 新增:基础板件(背板、层板、立板)绘制,数量、空间距离等支持表达式

pull/2457/head
林三 3 months ago committed by ChenX
parent e4faeb31a6
commit 3be24ef8cd

@ -3,6 +3,7 @@ import { Log, LogType } from "../../Common/Log";
import { safeEval } from "../../Common/eval";
import { Board } from "../../DatabaseServices/Entity/Board";
import { BoardType, BrRelativePos } from "../../DatabaseServices/Entity/BoardInterface";
import { TemplateParam } from "../../DatabaseServices/Template/Param/TemplateParam";
import { TemplateWineRackRecord } from "../../DatabaseServices/Template/ProgramTempate/TemplateWineRackRecord";
import { TemplateRecord } from "../../DatabaseServices/Template/TemplateRecord";
import { MoveMatrix } from "../../Geometry/GeUtils";
@ -10,24 +11,38 @@ import { ISpaceParse } from "../../Geometry/SpaceParse/ISpaceParse";
import { BehindBoardOption, IGrooveOption, LayerBoardOption, VerticalBoardOption } from "../../UI/Store/OptionInterface/IOptionInterface";
import { BehindHeightPositon } from "../../UI/Store/OptionInterface/OptionEnum";
export function BuildLayerBoards(opt: LayerBoardOption, space: ISpaceParse, grooveOption?: IGrooveOption): Board[]
export async function BuildLayerBoards(opt: LayerBoardOption, space: ISpaceParse, grooveOption?: IGrooveOption): Promise<Board[]>
{
let spaceBox = space.SpaceBox;
let spaceOCS = space.SpaceOCS;
let size = spaceBox.getSize(new Vector3());
const params = { L: size.x, W: size.y, H: size.z, BH: opt.thickness };
//使用模块 添加参数表达式 计算值
let template = new TemplateRecord().InitBaseParams();
CreateTemplateParam(template, size, opt, grooveOption);
//独立参数
{
AppendTemplateParam(template, "QS", 0, opt.calcFrontShrink, "前缩"); //前缩
AppendTemplateParam(template, "ZS", 0, opt.calcLeftShrink, "左缩"); //左缩
AppendTemplateParam(template, "YS", 0, opt.calcRightShrink, "右缩"); //右缩
AppendTemplateParam(template, "BS", 0, opt.calcHeight, "板深"); //板宽
}
await template.UpdateTemplateTree();
let width: number;
if (opt.isTotalLength)
width = size.y;
else
{
width = safeEval(opt.calcHeight, params);
}
let count = opt.count;
width = template.GetParam("BS").value as number;
let count = template.GetParam("C").value as number;
count = count < 1 ? 1 : count;
let type = opt.boardRelative;
let spaceSize = safeEval(opt.calcSpaceSize, params);
let frontShrink = safeEval(opt.calcFrontShrink, params);
let spaceSize = template.GetParam("S").value as number;
let frontShrink = template.GetParam("QS").value as number;
width -= frontShrink;
if (width <= 0)
@ -36,9 +51,9 @@ export function BuildLayerBoards(opt: LayerBoardOption, space: ISpaceParse, groo
return [];
}
let leftShrink = safeEval(opt.calcLeftShrink, params);
let rightShrink = safeEval(opt.calcRightShrink, params);
let thickness = opt.thickness;
let leftShrink = template.GetParam("ZS").value as number;
let rightShrink = template.GetParam("YS").value as number;
let thickness = template.GetParam("BH").value as number;
let len = size.x - leftShrink - rightShrink;
if (len <= 0)
@ -49,10 +64,10 @@ export function BuildLayerBoards(opt: LayerBoardOption, space: ISpaceParse, groo
let board = Board.CreateBoard(len, width, thickness, BoardType.Layer);
if (grooveOption)
{
board.KnifeRadius = safeEval(grooveOption.knifeRadius);
board.GroovesAddDepth = safeEval(grooveOption.grooveAddDepth);
board.GroovesAddWidth = safeEval(grooveOption.grooveAddWidth);
board.GroovesAddLength = safeEval(grooveOption.grooveAddLength);
board.KnifeRadius = template.GetParam("R").value as number;
board.GroovesAddDepth = template.GetParam("AD").value as number;
board.GroovesAddWidth = template.GetParam("AW").value as number;
board.GroovesAddLength = template.GetParam("AL").value as number;
}
opt.height = len;
opt.width = width;
@ -90,21 +105,34 @@ export function BuildLayerBoards(opt: LayerBoardOption, space: ISpaceParse, groo
return brs;
}
export function BuildVerticalBoards(opt: VerticalBoardOption, space: ISpaceParse, grooveOption?: IGrooveOption): Board[]
export async function BuildVerticalBoards(opt: VerticalBoardOption, space: ISpaceParse, grooveOption?: IGrooveOption): Promise<Board[]>
{
const spaceBox = space.SpaceBox;
const spaceOCS = space.SpaceOCS;
let size = spaceBox.getSize(new Vector3());
const params = { L: size.x, W: size.y, H: size.z, BH: opt.thickness };
let frontShrink = safeEval(opt.calcFrontShrink, params);
let bottomShink = safeEval(opt.calcBottomShrink, params);
//使用模块 添加参数表达式 计算值
let template = new TemplateRecord().InitBaseParams();
CreateTemplateParam(template, size, opt, grooveOption);
//独立参数
{
AppendTemplateParam(template, "QS", 0, opt.calcFrontShrink, "前缩"); //前缩
AppendTemplateParam(template, "HS", 0, opt.calcBottomShrink, "后缩");//后缩
AppendTemplateParam(template, "BS", 0, opt.calcWidth, "板深"); //板深
AppendTemplateParam(template, "BG", 0, opt.calcHeight, "板高"); //板高
}
await template.UpdateTemplateTree();
let frontShrink = template.GetParam("QS").value as number;
let bottomShink = template.GetParam("HS").value as number;
let width: number;
if (opt.isTotalWidth)
width = size.y - frontShrink;
else
{
width = safeEval(opt.calcWidth, params);
width = template.GetParam("BS").value as number;
}
if (width <= 0)
@ -117,22 +145,24 @@ export function BuildVerticalBoards(opt: VerticalBoardOption, space: ISpaceParse
if (opt.isTotalLength)
length = size.z - bottomShink;
else
{
length = safeEval(opt.calcHeight, params);
}
length = template.GetParam("BG").value as number;
let count = template.GetParam("C").value as number;
count = count < 1 ? 1 : count;
let count = opt.count;
let type = opt.boardRelative;
let spaceSize = safeEval(opt.calcSpaceSize, params);
let thickness = opt.thickness;
let spaceSize = template.GetParam("S").value as number;
let thickness = template.GetParam("BH").value as number;
thickness = thickness < 1 ? 1 : thickness;
let board = Board.CreateBoard(length, width, thickness, BoardType.Vertical);
if (grooveOption)
{
board.KnifeRadius = safeEval(grooveOption.knifeRadius);
board.GroovesAddDepth = safeEval(grooveOption.grooveAddDepth);
board.GroovesAddWidth = safeEval(grooveOption.grooveAddWidth);
board.GroovesAddLength = safeEval(grooveOption.grooveAddLength);
board.KnifeRadius = template.GetParam("R").value as number;
board.GroovesAddDepth = template.GetParam("AD").value as number;
board.GroovesAddWidth = template.GetParam("AW").value as number;
board.GroovesAddLength = template.GetParam("AL").value as number;
}
opt.height = length;
opt.width = width;
@ -165,7 +195,7 @@ export function BuildVerticalBoards(opt: VerticalBoardOption, space: ISpaceParse
return brs;
}
export function BuildBehindBoards(opt: BehindBoardOption, space: ISpaceParse, grooveOption?: IGrooveOption): Board[]
export async function BuildBehindBoards(opt: BehindBoardOption, space: ISpaceParse, grooveOption?: IGrooveOption): Promise<Board[]>
{
let newBox = space.SpaceBox.clone();
let spaceOcs = space.SpaceOCS;
@ -179,14 +209,26 @@ export function BuildBehindBoards(opt: BehindBoardOption, space: ISpaceParse, gr
//获取背板高度
let size = newBox.getSize(new Vector3());
const params = { L: size.x, W: size.y, H: size.z, BH: opt.thickness };
//使用模块 添加参数表达式 计算值
let template = new TemplateRecord().InitBaseParams();
CreateTemplateParam(template, size, opt, grooveOption);
//独立参数
{
AppendTemplateParam(template, "BG", 0, opt.calcHeight, "板高"); //板高
AppendTemplateParam(template, "MD", 0, opt.calcMoveDist, "移动距离"); //移动距离
}
await template.UpdateTemplateTree();
let height: number;
if (opt.boardPosition === BehindHeightPositon.AllHeight)
height = size.z;
else
height = safeEval(opt.calcHeight, params);
height = template.GetParam("BG").value as number;
let moveDist = safeEval(opt.calcMoveDist, params);
let moveDist = template.GetParam("MD").value as number;
//判断背板位置,更新背板高度
switch (opt.boardPosition)
@ -201,20 +243,23 @@ export function BuildBehindBoards(opt: BehindBoardOption, space: ISpaceParse, gr
break;
}
let count = opt.count;
let count = template.GetParam("C").value as number;
count = count < 1 ? 1 : count;
//相对位置
let relPos = opt.boardRelative;
//单层空间宽度
let spaceSize = safeEval(opt.calcSpaceSize, params);
let thickness = opt.thickness;
let spaceSize = template.GetParam("S").value as number;
let thickness = template.GetParam("BH").value as number;
thickness = thickness < 1 ? 1 : thickness;
let board = Board.CreateBoard(height, size.x, thickness, BoardType.Behind);
if (grooveOption)
{
board.KnifeRadius = safeEval(grooveOption.knifeRadius);
board.GroovesAddDepth = safeEval(grooveOption.grooveAddDepth);
board.GroovesAddWidth = safeEval(grooveOption.grooveAddWidth);
board.GroovesAddLength = safeEval(grooveOption.grooveAddLength);
board.KnifeRadius = template.GetParam("R").value as number;
board.GroovesAddDepth = template.GetParam("AD").value as number;
board.GroovesAddWidth = template.GetParam("AW").value as number;
board.GroovesAddLength = template.GetParam("AL").value as number;
}
opt.height = height;
@ -282,3 +327,32 @@ export function ExtendsbrThick2(temp: TemplateWineRackRecord)
}
}
}
function AppendTemplateParam(template: TemplateRecord, name: string, value: number, expr: string, description: string): void
{
let param = new TemplateParam();
param.name = name;
param.value = value;
param.expr = expr;
param.description = description;
template.Params.push(param);
};
function CreateTemplateParam(template: TemplateRecord, size: Vector3, opt: LayerBoardOption | BehindBoardOption | VerticalBoardOption, grooveOption?: IGrooveOption): void
{
template.GetParam("L").value = size.x; //空间长
template.GetParam("W").value = size.y; //空间深
template.GetParam("H").value = size.z; //空间高
let BHParam = template.GetParam("BH"); //板厚
BHParam.value = 18;
BHParam.expr = opt.exprThickness;
AppendTemplateParam(template, "C", 1, opt.exprCount, "板件数量"); //板件数量
AppendTemplateParam(template, "S", 0, opt.calcSpaceSize, "空间距离"); //板件空间距离
AppendTemplateParam(template, "R", 3, grooveOption?.exprKnifeRadius ?? "3", "刀半径"); //刀半径
AppendTemplateParam(template, "AL", 0, grooveOption?.exprGrooveAddLength ?? "3", "槽加长"); //槽加长
AppendTemplateParam(template, "AD", 0, grooveOption?.exprGrooveAddDepth ?? "3", "槽加深"); //槽加深
AppendTemplateParam(template, "AW", 0, grooveOption?.exprGrooveAddWidth ?? "3", "槽加宽"); //槽加宽
}

@ -25,7 +25,7 @@ export class DrawBehindBoard extends DrawBoardTool
}
else
{
let brs = BuildBehindBoards(this.store.m_Option as BehindBoardOption, this.space);
let brs = await BuildBehindBoards(this.store.m_Option as BehindBoardOption, this.space);
brs.forEach(b => JigUtils.Draw(b));
}
}

@ -1,7 +1,6 @@
import { app } from '../../ApplicationServices/Application';
import { TemplateLayerBoard } from '../../DatabaseServices/Template/ProgramTempate/TemplateLayerBoard';
import { SetTemplatePositionAndSetParent } from '../../DatabaseServices/Template/TempateUtils';
import { JigUtils } from '../../Editor/JigUtils';
import { LayerBoardStore } from '../../UI/Store/BoardStore';
import { LayerBoardOption } from "../../UI/Store/OptionInterface/IOptionInterface";
import { BuildLayerBoards } from './BuildBoardTool';
@ -30,11 +29,9 @@ export class DrawLayerBoard extends DrawBoardTool
}
else
{
let brs = BuildLayerBoards(this.store.m_Option as LayerBoardOption, this.space);
let brs = await BuildLayerBoards(this.store.m_Option as LayerBoardOption, this.space);
if (this.store.m_Option.cuttingProtrudingPart)
CuttingProtrudingPart(this.IntersectSpaceEntitys, brs);
brs.forEach(b => JigUtils.Draw(b));
}
}
}

@ -2,7 +2,6 @@ import { app } from '../../ApplicationServices/Application';
import { BoardType } from '../../DatabaseServices/Entity/BoardInterface';
import { TemplateVerticalBoard } from '../../DatabaseServices/Template/ProgramTempate/TemplateVerticalBoard';
import { SetTemplatePositionAndSetParent } from '../../DatabaseServices/Template/TempateUtils';
import { JigUtils } from '../../Editor/JigUtils';
import { VerticalBoardOption } from "../../UI/Store/OptionInterface/IOptionInterface";
import { BuildVerticalBoards } from './BuildBoardTool';
import { CuttingProtrudingPart } from './CuttingProtrudingPart';
@ -29,12 +28,10 @@ export class DrawVerticalBoard extends DrawBoardTool
}
else
{
let brs = BuildVerticalBoards(this.store.m_Option as VerticalBoardOption, this.space);
let brs = await BuildVerticalBoards(this.store.m_Option as VerticalBoardOption, this.space);
if (this.store.m_Option.cuttingProtrudingPart)
CuttingProtrudingPart(this.IntersectSpaceEntitys, brs);
brs.forEach(b => JigUtils.Draw(b));
}
}
}

@ -176,6 +176,16 @@ export namespace CheckoutValid
{
switch (k)
{
case "exprThickness":
case "exprKnifeRadius":
case "exprCount":
let val = safeEval(v, { L: 1, H: 1, W: 1, BH: 18, R: 3, AD: 0, AW: 0, AL: 0, C: 1, S: 0 });
if (isNaN(val) || val <= 0)
return "表达式结果必须大于0";
return "";
case "exprGrooveAddLength":
case "exprGrooveAddDepth":
case "exprGrooveAddWidth":
case "calcHeight":
case "calcWidth":
case "calcSpaceSize":
@ -184,7 +194,7 @@ export namespace CheckoutValid
case "calcLeftShrink":
case "calcRightShrink":
case "calcMoveDist":
if (isNaN(safeEval(v, { L: 1, H: 1, W: 1, BH: 1 })))
if (isNaN(safeEval(v, { L: 1, H: 1, W: 1, BH: 18, R: 3, AD: 0, AW: 0, AL: 0, C: 1, S: 0 })))
return "表达式错误";
return "";
case "sealedUp":
@ -263,9 +273,6 @@ export namespace CheckoutValid
case "rotateX":
case "rotateY":
case "rotateZ":
case "grooveAddLength":
case "grooveAddDepth":
case "grooveAddWidth":
case "back":
{
let val = safeEval(v);

@ -29,9 +29,9 @@ export class TemplateBehindBoard extends TemplateBoardRecord
this.WriteAllObjectRecord();
Object.assign(this.grooveoption, option);
}
GeneralBoardList(space: ISpaceParse)
async GeneralBoardList(space: ISpaceParse)
{
return BuildBehindBoards(this._option, space, this.grooveoption);
return await BuildBehindBoards(this._option, space, this.grooveoption);
}
ReadFile(file: CADFiler)
{

@ -45,7 +45,7 @@ export class TemplateBoardRecord extends TemplateRecord
Object.assign(this._option, option);
ExtendsBoardThickness(this, option.thickness);
}
protected GeneralBoardList(space: ISpaceParse): Board[]
protected async GeneralBoardList(space: ISpaceParse): Promise<Board[]>
{
return [];
}
@ -65,7 +65,8 @@ export class TemplateBoardRecord extends TemplateRecord
let thickness = this.GetParam("BH")?.value as number;
if (thickness)
this._option.thickness = thickness;
let nbrs = this.GeneralBoardList(this.SpaceParse);
let nbrs = await this.GeneralBoardList(this.SpaceParse);
let sbrs = this.PositioningSupportBoards;
if (this.BoardProcessOption)

@ -47,9 +47,9 @@ export class TemplateLayerBoard extends TemplateBoardRecord
this._nailOption = { ...nailOpt };
}
GeneralBoardList(space: ISpaceParse)
async GeneralBoardList(space: ISpaceParse)
{
return BuildLayerBoards(this._option, space, this.grooveOption);;
return await BuildLayerBoards(this._option, space, this.grooveOption);
}
protected async Update()

@ -37,9 +37,9 @@ export class TemplateVerticalBoard extends TemplateBoardRecord
IntersectSpaceEntitys: Set<ObjectId> = new Set();
IntersectHighDrill: string[] = [];
GeneralBoardList(space: ISpaceParse)
async GeneralBoardList(space: ISpaceParse)
{
return BuildVerticalBoards(this._option, space, this.grooveOption);;
return await BuildVerticalBoards(this._option, space, this.grooveOption);
}
ReadFile(file: CADFiler)

@ -24,7 +24,7 @@ import { EFullDir, EFullType, EWRackArrayType, EWineRackStyle, EWineRackType, IW
import { EOrderType } from "./OrderType";
export const DefaultLayerBoardConfig: LayerBoardOption = {
version: 3,
version: 4,
type: BoardType.Layer,
name: "层板",
frontShrink: 0,
@ -41,11 +41,13 @@ export const DefaultLayerBoardConfig: LayerBoardOption = {
calcFrontShrink: "0",
calcLeftShrink: "0",
calcRightShrink: "0",
exprCount: "1",
exprThickness: "18"
};
Object.freeze(DefaultLayerBoardConfig);
export const DefaultVerticalBoardConfig: VerticalBoardOption = {
version: 3,
version: 4,
type: BoardType.Vertical,
name: "立板",
frontShrink: 0,
@ -61,11 +63,13 @@ export const DefaultVerticalBoardConfig: VerticalBoardOption = {
calcSpaceSize: "0",
calcBottomShrink: "0",
calcFrontShrink: "0",
exprCount: "1",
exprThickness: "18"
};
Object.freeze(DefaultVerticalBoardConfig);
export const DefaultBehindBoardConfig: BehindBoardOption = {
version: 2,
version: 3,
type: BoardType.Behind,
name: "背板",
leftExt: 0,
@ -81,6 +85,8 @@ export const DefaultBehindBoardConfig: BehindBoardOption = {
count: 1,
calcSpaceSize: "0",
calcMoveDist: "0",
exprCount: "1",
exprThickness: "18"
};
Object.freeze(DefaultBehindBoardConfig);
@ -653,7 +659,7 @@ export const DefaultNailOption: LayerNailOption = {
count: 2,
rad: 2.5,
length: 34,
depth: 11
depth: 11,
};
Object.freeze(DefaultNailOption);

@ -15,8 +15,8 @@ import { BoardDirectionIcon, BoardRePosBlock, ItemName, SetBoardDataBlock, SetBo
export class BehindBoardModal extends React.Component<{ store?: BehindBoardStore; }, {}>
{
private m_ScaleParameter = [
["knifeRadius", "刀半径"],
["grooveAddLength", "槽加长"], ["grooveAddWidth", "槽加宽"], ["grooveAddDepth", "槽加深"]
["exprKnifeRadius", "刀半径"],
["exprGrooveAddLength", "槽加长"], ["exprGrooveAddWidth", "槽加宽"], ["exprGrooveAddDepth", "槽加深"]
];
@observable private moveDir = "移动";
UNSAFE_componentWillMount()

@ -232,9 +232,8 @@ interface BroadPosProps
}
@observer
export class BoardRePosBlock extends React.Component<BroadPosProps>
{
private pars = [["calcSpaceSize", "空间"], ["thickness", "板厚"]];
export class BoardRePosBlock extends React.Component<BroadPosProps> {
private pars = [["calcSpaceSize", "空间"], ["exprThickness", "板厚"]];
private spaceSizeInputEl: HTMLInputElement;
private countInputEl: HTMLInputElement;
private updateFocus = (k: string) =>
@ -247,7 +246,7 @@ export class BoardRePosBlock extends React.Component<BroadPosProps>
this.spaceSizeInputEl.focus();
this.spaceSizeInputEl.setSelectionRange(0, this.spaceSizeInputEl.value.length);
}
else if (k === 'count' && this.props.option.boardRelative === BrRelativePos.Div)
else if (k === 'exprCount' && this.props.option.boardRelative === BrRelativePos.Div)
{
this.countInputEl?.focus();
this.countInputEl?.setSelectionRange(0, this.spaceSizeInputEl.value.length);
@ -361,12 +360,12 @@ export class BoardRePosBlock extends React.Component<BroadPosProps>
<SetBoardDataItem
inputRef={el => { this.countInputEl = el; }}
type={CheckObjectType.BR}
key={"count"}
optKey={"count"}
key={"exprCount"}
optKey={"exprCount"}
uiOption={this.props.uiOption}
option={this.props.option}
title={"数量"}
mounted={() => this.updateFocus("count")}
mounted={() => this.updateFocus("exprCount")}
/>
</div>
</div>

@ -12,7 +12,7 @@ export const LayerBoardModal =
const scalePars = [["calcFrontShrink", "前缩"], ["calcLeftShrink", "左缩"], ["calcHeight", "板深"], ["calcRightShrink", "右缩"]];
const nailPars1 = [["addCount", "增"], ["dist", "距离"]];
const nailPars2 = [["front", "前边"], ["behind", "后边"], ["count", "个数"], ["rad", "半径"], ["length", "长度"], ["depth", "深度"]];
const m_ScaleParameter = [["knifeRadius", "刀半径"], ["grooveAddLength", "槽加长"], ["grooveAddWidth", "槽加宽"], ["grooveAddDepth", "槽加深"]];
const m_ScaleParameter = [["exprKnifeRadius", "刀半径"], ["exprGrooveAddLength", "槽加长"], ["exprGrooveAddWidth", "槽加宽"], ["exprGrooveAddDepth", "槽加深"]];
let brOpt = props.store.m_Option;
let uiOption = props.store.UIOption;

@ -11,7 +11,7 @@ export const VerticalBoardModal =
{
const store = props.store;
const scalePars = [["calcFrontShrink", "前缩"], ["calcBottomShrink", "位高"], ["calcWidth", "板深"], ["calcHeight", "板高"]];
const m_ScaleParameter = [["knifeRadius", "刀半径"], ["grooveAddLength", "槽加长"], ["grooveAddWidth", "槽加宽"], ["grooveAddDepth", "槽加深"]];
const m_ScaleParameter = [["exprKnifeRadius", "刀半径"], ["exprGrooveAddLength", "槽加长"], ["exprGrooveAddWidth", "槽加宽"], ["exprGrooveAddDepth", "槽加深"]];
const brOpt = store.m_Option;
const uiOption = store.UIOption;

@ -22,6 +22,12 @@ import { ClosingStripOption, StripType } from "./OptionInterface/ClosingStripOpt
import { AnyObject, BehindBoardOption, BoardConfigOption, IBaseOption, IDrawBoardAutoCutOption, IGrooveOption, IHightDrillOption, IUiOption, LayerBoardOption, LayerNailOption, SideBoardOption, SingleBoardOption, TBBoardOption, VerticalBoardOption } from "./OptionInterface/IOptionInterface";
import { BehindHeightPositon } from "./OptionInterface/OptionEnum";
const NewDefaultGrooveDate: IGrooveOption = {
exprGrooveAddLength: "0",
exprGrooveAddWidth: "0",
exprGrooveAddDepth: "0",
exprKnifeRadius: "3",
};
export interface IConfigStore
{
@ -402,12 +408,7 @@ export class BehindBoardStore extends BoardStore<BehindBoardOption>
{
title = "背板";
@observable m_Option: BehindBoardOption = Object.assign({}, DefaultBehindBoardConfig);
@observable grooveOption: IGrooveOption = {
grooveAddLength: "0",
grooveAddWidth: "0",
grooveAddDepth: "0",
knifeRadius: "3",
};
@observable grooveOption: IGrooveOption = NewDefaultGrooveDate;
private m_UiGrooveOption: IUiOption<IGrooveOption>;
constructor()
{
@ -426,9 +427,13 @@ export class BehindBoardStore extends BoardStore<BehindBoardOption>
InitOption()
{
Object.assign(this.m_Option, DefaultBehindBoardConfig);
super.InitOption();
Object.assign(this.grooveOption, NewDefaultGrooveDate);
if (this.m_UiGrooveOption)
Object.assign(this.m_UiGrooveOption, DataAdapter.ConvertUIData(this.grooveOption));
super.InitOption();
this.m_BoardProcessOption[EBoardKeyList.RoomName] = "主卧";
this.m_BoardProcessOption[EBoardKeyList.CabinetName] = "下柜";
this.m_BoardProcessOption[EBoardKeyList.BigHole] = FaceDirection.Back;
@ -449,12 +454,36 @@ export class BehindBoardStore extends BoardStore<BehindBoardOption>
cof.option.calcMoveDist = cof.option.moveDist.toString();
cof.option.version = 2;
}
super.UpdateOption(cof);
Object.assign(this.grooveOption, cof.grooveData);
if (cof.option.version < 3)
{
cof.option.exprCount = cof.option.count.toString();
cof.option.exprThickness = cof.option.thickness.toString();
if (!cof.grooveData)
{
//如果没有初始化grooveOption
Object.assign(this.grooveOption, NewDefaultGrooveDate);
}
else
{
//读取版本3 的grooveOption 非表达式字段
Object.assign(this.grooveOption, {
exprGrooveAddLength: cof.grooveData.grooveAddLength,
exprGrooveAddWidth: cof.grooveData.grooveAddWidth,
exprGrooveAddDepth: cof.grooveData.grooveAddDepth,
exprKnifeRadius: cof.grooveData.knifeRadius
});
}
cof.option.version = 3;
}
else
Object.assign(this.grooveOption, cof.grooveData);
if (this.m_UiGrooveOption)
Object.assign(this.m_UiGrooveOption, DataAdapter.ConvertUIData(cof.grooveData));
Object.assign(this.m_UiGrooveOption, DataAdapter.ConvertUIData(this.grooveOption));
super.UpdateOption(cof);
}
HasInvailValue()
{
@ -482,14 +511,14 @@ export class BehindBoardStore extends BoardStore<BehindBoardOption>
cloneConfig.option.boardRelative = BrRelativePos.Back;
cloneConfig.option.calcSpaceSize = "18";
cloneConfig.option.spaceSize = 18;
cloneConfig.option.thickness = 9;
cloneConfig.option.exprThickness = "9";
cloneConfig.option.topExt = 5;
cloneConfig.option.bottomExt = 5;
cloneConfig.option.leftExt = 5;
cloneConfig.option.rightExt = 5;
cloneConfig.grooveData.grooveAddLength = "6";
cloneConfig.grooveData.grooveAddWidth = "1";
cloneConfig.grooveData.grooveAddDepth = "1";
cloneConfig.grooveData.exprGrooveAddLength = "6";
cloneConfig.grooveData.exprGrooveAddWidth = "1";
cloneConfig.grooveData.exprGrooveAddDepth = "1";
cloneConfig.processData.drillType = DrillType.None;
cloneConfig.processData.highDrill = Array(4).fill(DrillType.None);
cloneConfig.processData.frontDrill = false;
@ -501,7 +530,7 @@ export class BehindBoardStore extends BoardStore<BehindBoardOption>
cloneConfig.autoCutOption.isAutoCut = true;
configs["5厘薄背板"] = cloneConfig = cloneBehindData(cloneConfig);
cloneConfig.option.thickness = 5;
cloneConfig.option.exprThickness = "5";
cloneConfig.autoCutOption.isAutoCut = true;
cloneConfig.processData.highDrill = Array(4).fill(DrillType.None);
@ -543,12 +572,7 @@ export class LayerBoardStore extends BoardStore<LayerBoardOption>
{
title = "层板";
@observable m_Option: LayerBoardOption = Object.assign({}, DefaultLayerBoardConfig);
@observable grooveOption: IGrooveOption = {
grooveAddLength: "0",
grooveAddWidth: "0",
grooveAddDepth: "0",
knifeRadius: "3",
};
@observable grooveOption: IGrooveOption = NewDefaultGrooveDate;
@observable layerNailOption: LayerNailOption = Object.assign({}, DefaultNailOption);
uiLayerNailOption: IUiOption<LayerNailOption>;
private m_UiGrooveOption: IUiOption<IGrooveOption>;
@ -574,22 +598,19 @@ export class LayerBoardStore extends BoardStore<LayerBoardOption>
InitOption()
{
Object.assign(this.m_Option, DefaultLayerBoardConfig);
Object.assign(this.grooveOption, NewDefaultGrooveDate);
if (this.m_UiGrooveOption)
Object.assign(this.m_UiGrooveOption, DataAdapter.ConvertUIData(this.grooveOption));
Object.assign(this.layerNailOption, DefaultNailOption);
super.InitOption();
if (this.uiLayerNailOption)
Object.assign(this.uiLayerNailOption, DataAdapter.ConvertUIData(this.layerNailOption));
if (this.m_UiGrooveOption)
Object.assign(this.m_UiGrooveOption, DataAdapter.ConvertUIData(this.grooveOption));
super.InitOption();
this.m_BoardProcessOption[EBoardKeyList.RoomName] = "主卧";
this.m_BoardProcessOption[EBoardKeyList.CabinetName] = "下柜";
this.m_BoardProcessOption[EBoardKeyList.BigHole] = FaceDirection.Back;
let grooveOption: IGrooveOption = {
grooveAddLength: "0",
grooveAddWidth: "0",
grooveAddDepth: "0",
knifeRadius: "3",
};
Object.assign(this.grooveOption, grooveOption);
}
InitConfigs()
{
@ -604,10 +625,10 @@ export class LayerBoardStore extends BoardStore<LayerBoardOption>
config.option.calcRightShrink = "1";
config.nailData.depth = 11;
config.nailData.isInBack = false;
config.grooveData.knifeRadius = "3";
config.grooveData.grooveAddWidth = "0";
config.grooveData.grooveAddLength = "0";
config.grooveData.grooveAddDepth = "0";
config.grooveData.exprKnifeRadius = "3";
config.grooveData.exprGrooveAddWidth = "0";
config.grooveData.exprGrooveAddLength = "0";
config.grooveData.exprGrooveAddDepth = "0";
config.processData.drillType = DrillType.None;
config.processData.highDrill = Array(4).fill(DrillType.None);
configs["活动层板"] = config;
@ -627,9 +648,7 @@ export class LayerBoardStore extends BoardStore<LayerBoardOption>
{
cof.option.version = 1;
if (cof.option.calcHeight === "L")
{
cof.option.calcHeight = "W";
}
}
if (cof.option.version < 2)
{
@ -639,37 +658,51 @@ export class LayerBoardStore extends BoardStore<LayerBoardOption>
cof.option.calcFrontShrink = cof.option.frontShrink.toString();
cof.option.version = 2;
}
if (cof.option.version < 3)
{
Object.assign(this.grooveOption, {
grooveAddLength: "0",
grooveAddWidth: "0",
grooveAddDepth: "0",
knifeRadius: "3",
});
cof.option.version = 3;
}
if (!cof.nailData)
cof.nailData = this.layerNailOption;
else
Object.assign(this.layerNailOption, cof.nailData);
// cof.option.version 这里的3版本 是处理cof.grooveData
//下面对cof.grooveData更新所以跳过删除代码
if (!cof.grooveData)
if (cof.option.version < 4)
{
cof.grooveData = this.grooveOption;
let newConfig = super.SaveConfig();
newConfig.grooveData = toJS(this.grooveOption);
cof.option.exprCount = cof.option.count.toString();
cof.option.exprThickness = cof.option.thickness.toString();
if (!cof.grooveData)
{
//如果没有初始化grooveOption
Object.assign(this.grooveOption, NewDefaultGrooveDate);
}
else
{
//读取版本3 的grooveOption 非表达式字段
Object.assign(this.grooveOption, {
exprGrooveAddLength: cof.grooveData.grooveAddLength,
exprGrooveAddWidth: cof.grooveData.grooveAddWidth,
exprGrooveAddDepth: cof.grooveData.grooveAddDepth,
exprKnifeRadius: cof.grooveData.knifeRadius
});
}
cof.option.version = 4;
}
else
Object.assign(this.grooveOption, cof.grooveData);
if (this.m_UiGrooveOption)
Object.assign(this.m_UiGrooveOption, DataAdapter.ConvertUIData(cof.grooveData));
Object.assign(this.m_UiGrooveOption, DataAdapter.ConvertUIData(this.grooveOption));
//层板钉数据
if (!cof.nailData)
cof.nailData = this.layerNailOption;
else
Object.assign(this.layerNailOption, cof.nailData);
//层板顶UI数据
if (this.uiLayerNailOption)
Object.assign(this.uiLayerNailOption, DataAdapter.ConvertUIData(this.layerNailOption));
super.UpdateOption(cof);
}
HasInvailValue()
{
return super.HasInvailValue() || CheckoutValid.HasInvailValue(this.uiLayerNailOption, CheckObjectType.BR) || CheckoutValid.HasInvailValue(this.m_UiGrooveOption, CheckObjectType.BR);;
@ -681,12 +714,7 @@ export class VerticalBoardStore extends BoardStore<VerticalBoardOption>
title = "立板";
@observable m_Option: VerticalBoardOption = Object.assign({}, DefaultVerticalBoardConfig);
@observable grooveOption: IGrooveOption = {
grooveAddLength: "0",
grooveAddWidth: "0",
grooveAddDepth: "0",
knifeRadius: "3",
};
@observable grooveOption: IGrooveOption = NewDefaultGrooveDate;
private m_UiGrooveOption: IUiOption<IGrooveOption>;
get UiGrooveOption(): IUiOption<IGrooveOption>
{
@ -703,50 +731,55 @@ export class VerticalBoardStore extends BoardStore<VerticalBoardOption>
InitOption()
{
Object.assign(this.m_Option, DefaultVerticalBoardConfig);
let grooveOption: IGrooveOption = {
grooveAddLength: "0",
grooveAddWidth: "0",
grooveAddDepth: "0",
knifeRadius: "3",
};
let grooveOption: IGrooveOption = NewDefaultGrooveDate;
Object.assign(this.grooveOption, grooveOption);
super.InitOption();
if (this.m_UiGrooveOption)
Object.assign(this.m_UiGrooveOption, DataAdapter.ConvertUIData(this.grooveOption));
super.InitOption();
}
UpdateOption(cof: IConfigOption<VerticalBoardOption>)
{
if (cof.option.version < 2)
{
cof.option.calcSpaceSize = cof.option.spaceSize.toString();
cof.option.calcFrontShrink = cof.option.frontShrink.toString();
cof.option.calcBottomShrink = cof.option.bottomShrink.toString();
cof.option.version = 2;
}
if (cof.option.version < 3)
{
Object.assign(this.grooveOption, {
grooveAddLength: "0",
grooveAddWidth: "0",
grooveAddDepth: "0",
knifeRadius: "3",
});
cof.option.version = 3;
}
if (!cof.grooveData)
// cof.option.version 这里的3版本 是处理cof.grooveData
//下面对cof.grooveData更新所以跳过删除代码
if (cof.option.version < 4)
{
cof.grooveData = this.grooveOption;
let newConfig = super.SaveConfig();
newConfig.grooveData = toJS(this.grooveOption);
cof.option.exprCount = cof.option.count.toString();
cof.option.exprThickness = cof.option.thickness.toString();
if (!cof.grooveData)
{
//如果没有初始化grooveOption
Object.assign(this.grooveOption, NewDefaultGrooveDate);
}
else
{
//读取版本3 的grooveOption 非表达式字段
Object.assign(this.grooveOption, {
exprGrooveAddLength: cof.grooveData.grooveAddLength,
exprGrooveAddWidth: cof.grooveData.grooveAddWidth,
exprGrooveAddDepth: cof.grooveData.grooveAddDepth,
exprKnifeRadius: cof.grooveData.knifeRadius,
});
}
cof.option.version = 4;
}
else
Object.assign(this.grooveOption, cof.grooveData);
super.UpdateOption(cof);
if (this.m_UiGrooveOption)
Object.assign(this.m_UiGrooveOption, DataAdapter.ConvertUIData(cof.grooveData));
Object.assign(this.m_UiGrooveOption, DataAdapter.ConvertUIData(this.grooveOption));
super.UpdateOption(cof);
}
HasInvailValue()
{

@ -86,8 +86,10 @@ export interface BehindBoardOption extends BoardConfigOption
//板件相对位置
boardRelative?: BrRelativePos;
calcHeight: string; //高度表达式
calcSpaceSize: string;
calcSpaceSize: string; //空间表达式
calcMoveDist: string;
exprCount: string; //数量表达式
exprThickness: string;//板厚表达式
}
/**
*
@ -108,10 +110,12 @@ export interface LayerBoardOption extends BoardConfigOption
spaceSize?: number;
count?: number;
boardRelative?: BrRelativePos;
calcSpaceSize: string;
calcSpaceSize: string;//空间表达式
calcFrontShrink: string;
calcLeftShrink: string;
calcRightShrink: string;
exprCount: string;//数量表达式
exprThickness: string;//板厚表达式
}
/**
*
@ -149,9 +153,11 @@ export interface VerticalBoardOption extends BoardConfigOption
boardRelative?: BrRelativePos;
calcWidth: string; //板深表达式
calcHeight: string;
calcSpaceSize: string;
calcSpaceSize: string; //空间表达式
calcFrontShrink: string;
calcBottomShrink: string;
exprCount: string;//数量表达式
exprThickness: string;//板厚表达式
}
export interface TBBoardOption extends BoardConfigOption
{
@ -184,10 +190,15 @@ export interface SingleBoardOption extends BoardConfigOption
export interface IGrooveOption extends IBaseOption
{
grooveAddLength: string; //槽加长/宽/高
grooveAddWidth: string;
grooveAddDepth: string;
grooveAddLength?: string; //槽加长/宽/高
grooveAddWidth?: string;
grooveAddDepth?: string;
knifeRadius?: string;
//表达式类型
exprGrooveAddLength?: string;
exprGrooveAddWidth?: string;
exprGrooveAddDepth?: string;
exprKnifeRadius?: string;
}
export interface IShinkOption extends IBaseOption

Loading…
Cancel
Save