|
|
@ -20,7 +20,6 @@ import { TemplateSizeBoard } from "../../DatabaseServices/Template/ProgramTempat
|
|
|
|
import { ISpaceParse } from "../../Geometry/SpaceParse/ISpaceParse";
|
|
|
|
import { ISpaceParse } from "../../Geometry/SpaceParse/ISpaceParse";
|
|
|
|
import { EBoardKeyList } from "../../Common/BoardKeyList";
|
|
|
|
import { EBoardKeyList } from "../../Common/BoardKeyList";
|
|
|
|
import { BoardModalType } from "../../UI/Components/Board/BoardModal";
|
|
|
|
import { BoardModalType } from "../../UI/Components/Board/BoardModal";
|
|
|
|
import { INeedUpdateParams } from "../../UI/Components/Template/TemplateComponent";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export class DrawDrawrer implements Command
|
|
|
|
export class DrawDrawrer implements Command
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -96,6 +95,11 @@ export class DrawDrawrer implements Command
|
|
|
|
for (let id of [...tempIds])
|
|
|
|
for (let id of [...tempIds])
|
|
|
|
{
|
|
|
|
{
|
|
|
|
let temp = await GetOnlineTemplate(id);
|
|
|
|
let temp = await GetOnlineTemplate(id);
|
|
|
|
|
|
|
|
if (!temp)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
console.warn(temp.Name, temp.Id, "这个抽屉不能用");
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
}
|
|
|
|
let ens = temp.Db.ModelSpace.Entitys;
|
|
|
|
let ens = temp.Db.ModelSpace.Entitys;
|
|
|
|
if (surroundOption)
|
|
|
|
if (surroundOption)
|
|
|
|
for (let en of ens)
|
|
|
|
for (let en of ens)
|
|
|
@ -143,7 +147,18 @@ export class DrawDrawrer implements Command
|
|
|
|
|
|
|
|
|
|
|
|
let depthTemp = GetDeepestTemplate(tbrs);
|
|
|
|
let depthTemp = GetDeepestTemplate(tbrs);
|
|
|
|
|
|
|
|
|
|
|
|
let templateSpace = this.GetRootTemplate(spaceParse, store.m_Option, store.currentRotationExpr);
|
|
|
|
//根空间
|
|
|
|
|
|
|
|
let rootSpaceTemplate = this.GetTotalSpaceTemplate(spaceParse);
|
|
|
|
|
|
|
|
let isLockHeigt = store.IsLockDrawerHeight;
|
|
|
|
|
|
|
|
let xlkSpace = this.GetLkSpace(store.m_Option.isLockBottomOffset || !isLockHeigt || !store.m_Option.isLockTopOffset, store.m_Option.bottomOffset, false);
|
|
|
|
|
|
|
|
rootSpaceTemplate.Children.push(xlkSpace.Id);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//抽屉根空间
|
|
|
|
|
|
|
|
let templateSpace = this.GetRootTemplate(spaceParse, store, isLockHeigt);
|
|
|
|
|
|
|
|
rootSpaceTemplate.Children.push(templateSpace.Id);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let slkSpace = this.GetLkSpace(store.m_Option.isLockTopOffset || !isLockHeigt, store.m_Option.topOffset, true);
|
|
|
|
|
|
|
|
rootSpaceTemplate.Children.push(slkSpace.Id);
|
|
|
|
|
|
|
|
|
|
|
|
for (let i = 0; i < col; i++)
|
|
|
|
for (let i = 0; i < col; i++)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -171,8 +186,8 @@ export class DrawDrawrer implements Command
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (depthTemp)
|
|
|
|
if (depthTemp)
|
|
|
|
depthTemp.Children.push(templateSpace.Id);
|
|
|
|
depthTemp.Children.push(rootSpaceTemplate.Id);
|
|
|
|
await templateSpace.UpdateTemplateTree();
|
|
|
|
await rootSpaceTemplate.UpdateTemplateTree();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
private AppendTemplateParam(name: string, value: number, des: string, temp: TemplateRecord)
|
|
|
|
private AppendTemplateParam(name: string, value: number, des: string, temp: TemplateRecord)
|
|
|
@ -183,17 +198,19 @@ export class DrawDrawrer implements Command
|
|
|
|
par.description = des;
|
|
|
|
par.description = des;
|
|
|
|
temp.Params.push(par);
|
|
|
|
temp.Params.push(par);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
private GetRootTemplate(spaceParse: ISpaceParse, option: IDrawerConfigOption, roInfos: INeedUpdateParams[])
|
|
|
|
private GetRootTemplate(spaceParse: ISpaceParse, store: DrawerStore, isLock: boolean)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
const roInfos = store.currentRotationExpr;
|
|
|
|
|
|
|
|
const option = store.m_Option;
|
|
|
|
|
|
|
|
|
|
|
|
let templateSpace = new TemplateRecord().InitBaseParams();
|
|
|
|
let templateSpace = new TemplateRecord().InitBaseParams();
|
|
|
|
templateSpace.Name = "根空间";
|
|
|
|
templateSpace.Name = "抽屉根空间";
|
|
|
|
templateSpace.SplitType = TemplateSplitType.X;
|
|
|
|
templateSpace.SplitType = TemplateSplitType.X;
|
|
|
|
|
|
|
|
|
|
|
|
for (let info of roInfos)
|
|
|
|
for (let info of roInfos)
|
|
|
|
templateSpace.GetParam(info.name).expr = info.expr;
|
|
|
|
templateSpace.GetParam(info.name).expr = info.expr;
|
|
|
|
|
|
|
|
|
|
|
|
templateSpace.HParam.expr = `H-SLK-XLK`;
|
|
|
|
templateSpace.HParam.expr = isLock ? spaceParse.Size.z - option.topOffset - option.bottomOffset : "_DIV";
|
|
|
|
templateSpace.PZParam.expr = "XLK";
|
|
|
|
|
|
|
|
templateSpace.PYParam.expr = "MBH";
|
|
|
|
templateSpace.PYParam.expr = "MBH";
|
|
|
|
|
|
|
|
|
|
|
|
let depth = (option.drawerTotalDepth > 0 && option.depth > option.drawerTotalDepth) ? option.drawerTotalDepth : option.depth;
|
|
|
|
let depth = (option.drawerTotalDepth > 0 && option.depth > option.drawerTotalDepth) ? option.drawerTotalDepth : option.depth;
|
|
|
@ -202,9 +219,6 @@ export class DrawDrawrer implements Command
|
|
|
|
this.AppendTemplateParam("DWDEEPTH", depth, "抽屉深度", templateSpace);
|
|
|
|
this.AppendTemplateParam("DWDEEPTH", depth, "抽屉深度", templateSpace);
|
|
|
|
this.AppendTemplateParam("MBH", option.offset, "抽屉内缩", templateSpace);
|
|
|
|
this.AppendTemplateParam("MBH", option.offset, "抽屉内缩", templateSpace);
|
|
|
|
|
|
|
|
|
|
|
|
this.AppendTemplateParam("SLK", option.topOffset, "上留空", templateSpace);
|
|
|
|
|
|
|
|
this.AppendTemplateParam("XLK", option.bottomOffset, "下留空", templateSpace);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.AppendTemplateParam("SYS", option.topExt, "上延伸", templateSpace);
|
|
|
|
this.AppendTemplateParam("SYS", option.topExt, "上延伸", templateSpace);
|
|
|
|
this.AppendTemplateParam("XYS", option.bottomExt, "下延伸", templateSpace);
|
|
|
|
this.AppendTemplateParam("XYS", option.bottomExt, "下延伸", templateSpace);
|
|
|
|
this.AppendTemplateParam("YYS", option.rightExt, "右延伸", templateSpace);
|
|
|
|
this.AppendTemplateParam("YYS", option.rightExt, "右延伸", templateSpace);
|
|
|
@ -224,18 +238,9 @@ export class DrawDrawrer implements Command
|
|
|
|
this.AppendTemplateParam("YJ", option.horSpacing, "拉手右距", templateSpace);
|
|
|
|
this.AppendTemplateParam("YJ", option.horSpacing, "拉手右距", templateSpace);
|
|
|
|
this.AppendTemplateParam("ZJ", option.horSpacing, "拉手左距", templateSpace);
|
|
|
|
this.AppendTemplateParam("ZJ", option.horSpacing, "拉手左距", templateSpace);
|
|
|
|
|
|
|
|
|
|
|
|
if (spaceParse instanceof ClampSpaceParse)
|
|
|
|
templateSpace.LParam.expr = "_L";
|
|
|
|
{
|
|
|
|
templateSpace.WParam.expr = "_W";
|
|
|
|
let positioning = new PositioningClampSpace();
|
|
|
|
templateSpace.PZParam.expr = "_POS";
|
|
|
|
positioning.FromSpaceParse(spaceParse);
|
|
|
|
|
|
|
|
templateSpace.Positioning = positioning;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
templateSpace.LParam.expr = spaceParse.Size.x;
|
|
|
|
|
|
|
|
templateSpace.WParam.expr = spaceParse.Size.y;
|
|
|
|
|
|
|
|
templateSpace.HParam.expr = spaceParse.Size.z;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
app.Database.TemplateTable.Append(templateSpace);
|
|
|
|
app.Database.TemplateTable.Append(templateSpace);
|
|
|
|
|
|
|
|
|
|
|
|
return templateSpace;
|
|
|
|
return templateSpace;
|
|
|
@ -433,4 +438,35 @@ export class DrawDrawrer implements Command
|
|
|
|
verTemp.PZParam.expr = "-_XLK";
|
|
|
|
verTemp.PZParam.expr = "-_XLK";
|
|
|
|
return verTemp;
|
|
|
|
return verTemp;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private GetTotalSpaceTemplate(spaceParse: ISpaceParse)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
let templateSpace = new TemplateRecord().InitBaseParams();
|
|
|
|
|
|
|
|
templateSpace.Name = "抽屉总空间";
|
|
|
|
|
|
|
|
templateSpace.SplitType = TemplateSplitType.Z;
|
|
|
|
|
|
|
|
app.Database.TemplateTable.Append(templateSpace);
|
|
|
|
|
|
|
|
if (spaceParse instanceof ClampSpaceParse)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
let positioning = new PositioningClampSpace();
|
|
|
|
|
|
|
|
positioning.FromSpaceParse(spaceParse);
|
|
|
|
|
|
|
|
templateSpace.Positioning = positioning;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
templateSpace.LParam.expr = spaceParse.Size.x;
|
|
|
|
|
|
|
|
templateSpace.WParam.expr = spaceParse.Size.y;
|
|
|
|
|
|
|
|
templateSpace.HParam.expr = spaceParse.Size.z;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return templateSpace;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/**获取上下留空空间模板 */
|
|
|
|
|
|
|
|
private GetLkSpace(isLock: boolean, height: number, isSLK: boolean)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
let templateSpace = new TemplateRecord().InitBaseParams();
|
|
|
|
|
|
|
|
templateSpace.Name = isSLK ? "上留空空间" : "下留空空间";
|
|
|
|
|
|
|
|
templateSpace.HParam.expr = isLock ? height : `_DIV`;
|
|
|
|
|
|
|
|
templateSpace.LParam.expr = "_L";
|
|
|
|
|
|
|
|
templateSpace.WParam.expr = "_W";
|
|
|
|
|
|
|
|
app.Database.TemplateTable.Append(templateSpace);
|
|
|
|
|
|
|
|
return templateSpace;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|