!622 板件模块加入板厚参数

pull/622/MERGE
ZoeLeeFZ 5 years ago committed by ChenX
parent deb3a8132d
commit 32c94802af

@ -82,13 +82,15 @@ export class EditorBoardTemplate implements Command
{
if (template instanceof TemplateBoardRecord)
{
template.Option = store.m_Option as BoardConfigOption;
const opt = store.m_Option as BoardConfigOption;
template.Option = opt;
template.GetParam("BH").expr = opt.thickness;
if (template instanceof TemplateLayerBoard)
template.NailOption = (store as LayerBoardStore).layerNailOption;
}
else if (template instanceof TemplateLeftRightBoardRecord)
{
let opt = store.m_Option as SideBoardOption;
const opt = store.m_Option as SideBoardOption;
template.LParam.expr = opt.spaceSize;
template.WParam.expr = opt.width;
template.HParam.expr = opt.height;
@ -96,8 +98,16 @@ export class EditorBoardTemplate implements Command
}
else if (template instanceof TemplateTopBottomBoard)
{
template.TopOption = (store as TopBottomBoardStore).topBoardOption;
template.BottomOption = (store as TopBottomBoardStore).bottomBoardOption;
const topOpt = (store as TopBottomBoardStore).topBoardOption;
const bottomOpt = (store as TopBottomBoardStore).bottomBoardOption;
template.TopOption = topOpt;
template.BottomOption = bottomOpt;
template.GetParam("TBH").expr = topOpt.thickness;
template.GetParam("BBH").expr = bottomOpt.thickness;
template.GetParam("FBH").expr = bottomOpt.footThickness;
}
await template.UpdateTemplateTree();
app.Editor.UpdateScreen();

@ -35,6 +35,7 @@ export class EditorLattice implements Command
return;
editorTemp.Option = store.m_Option;
editorTemp.GetParam("BH").expr = store.m_Option.thickness;
await editorTemp.UpdateTemplateTree();
app.Editor.UpdateScreen();
}

@ -26,9 +26,6 @@ export class TemplateBehindBoard extends TemplateBoardRecord
}
set Grooveoption(option: IGrooveOption)
{
//@ts-ignore
if (!this.grooveoption) this.grooveoption = {};
this.WriteAllObjectRecord();
Object.assign(this.grooveoption, option);
}

@ -9,6 +9,8 @@ import { Factory } from "../../CADFactory";
import { CADFiler } from "../../CADFiler";
import { Board } from "../../Entity/Board";
import { TemplateRecord } from "../TemplateRecord";
import { TemplateParam } from "../Param/TemplateParam";
import { TemplateParamType } from "../Param/TemplateParamType";
/**
* .(,,)
@ -23,15 +25,25 @@ export class TemplateBoardRecord extends TemplateRecord
@AutoRecord DrawBoardCount = 1;
protected _option: BoardConfigOption;
InitBaseParams()
{
super.InitBaseParams();
let param = new TemplateParam();
param.name = "BH";
param.description = "板厚";
param.type = TemplateParamType.Float;
param.value = 18;
this.Params.push(param);
return this;
}
get Option()
{
return Object.assign({}, this._option);
}
set Option(option: BoardConfigOption)
{
//@ts-ignore
if (!this._option) this._option = {};
this.WriteAllObjectRecord();
Object.assign(this._option, option);
}
@ -46,6 +58,7 @@ export class TemplateBoardRecord extends TemplateRecord
space.SpaceOCS = this._CacheSpaceCS;
space.ParseOK = true;
space.SpaceBox = new Box3Ext(new Vector3(), this._CacheSpaceSize);
this._option.thickness = this.GetParam("BH").value as number;
let nbrs = this.GeneralBoardList(space);
let sbrs = this.PositioningSupportBoards;

@ -9,6 +9,8 @@ import { Factory } from "../../CADFactory";
import { CADFiler } from "../../CADFiler";
import { Board } from "../../Entity/Board";
import { TemplateRecord } from "../TemplateRecord";
import { TemplateParam } from "../Param/TemplateParam";
import { TemplateParamType } from "../Param/TemplateParamType";
@Factory
export class TemplateLatticeRecord extends TemplateRecord
@ -28,10 +30,25 @@ export class TemplateLatticeRecord extends TemplateRecord
this.WriteAllObjectRecord();
Object.assign(this.option, option);
}
InitBaseParams()
{
super.InitBaseParams();
this.option = Object.assign({}, DefaultLatticeConfig);
let param = new TemplateParam();
param.name = "BH";
param.description = "板厚";
param.type = TemplateParamType.Float;
param.value = this.option.thickness;
this.Params.push(param);
return this;
}
protected async Update()
{
await super.Update();
this.option.thickness = this.GetParam("BH").value as number;
let tool = DrawLatticeDrawerTool.GetInstance() as DrawLatticeDrawerTool;
let sbrs = this.PositioningSupportBoards;

@ -24,6 +24,7 @@ export class TemplateLeftRightBoardRecord extends TemplateRecord
let param = new TemplateParam();
param.name = "BH";
param.description = "板厚";
param.type = TemplateParamType.Float;
param.value = 18;
this.Params.push(param);

@ -8,6 +8,8 @@ import { Factory } from "../../CADFactory";
import { CADFiler } from "../../CADFiler";
import { Board } from "../../Entity/Board";
import { TemplateRecord } from "../TemplateRecord";
import { TemplateParam } from "../Param/TemplateParam";
import { TemplateParamType } from "../Param/TemplateParamType";
/**顶底板模板 */
@Factory
@ -41,9 +43,40 @@ export class TemplateTopBottomBoard extends TemplateRecord
this.WriteAllObjectRecord();
Object.assign(this._bottomOption, option);
}
InitBaseParams()
{
super.InitBaseParams();
let param = new TemplateParam();
param.name = "TBH";
param.description = "顶板板厚";
param.type = TemplateParamType.Float;
param.value = this._topOption.thickness;
this.Params.push(param);
let param1 = new TemplateParam();
param1.name = "BBH";
param1.description = "底板板厚";
param1.type = TemplateParamType.Float;
param1.value = this._bottomOption.thickness;
this.Params.push(param1);
let param2 = new TemplateParam();
param2.name = "FBH";
param2.description = "地脚厚";
param2.type = TemplateParamType.Float;
param2.value = this._bottomOption.footThickness;
this.Params.push(param2);
return this;
}
protected async Update()
{
await super.Update();
this._topOption.thickness = this.GetParam("TBH").value as number;
this._bottomOption.thickness = this.GetParam("BBH").value as number;
this._bottomOption.footThickness = this.GetParam("FBH").value as number;
let spaceParse = this.SpaceParse;
let nbrs = BuildTopBottomBoards(this._topOption, this._bottomOption, spaceParse);

@ -17,43 +17,43 @@ export class TemplateVerticalBoard extends TemplateBoardRecord
super();
this.name = "立板(自动)";
}
protected option: VerticalBoardOption = { ...DefaultVerticalBoardConfig };
protected _option: VerticalBoardOption = { ...DefaultVerticalBoardConfig };
GeneralBoardList(space: ISpaceParse)
{
return BuildVerticalBoards(this.option, space);
return BuildVerticalBoards(this._option, space);
}
ReadFile(file: CADFiler)
{
let ver = file.Read();
super.ReadFile(file);
this.option.type = file.Read();
this.option.name = file.Read();
this.option.frontShrink = file.Read();
this.option.bottomShrink = file.Read();
this.option.calcWidth = file.Read();
this.option.calcHeight = file.Read();
this.option.isTotalLength = file.Read();
this.option.isTotalWidth = file.Read();
this.option.boardRelative = file.Read();
this.option.thickness = file.Read();
this.option.count = file.Read();
this.option.spaceSize = file.Read();
this._option.type = file.Read();
this._option.name = file.Read();
this._option.frontShrink = file.Read();
this._option.bottomShrink = file.Read();
this._option.calcWidth = file.Read();
this._option.calcHeight = file.Read();
this._option.isTotalLength = file.Read();
this._option.isTotalWidth = file.Read();
this._option.boardRelative = file.Read();
this._option.thickness = file.Read();
this._option.count = file.Read();
this._option.spaceSize = file.Read();
}
WriteFile(file: CADFiler)
{
file.Write(1);
super.WriteFile(file);
file.Write(this.option.type);
file.Write(this.option.name);
file.Write(this.option.frontShrink);
file.Write(this.option.bottomShrink);
file.Write(this.option.calcWidth);
file.Write(this.option.calcHeight);
file.Write(this.option.isTotalLength);
file.Write(this.option.isTotalWidth);
file.Write(this.option.boardRelative);
file.Write(this.option.thickness);
file.Write(this.option.count);
file.Write(this.option.spaceSize);
file.Write(this._option.type);
file.Write(this._option.name);
file.Write(this._option.frontShrink);
file.Write(this._option.bottomShrink);
file.Write(this._option.calcWidth);
file.Write(this._option.calcHeight);
file.Write(this._option.isTotalLength);
file.Write(this._option.isTotalWidth);
file.Write(this._option.boardRelative);
file.Write(this._option.thickness);
file.Write(this._option.count);
file.Write(this._option.spaceSize);
}
}

@ -10,6 +10,8 @@ import { Factory } from "../../CADFactory";
import { CADFiler } from "../../CADFiler";
import { Board } from "../../Entity/Board";
import { TemplateRecord } from "../TemplateRecord";
import { TemplateParam } from "../Param/TemplateParam";
import { TemplateParamType } from "../Param/TemplateParamType";
@Factory
export class TemplateWineRackRecord extends TemplateRecord
@ -29,10 +31,24 @@ export class TemplateWineRackRecord extends TemplateRecord
this.WriteAllObjectRecord();
Object.assign(this.option, option);
}
InitBaseParams()
{
super.InitBaseParams();
let param = new TemplateParam();
param.name = "BH";
param.description = "板厚";
param.type = TemplateParamType.Float;
param.value = this.option.boardThick;
this.Params.push(param);
return this;
}
protected async Update()
{
await super.Update();
this.option.boardThick = this.GetParam("BH").value as number;
let wineRack: DrawWineRackTool;
if (this.option.type === EWineRackType.Oblique)
wineRack = DrawObliqueWineRackTool.GetInstance() as DrawObliqueWineRackTool;

@ -48,6 +48,7 @@ export class WineRackModal extends React.Component<{ store?: WineRackStore; }, {
{
let temp = this.props.store.editorTemplate;
temp.Option = opt;
temp.GetParam("BH").expr = opt.boardThick;
await temp.UpdateTemplateTree();
app.Editor.UpdateScreen();
this.props.store.editorTemplate = undefined;

Loading…
Cancel
Save