|
|
|
@ -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", "槽加宽"); //槽加宽
|
|
|
|
|
}
|
|
|
|
|