!495 顶底板模块

pull/495/MERGE
ZoeLeeFZ 5 years ago committed by ChenX
parent c3d1b9c9c4
commit 43d91f2179

@ -0,0 +1,150 @@
import { Vector3 } from "three";
import { Board, BoardType } from "../../DatabaseServices/Entity/Board";
import { MoveMatrix } from "../../Geometry/GeUtils";
import { ISpaceParse } from "../../Geometry/SpaceParse/ISpaceParse";
import { TBBoardOption } from "../../UI/Store/BoardInterface";
export function BuildTopBottomBoards(topOpt: TBBoardOption, bottomOpt: TBBoardOption, space: ISpaceParse)
{
let brs: Board[] = [];
if (topOpt.isDraw)
{
let basePt = GetTopBoardBasePt(topOpt, space);
brs.push(GetTopOrDownBoard(space, topOpt, basePt, true));
}
if (bottomOpt.isDraw)
{
let basePt = GetBottomBoardBasePt(bottomOpt, space);
brs.push(GetTopOrDownBoard(space, bottomOpt, basePt, false));
let size = space.Size;
let refSize = size.y;
const thickness = bottomOpt.footThickness;
//绘制前地脚
if (bottomOpt.isDrawFooter && !bottomOpt.isWrapSide)
{
brs.push(GetFootBoard(bottomOpt, space, false));
refSize -= thickness + bottomOpt.footBehindShrink;
}
//绘制后地脚
if (bottomOpt.isDrawBackFooter && !bottomOpt.isWrapSide)
{
brs.push(GetFootBoard(bottomOpt, space, true));
refSize -= thickness + bottomOpt.footerOffset;
}
//绘制加强条
brs.push(...GetStrengthenStrips(bottomOpt, space, refSize));
}
return brs;
}
function GetTopOrDownBoard(spaceParse: ISpaceParse, opt: TBBoardOption, basePt: Vector3, isTop = true)
{
//前
let frontDist = opt.frontDist;
//左右延伸
let leftExt = opt.leftExt;
let rightExt = opt.rightExt;
//大小
let size = spaceParse.Size;
let length = size.x;
let width = size.y + frontDist + opt.behindDistance;
let thickness = opt.thickness;
if (opt.isWrapSide)
{
let leftBoardThickness = spaceParse.LeftBoard ? spaceParse.LeftBoard.Thickness : opt.thickness;
let rightBoardThickness = spaceParse.RightBoard ? spaceParse.RightBoard.Thickness : opt.thickness;
length += leftBoardThickness + rightBoardThickness + leftExt + rightExt;
}
else
{
leftExt = 0;
rightExt = 0;
}
let board = Board.CreateBoard(length, width, thickness, BoardType.Layer);
board.Name = "顶板";
if (!isTop)
{
board.Name = "底板";
}
//移动右缩和前距的距离
basePt.add(new Vector3(rightExt, -frontDist));
board.ApplyMatrix(MoveMatrix(basePt));
board.ApplyMatrix(spaceParse.SpaceOCS);
return board;
}
function GetTopBoardBasePt(opt: TBBoardOption, spc: ISpaceParse)
{
let box = spc.SpaceBox;
let min = box.min;
let max = box.max;
let basePoint = new Vector3();
if (opt.isWrapSide)
{
let rightBoardThickness = spc.RightBoard ? spc.RightBoard.Thickness : opt.thickness;
basePoint.set(max.x + rightBoardThickness, min.y, max.z);
}
else
{
basePoint.set(max.x, min.y, max.z - (opt.thickness + opt.offset));
}
return basePoint;
}
function GetBottomBoardBasePt(opt: TBBoardOption, spc: ISpaceParse)
{
let box = spc.SpaceBox;
let min = box.min;
let max = box.max;
let basePoint = new Vector3();
if (opt.isWrapSide)
{
let rightBoardThickness = spc.RightBoard ? spc.RightBoard.Thickness : opt.thickness;
basePoint.set(max.x + rightBoardThickness, min.y, min.z - opt.thickness);
}
else
{
basePoint.set(max.x, min.y, min.z + opt.offset);
}
return basePoint;
}
function GetFootBoard(opt: TBBoardOption, spaceParse: ISpaceParse, isBack: boolean)
{
let offset = opt.offset;
if (offset > 0)
{
let thickness = opt.footThickness;
let footBoard = Board.CreateBoard(offset, spaceParse.Size.x, opt.footThickness, BoardType.Behind);
footBoard.Name = isBack ? "后地脚" : "地脚线";
let moveDist = isBack ? spaceParse.Size.y - opt.footerOffset : thickness + opt.footBehindShrink;
footBoard.ApplyMatrix(MoveMatrix(spaceParse.SpaceBox.min.clone().add(new Vector3(0, moveDist))))
.ApplyMatrix(spaceParse.SpaceOCS);
return footBoard;
}
}
function GetStrengthenStrips(opt: TBBoardOption, spaceParse: ISpaceParse, width: number)
{
let brs: Board[] = [];
if (opt.isDrawStrengthenStrip && !opt.isWrapSide && opt.offset > 0)
{
const thickness = opt.footThickness;
let count = opt.divCount;
let spaceSize = (spaceParse.Size.x - count * thickness) / (count + 1);
let br = Board.CreateBoard(opt.offset, width, thickness, BoardType.Vertical);
for (let i = 1; i <= count; i++)
{
let b = br.Clone();
b.Name = "加强条" + i;
b.ApplyMatrix(MoveMatrix(spaceParse.SpaceBox.min.clone().add(new Vector3(spaceSize * i + (i - 1) * thickness, thickness + opt.footBehindShrink))))
.ApplyMatrix(spaceParse.SpaceOCS);
brs.push(b);
}
}
return brs;
}

@ -1,25 +1,21 @@
import { Vector3 } from "three";
import { app } from "../../ApplicationServices/Application";
import { EBoardKeyList } from "../../Common/BoardKeyList";
import { log } from "../../Common/Utils";
import { Board, BoardType } from "../../DatabaseServices/Entity/Board";
import { TemplateTopBottomBoard } from "../../DatabaseServices/Template/ProgramTempate/TemplateTopBottomBoard";
import { Command } from "../../Editor/CommandMachine";
import { JigUtils } from "../../Editor/JigUtils";
import { MoveMatrix } from "../../Geometry/GeUtils";
import { ISpaceParse } from "../../Geometry/SpaceParse/ISpaceParse";
import { PointSelectSpaceClamp } from "../../Geometry/SpaceParse/PointSelectSpaceClamp";
import { BoardModal, BoardModalType } from "../../UI/Components/Board/BoardModal";
import { ModalPosition, ModalState } from "../../UI/Components/Modal/ModalsManage";
import { BoardData, ComposingType, FaceDirection, LinesType, TBBoardOption } from "../../UI/Store/BoardInterface";
import { TopBottomBoardStore } from "../../UI/Store/BoardStore";
import { SetTemplatePositioning } from "./BuildBoardTool";
import { BuildTopBottomBoards } from "./BuildTopBottomBoardTool";
export class DrawTopBottomBoard implements Command
{
private store: TopBottomBoardStore;
async exec()
{
this.store = TopBottomBoardStore.GetInstance();
app.Editor.ModalManage.RenderModal(BoardModal, ModalPosition.Center, { store: this.store, type: BoardModalType.TB });
let store = TopBottomBoardStore.GetInstance();
app.Editor.ModalManage.RenderModal(BoardModal, ModalPosition.Center, { store, type: BoardModalType.TB });
let res = await app.Editor.ModalManage.Wait();
@ -28,198 +24,21 @@ export class DrawTopBottomBoard implements Command
let selectSpace = new PointSelectSpaceClamp();
await selectSpace.Select(() =>
{
if (selectSpace.SpaceParse && selectSpace.SpaceParse.ParseOK)
this.Draw(selectSpace.SpaceParse, false);
BuildTopBottomBoards(store.topBoardOption, store.bottomBoardOption, selectSpace.SpaceParse).forEach(b => JigUtils.Draw(b))
});
if (!selectSpace.ParseOK)
{
log("请选择有效板件");
return;
}
this.Draw(selectSpace.SpaceParse);
}
}
private GetTopBoardBasePt(opt: TBBoardOption, spc: ISpaceParse)
{
let box = spc.SpaceBox;
let min = box.min;
let max = box.max;
let basePoint = new Vector3();
if (opt.isWrapSide)
{
let rightBoardThickness = spc.RightBoard ? spc.RightBoard.Thickness : opt.thickness;
basePoint.set(max.x + rightBoardThickness, min.y, max.z);
}
else
{
basePoint.set(max.x, min.y, max.z - (opt.thickness + opt.offset));
}
return basePoint;
}
private GetBottomBoardBasePt(opt: TBBoardOption, spc: ISpaceParse)
{
let box = spc.SpaceBox;
let min = box.min;
let max = box.max;
let basePoint = new Vector3();
if (opt.isWrapSide)
{
let rightBoardThickness = spc.RightBoard ? spc.RightBoard.Thickness : opt.thickness;
basePoint.set(max.x + rightBoardThickness, min.y, min.z - opt.thickness);
}
else
{
basePoint.set(max.x, min.y, min.z + opt.offset);
}
return basePoint;
}
DrawTopOrDownBoard(spaceParse: ISpaceParse, data: BoardData, basePt: Vector3, isTop = true, isAppendSpace = true)
{
const opt = data.boardConfig as TBBoardOption;
if (this.store.UseBoardProcessOption)
this.store.GetBoardProcessOption(spaceParse.Boards[0]);
//前
let frontDist = opt.frontDist;
//左右延伸
let leftExt = opt.leftExt;
let rightExt = opt.rightExt;
//大小
let size = spaceParse.Size;
let length = size.x;
let width = size.y + frontDist + opt.behindDistance;
let thickness = opt.thickness;
if (opt.isWrapSide)
{
let leftBoardThickness = spaceParse.LeftBoard ? spaceParse.LeftBoard.Thickness : opt.thickness;
let rightBoardThickness = spaceParse.RightBoard ? spaceParse.RightBoard.Thickness : opt.thickness;
length += leftBoardThickness + rightBoardThickness + leftExt + rightExt;
}
else
{
leftExt = 0;
rightExt = 0;
}
let board = Board.CreateBoard(length, width, thickness, BoardType.Layer);
board.BoardProcessOption = this.store.BoardProcessOption;
board.Name = "顶板";
if (!isTop)
{
board.Name = "底板";
board.BoardProcessOption[EBoardKeyList.BigHole] = FaceDirection.Back;
}
//移动右缩和前距的距离
basePt.add(new Vector3(rightExt, -frontDist));
board.ApplyMatrix(MoveMatrix(basePt));
board.ApplyMatrix(spaceParse.SpaceOCS);
if (isAppendSpace)
app.Database.ModelSpace.Append(board);
else
JigUtils.Draw(board);
}
private DrawFootBoard(opt: TBBoardOption, spaceParse: ISpaceParse, isBack: boolean, isAppendSpace = true)
{
let offset = opt.offset;
if (offset > 0)
{
let thickness = opt.footThickness;
let footBoard = Board.CreateBoard(offset, spaceParse.Size.x, opt.footThickness, BoardType.Behind);
footBoard.Name = isBack ? "后地脚" : "地脚线";
footBoard.BoardProcessOption = this.store.BoardProcessOption;
footBoard.BoardProcessOption.lines = LinesType.Reverse;
footBoard.BoardProcessOption.composingFace = ComposingType.Reverse;
footBoard.BoardProcessOption.bigHoleDir = FaceDirection.Back;
footBoard.BoardProcessOption.lines = LinesType.Reverse;
let moveDist = isBack ? spaceParse.Size.y - opt.footerOffset : thickness + opt.footBehindShrink;
footBoard.ApplyMatrix(MoveMatrix(spaceParse.SpaceBox.min.clone().add(new Vector3(0, moveDist))))
.ApplyMatrix(spaceParse.SpaceOCS);
if (isAppendSpace)
app.Database.ModelSpace.Append(footBoard);
else
JigUtils.Draw(footBoard);
}
}
private DrawStrengthenStrip(opt: TBBoardOption, spaceParse: ISpaceParse, width: number, isAppendSpace = true)
{
if (opt.isDrawStrengthenStrip && !opt.isWrapSide && opt.offset > 0)
{
const thickness = opt.footThickness;
let count = opt.divCount;
let spaceSize = (spaceParse.Size.x - count * thickness) / (count + 1);
let br = Board.CreateBoard(opt.offset, width, thickness, BoardType.Vertical);
br.BoardProcessOption = this.store.BoardProcessOption;
br.BoardProcessOption.lines = LinesType.Reverse;
br.BoardProcessOption.composingFace = ComposingType.Reverse;
br.BoardProcessOption.bigHoleDir = FaceDirection.Back;
br.BoardProcessOption.lines = LinesType.Reverse;
for (let i = 1; i <= count; i++)
{
let b = br.Clone();
b.Name = "加强条" + i;
b.ApplyMatrix(MoveMatrix(spaceParse.SpaceBox.min.clone().add(new Vector3(spaceSize * i + (i - 1) * thickness, thickness + opt.footBehindShrink))))
.ApplyMatrix(spaceParse.SpaceOCS);
if (isAppendSpace)
app.Database.ModelSpace.Append(b);
else
JigUtils.Draw(b);
}
}
}
private Draw(space: ISpaceParse, isAppendSpace = true)
{
let topOpt = this.store.topBoardOption;
let bottomOpt = this.store.bottomBoardOption;
if (topOpt.isDraw)
{
let basePt = this.GetTopBoardBasePt(topOpt, space);
this.DrawTopOrDownBoard(
space,
{
boardConfig: topOpt,
boardProcess: this.store.m_BoardProcessOption
},
basePt,
true,
isAppendSpace
);
}
if (bottomOpt.isDraw)
{
let basePt = this.GetBottomBoardBasePt(bottomOpt, space);
this.DrawTopOrDownBoard(
space,
{
boardConfig: bottomOpt,
boardProcess: this.store.m_BoardProcessOption
},
basePt,
false,
isAppendSpace
);
let size = space.Size;
let refSize = size.y;
const thickness = bottomOpt.footThickness;
//绘制前地脚
if (bottomOpt.isDrawFooter && !bottomOpt.isWrapSide)
{
this.DrawFootBoard(bottomOpt, space, false, isAppendSpace);
refSize -= thickness + bottomOpt.footBehindShrink;
}
//绘制后地脚
if (bottomOpt.isDrawBackFooter && !bottomOpt.isWrapSide)
{
this.DrawFootBoard(bottomOpt, space, true, isAppendSpace);
refSize -= thickness + bottomOpt.footerOffset;
}
//绘制加强条
this.DrawStrengthenStrip(bottomOpt, space, refSize, isAppendSpace);
let temp = new TemplateTopBottomBoard().InitBaseParams();
temp.TopOption = store.topBoardOption;
temp.BottomOption = store.bottomBoardOption;
temp.UseBoardProcessOption = store.UseBoardProcessOption;
temp.BoardProcessOption = store.BoardProcessOption;
app.Database.TemplateTable.Append(temp);
await SetTemplatePositioning(selectSpace.SpaceParse, temp);
}
}
}

@ -8,9 +8,11 @@ import { Command } from "../../Editor/CommandMachine";
import { BoardModal, BoardModalType } from "../../UI/Components/Board/BoardModal";
import { ModalPosition } from "../../UI/Components/Modal/ModalsManage";
import { BoardConfigOption, SideBoardOption, BoardOption } from "../../UI/Store/BoardInterface";
import { BehindBoardStore, BoardStore, LayerBoardStore, VerticalBoardStore, SideBoardStore } from "../../UI/Store/BoardStore";
import { BehindBoardStore, BoardStore, LayerBoardStore, VerticalBoardStore, SideBoardStore, TopBottomBoardStore } from "../../UI/Store/BoardStore";
import { TemplateLeftRightBoardRecord } from "../../DatabaseServices/Template/ProgramTempate/TemplateLeftRightBoardRecord";
import { TemplateRecord } from "../../DatabaseServices/Template/TemplateRecord";
import { IConfigOption } from "../../UI/Components/Board/UserConfig";
import { TemplateTopBottomBoard } from "../../DatabaseServices/Template/ProgramTempate/TemplateTopBottomBoard";
export class EditorBoardTemplate implements Command
{
@ -21,7 +23,7 @@ export class EditorBoardTemplate implements Command
let store: BoardStore;
let type: BoardModalType;
let option: BoardOption;
let config: IConfigOption;
if (template instanceof TemplateLayerBoard)
{
@ -42,13 +44,25 @@ export class EditorBoardTemplate implements Command
{
store = SideBoardStore.GetInstance() as SideBoardStore;
type = BoardModalType.LR;
option = {
height: template.HParam.value,
width: template.WParam.value,
thickness: template.GetParam("BH").value,
spaceSize: template.LParam.value
config = {
option: {
height: template.HParam.value,
width: template.WParam.value,
thickness: template.GetParam("BH").value,
spaceSize: template.LParam.value
}
}
}
else if (template instanceof TemplateTopBottomBoard)
{
store = TopBottomBoardStore.GetInstance() as TopBottomBoardStore;
type = BoardModalType.TB;
config = {
topBoardData: template.TopOption,
bottomBoardData: template.BottomOption,
}
}
else return;
store.EditorTemplate = template;
@ -56,7 +70,7 @@ export class EditorBoardTemplate implements Command
store.UpdateOption({ option: template.Option });
else
{
store.UpdateOption({ option });
store.UpdateOption(config);
}
app.Editor.ModalManage.RenderModeless(BoardModal, ModalPosition.Center, { store, type });
@ -72,6 +86,11 @@ export class EditorBoardTemplate implements Command
template.HParam.UpdateParam(opt.height);
template.GetParam("BH").value = opt.thickness;
}
else if (template instanceof TemplateTopBottomBoard)
{
template.TopOption = (store as TopBottomBoardStore).topBoardOption;
template.BottomOption = (store as TopBottomBoardStore).bottomBoardOption;
}
await template.UpdateTemplateTree();
app.Editor.UpdateScreen();
}

@ -0,0 +1,245 @@
import { Vector3 } from "three";
import { BuildTopBottomBoards } from "../../../Add-on/DrawBoard/BuildTopBottomBoardTool";
import { app } from "../../../ApplicationServices/Application";
import { EBoardKeyList } from "../../../Common/BoardKeyList";
import { DefaultBottomBoardOption, DefaultTopBoardOption } from "../../../Editor/DefaultConfig";
import { Box3Ext } from "../../../Geometry/Box";
import { ISpaceParse } from "../../../Geometry/SpaceParse/ISpaceParse";
import { BoardProcessOption, ComposingType, FaceDirection, LinesType, TBBoardOption } from "../../../UI/Store/BoardInterface";
import { AutoRecord } from "../../AutoRecord";
import { CADFiler } from "../../CADFiler";
import { Board } from "../../Entity/Board";
import { TemplateRecord } from "../TemplateRecord";
/**顶底板模板 */
export class TemplateTopBottomBoard extends TemplateRecord
{
private _topOption: TBBoardOption;
private _bottomOption: TBBoardOption;
UseBoardProcessOption = false;
BoardProcessOption: BoardProcessOption;
@AutoRecord DrawCounts: [number, number, number] = [1, 1, 1]
constructor()
{
super();
this.name = "顶底板";
}
get TopOption()
{
return Object.assign({}, this._topOption);
}
set TopOption(option: TBBoardOption)
{
//@ts-ignore
if (!this._topOption) this._topOption = {};
this.WriteAllObjectRecord();
Object.assign(this._topOption, option);
}
get BottomOption()
{
return Object.assign({}, this._bottomOption);
}
set BottomOption(option: TBBoardOption)
{
//@ts-ignore
if (!this._bottomOption) this._bottomOption = {};
this.WriteAllObjectRecord();
Object.assign(this._bottomOption, option);
}
InitBaseParams()
{
super.InitBaseParams();
this._topOption = Object.assign({}, DefaultTopBoardOption);
this._bottomOption = Object.assign({}, DefaultBottomBoardOption);
return this;
}
protected async Update()
{
await super.Update();
let space = new ISpaceParse();
space.SpaceOCS = this._CacheSpaceCS;
space.ParseOK = true;
space.SpaceBox = new Box3Ext(new Vector3(), this._CacheSpaceSize);
let nbrs = BuildTopBottomBoards(this._topOption, this._bottomOption, space);
let sbrs = this.PositioningSupportBoards;
if (this.BoardProcessOption)
{
for (let br of nbrs)
{
br.BoardProcessOption = this.BoardProcessOption;
this.SetBoardProcess(br);
}
this.BoardProcessOption = undefined;
}
if (this.UseBoardProcessOption && sbrs.length > 0)
{
let cname = sbrs[0].BoardProcessOption[EBoardKeyList.CabinetName];
let rname = sbrs[0].BoardProcessOption[EBoardKeyList.RoomName];
for (let br of nbrs)
{
br.BoardProcessOption[EBoardKeyList.CabinetName] = cname;
br.BoardProcessOption[EBoardKeyList.RoomName] = rname;
}
this.UseBoardProcessOption = false;
}
let oldBrss: [Board[], Board[], Board[]] = [[], [], []];
for (let id of this.Objects)
{
let b = id.Object as Board;
oldBrss[b.BoardType].push(b);
}
let newBrss: [Board[], Board[], Board[]] = [[], [], []];
for (let b of nbrs)
{
newBrss[b.BoardType].push(b);
}
for (let i = 0; i < oldBrss.length; i++)
{
let oldBrs = oldBrss[i];
let newBrs = newBrss[i];
let refBr: Board;
if (oldBrs.length > 0)
refBr = oldBrs[0];
let oldLen = oldBrs.length;
for (let j = newBrs.length; j < oldLen; j++)
oldBrs[j].Erase();
for (let j = 0; j < newBrs.length; j++)
{
if (j < oldLen)
{
if (j >= this.DrawCounts[i])
{
oldBrs[j].Erase(false);
}
oldBrs[j].Name = newBrs[j].Name;
oldBrs[j].Position = newBrs[j].Position;
oldBrs[j].Width = newBrs[j].Width;
oldBrs[j].Height = newBrs[j].Height;
oldBrs[j].Thickness = newBrs[j].Thickness;
}
else
{
if (refBr)
{
newBrs[j].BoardProcessOption = refBr.BoardProcessOption;
this.SetBoardProcess(newBrs[j]);
}
app.Database.ModelSpace.Append(newBrs[j]);
this.Objects.push(newBrs[j].Id);
}
}
this.DrawCounts[i] = newBrs.length;
}
}
private SetBoardProcess(br: Board)
{
if (br.Name === "底板")
{
br.BoardProcessOption[EBoardKeyList.BigHole] = FaceDirection.Back;
}
else if (br.Name.includes("地脚"))
{
br.BoardProcessOption.lines = LinesType.Reverse;
br.BoardProcessOption.composingFace = ComposingType.Reverse;
br.BoardProcessOption.bigHoleDir = FaceDirection.Back;
br.BoardProcessOption.lines = LinesType.Reverse;
}
else if (br.Name.includes("加强条"))
{
br.BoardProcessOption.lines = LinesType.Reverse;
br.BoardProcessOption.composingFace = ComposingType.Reverse;
br.BoardProcessOption.bigHoleDir = FaceDirection.Back;
br.BoardProcessOption.lines = LinesType.Reverse;
}
}
ReadFile(file: CADFiler)
{
let ver = file.Read();
super.ReadFile(file);
this.DrawCounts[0] = file.Read();
this.DrawCounts[1] = file.Read();
this.DrawCounts[2] = file.Read();
this._topOption = {} as any;
this._topOption.type = file.Read();
this._topOption.name = file.Read();
this._topOption.isDraw = file.Read();
this._topOption.thickness = file.Read();
this._topOption.frontDist = file.Read();
this._topOption.behindDistance = file.Read();
this._topOption.isWrapSide = file.Read();
this._topOption.useLFData = file.Read();
this._topOption.leftExt = file.Read();
this._topOption.rightExt = file.Read();
this._topOption.offset = file.Read();
this._bottomOption = {} as any;
this._bottomOption.type = file.Read();
this._bottomOption.name = file.Read();
this._bottomOption.isDraw = file.Read();
this._bottomOption.thickness = file.Read();
this._bottomOption.frontDist = file.Read();
this._bottomOption.behindDistance = file.Read();
this._bottomOption.isWrapSide = file.Read();
this._bottomOption.useLFData = file.Read();
this._bottomOption.leftExt = file.Read();
this._bottomOption.rightExt = file.Read();
this._bottomOption.offset = file.Read();
this._bottomOption.footThickness = file.Read();
this._bottomOption.isDrawFooter = file.Read();
this._bottomOption.footBehindShrink = file.Read();
this._bottomOption.isDrawBackFooter = file.Read();
this._bottomOption.isDrawStrengthenStrip = file.Read();
this._bottomOption.footerOffset = file.Read();
this._bottomOption.divCount = file.Read();
}
WriteFile(file: CADFiler)
{
file.Write(1);
super.WriteFile(file);
file.Write(this.DrawCounts[0]);
file.Write(this.DrawCounts[1]);
file.Write(this.DrawCounts[2]);
file.Write(this._topOption.type);
file.Write(this._topOption.name);
file.Write(this._topOption.isDraw);
file.Write(this._topOption.thickness);
file.Write(this._topOption.frontDist);
file.Write(this._topOption.behindDistance);
file.Write(this._topOption.isWrapSide);
file.Write(this._topOption.useLFData);
file.Write(this._topOption.leftExt);
file.Write(this._topOption.rightExt);
file.Write(this._topOption.offset);
file.Write(this._bottomOption.type);
file.Write(this._bottomOption.name);
file.Write(this._bottomOption.isDraw);
file.Write(this._bottomOption.thickness);
file.Write(this._bottomOption.frontDist);
file.Write(this._bottomOption.behindDistance);
file.Write(this._bottomOption.isWrapSide);
file.Write(this._bottomOption.useLFData);
file.Write(this._bottomOption.leftExt);
file.Write(this._bottomOption.rightExt);
file.Write(this._bottomOption.offset);
file.Write(this._bottomOption.footThickness);
file.Write(this._bottomOption.isDrawFooter);
file.Write(this._bottomOption.footBehindShrink);
file.Write(this._bottomOption.isDrawBackFooter);
file.Write(this._bottomOption.isDrawStrengthenStrip);
file.Write(this._bottomOption.footerOffset);
file.Write(this._bottomOption.divCount);
}
}

@ -9,6 +9,7 @@ import { Editor, EditorService } from "./Editor";
import { PromptStatus } from "./PromptResult";
import { TemplateBoardRecord } from "../DatabaseServices/Template/ProgramTempate/TemplateBoard";
import { TemplateLeftRightBoardRecord } from "../DatabaseServices/Template/ProgramTempate/TemplateLeftRightBoardRecord";
import { TemplateTopBottomBoard } from "../DatabaseServices/Template/ProgramTempate/TemplateTopBottomBoard";
const KeyWordCommandMap: Map<string, string> = new Map(Object.entries({
"1": "HS",
@ -151,7 +152,7 @@ export class ContextMenuServices implements EditorService
let temp = selects[0].Template.Object;
if (temp instanceof TemplateWineRackRecord)
menuKeywords.push({ key: "WR", msg: "编辑酒格模块" });
else if (temp instanceof TemplateBoardRecord || temp instanceof TemplateLeftRightBoardRecord)
else if (temp instanceof TemplateBoardRecord || temp instanceof TemplateLeftRightBoardRecord || temp instanceof TemplateTopBottomBoard)
{
menuKeywords.push({ key: "T", msg: "编辑板件模块" });
}

@ -1,4 +1,4 @@
import { LayerBoardOption, BrRelativePos, VerticalBoardOption, BehindBoardOption, BehindHeightPositon } from "../UI/Store/BoardInterface";
import { LayerBoardOption, BrRelativePos, VerticalBoardOption, BehindBoardOption, BehindHeightPositon, TBBoardOption } from "../UI/Store/BoardInterface";
import { BoardType } from "../DatabaseServices/Entity/Board";
import { IWineRackOption, EWineRackType, EWRackArrayType, EFullType, EFullDir } from "../UI/Store/WineRackInterface";
@ -80,3 +80,40 @@ export const DefaultWineRackConfig: IWineRackOption = {
brThick2: 18,
}
Object.freeze(DefaultWineRackConfig);
export const DefaultTopBoardOption: TBBoardOption = {
type: BoardType.Layer,
name: "顶板",
isDraw: true,
thickness: 18,
frontDist: 0,
behindDistance: 0,
isWrapSide: false,
useLFData: true,
leftExt: 0,
rightExt: 0,
offset: 0,
};
Object.freeze(DefaultTopBoardOption);
export const DefaultBottomBoardOption: TBBoardOption = {
type: BoardType.Layer,
name: "底板",
isDraw: true,
thickness: 18,
frontDist: 0,
behindDistance: 0,
isWrapSide: false,
useLFData: true,
leftExt: 0,
rightExt: 0,
offset: 80,
footThickness: 18,
isDrawFooter: true,
footBehindShrink: 0,
isDrawBackFooter: true,
isDrawStrengthenStrip: true,
footerOffset: 0,
divCount: 1,
};
Object.freeze(DefaultBottomBoardOption);

@ -8,7 +8,7 @@ import { Singleton } from '../../Common/Singleton';
import { ClosingStripReg } from '../../Common/Utils';
import { Board, BoardType } from '../../DatabaseServices/Entity/Board';
import { TemplateRecord } from '../../DatabaseServices/Template/TemplateRecord';
import { DefaultBehindBoardConfig, DefaultLayerBoardConfig, DefaultVerticalBoardConfig } from '../../Editor/DefaultConfig';
import { DefaultBehindBoardConfig, DefaultLayerBoardConfig, DefaultVerticalBoardConfig, DefaultTopBoardOption, DefaultBottomBoardOption } from '../../Editor/DefaultConfig';
import { userConfig } from '../../Editor/UserConfig';
import { IConfigOption } from '../Components/Board/UserConfig';
import { ModalState } from '../Components/Modal/ModalsManage';
@ -152,39 +152,8 @@ export class SideBoardStore extends BoardStore
export class TopBottomBoardStore extends BoardStore
{
@observable topBoardOption: TBBoardOption = {
type: BoardType.Layer,
name: "顶板",
isDraw: true,
thickness: 18,
frontDist: 0,
behindDistance: 0,
isWrapSide: false,
useLFData: true,
leftExt: 0,
rightExt: 0,
offset: 0,
};
@observable bottomBoardOption: TBBoardOption = {
type: BoardType.Layer,
name: "底板",
isDraw: true,
thickness: 18,
frontDist: 0,
behindDistance: 0,
isWrapSide: false,
useLFData: true,
leftExt: 0,
rightExt: 0,
offset: 80,
footThickness: 18,
isDrawFooter: true,
footBehindShrink: 0,
isDrawBackFooter: true,
isDrawStrengthenStrip: true,
footerOffset: 0,
divCount: 1,
};
@observable topBoardOption: TBBoardOption = Object.assign({}, DefaultTopBoardOption);
@observable bottomBoardOption: TBBoardOption = Object.assign({}, DefaultBottomBoardOption);
title = "顶底板";
topUiOption: any;
bottomUiOption: any;

Loading…
Cancel
Save