!1592 增强:层立板绘制界面加上增加刀具半径、槽加长、槽加宽、槽加深选项

pull/1653/MERGE
林三 3 years ago committed by ChenX
parent abaadbd9c6
commit 708a258439

@ -7,7 +7,7 @@ import { MoveMatrix } from "../../Geometry/GeUtils";
import { ISpaceParse } from "../../Geometry/SpaceParse/ISpaceParse";
import { BehindBoardOption, BehindHeightPositon, BoardType, BrRelativePos, IGrooveOption, LayerBoardOption, VerticalBoardOption } from "../../UI/Store/BoardInterface";
export function BuildLayerBoards(opt: LayerBoardOption, space: ISpaceParse): Board[]
export function BuildLayerBoards(opt: LayerBoardOption, space: ISpaceParse, grooveOption?: IGrooveOption): Board[]
{
let spaceBox = space.SpaceBox;
let spaceOCS = space.SpaceOCS;
@ -44,6 +44,13 @@ export function BuildLayerBoards(opt: LayerBoardOption, space: ISpaceParse): Boa
return [];
}
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);
}
opt.height = len;
opt.width = width;
@ -80,7 +87,7 @@ export function BuildLayerBoards(opt: LayerBoardOption, space: ISpaceParse): Boa
return brs;
}
export function BuildVerticalBoards(opt: VerticalBoardOption, space: ISpaceParse): Board[]
export function BuildVerticalBoards(opt: VerticalBoardOption, space: ISpaceParse, grooveOption?: IGrooveOption): Board[]
{
const spaceBox = space.SpaceBox;
const spaceOCS = space.SpaceOCS;
@ -118,7 +125,13 @@ export function BuildVerticalBoards(opt: VerticalBoardOption, space: ISpaceParse
let thickness = opt.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);
}
opt.height = length;
opt.width = width;

@ -16,6 +16,7 @@ export class DrawLayerBoard extends DrawBoardTool
const store = this.store as LayerBoardStore;
let temp = new TemplateLayerBoard().InitBaseParams();
temp.Option = store.m_Option;
temp.GrooveOption = store.grooveOption;
temp.NailOption = store.layerNailOption;
temp.UseBoardProcessOption = this.store.BoardProcessOption.useBoardProcessOption;
temp.BoardProcessOption = this.store.BoardProcessOption;

@ -2,7 +2,7 @@ import { app } from '../../ApplicationServices/Application';
import { TemplateVerticalBoard } from '../../DatabaseServices/Template/ProgramTempate/TemplateVerticalBoard';
import { SetTemplatePositionAndSetParent } from '../../DatabaseServices/Template/TempateUtils';
import { JigUtils } from '../../Editor/JigUtils';
import { VerticalBoardOption, BoardType } from '../../UI/Store/BoardInterface';
import { BoardType, VerticalBoardOption } from '../../UI/Store/BoardInterface';
import { BuildVerticalBoards } from './BuildBoardTool';
import { DrawBoardTool } from './DrawBoardTool';
@ -17,6 +17,7 @@ export class DrawVerticalBoard extends DrawBoardTool
temp.Option = this.store.m_Option as VerticalBoardOption;
temp.UseBoardProcessOption = this.store.BoardProcessOption.useBoardProcessOption;;
temp.BoardProcessOption = this.store.BoardProcessOption;
temp.GrooveOption = this.store.grooveOption;
app.Database.TemplateTable.Append(temp);
await SetTemplatePositionAndSetParent(this.space, temp);
}

@ -1,12 +1,12 @@
import { activityLayerBoardTool } from "../../../Add-on/DrawBoard/ActivityLayerBoardTool";
import { BuildLayerBoards } from "../../../Add-on/DrawBoard/BuildBoardTool";
import { DefaultLayerBoardConfig, DefaultNailOption } from "../../../Editor/DefaultConfig";
import { ISpaceParse } from "../../../Geometry/SpaceParse/ISpaceParse";
import { LayerBoardOption, LayerNailOption } from "../../../UI/Store/BoardInterface";
import { IGrooveOption, LayerBoardOption, LayerNailOption } from "../../../UI/Store/BoardInterface";
import { Factory } from "../../CADFactory";
import { TemplateBoardRecord } from "./TemplateBoard";
import { DefaultLayerBoardConfig, DefaultNailOption } from "../../../Editor/DefaultConfig";
import { CADFiler } from "../../CADFiler";
import { Board } from "../../Entity/Board";
import { activityLayerBoardTool } from "../../../Add-on/DrawBoard/ActivityLayerBoardTool";
import { TemplateBoardRecord } from "./TemplateBoard";
/**
*
@ -21,6 +21,17 @@ export class TemplateLayerBoard extends TemplateBoardRecord
}
protected _option: LayerBoardOption = { ...DefaultLayerBoardConfig };
private _nailOption: LayerNailOption = { ...DefaultNailOption };
private grooveOption: IGrooveOption = {
grooveAddLength: "0",
grooveAddWidth: "0",
grooveAddDepth: "0",
knifeRadius: "3",
};
set GrooveOption(option: IGrooveOption)
{
this.WriteAllObjectRecord();
Object.assign(this.grooveOption, option);
}
get NailOption()
{
return { ...this._nailOption };
@ -33,7 +44,7 @@ export class TemplateLayerBoard extends TemplateBoardRecord
GeneralBoardList(space: ISpaceParse)
{
return BuildLayerBoards(this._option, space);
return BuildLayerBoards(this._option, space, this.grooveOption);
}
protected async Update()
{
@ -68,6 +79,7 @@ export class TemplateLayerBoard extends TemplateBoardRecord
this._option.count = file.Read();
this._option.spaceSize = file.Read();
this._option.isActive = file.Read();
if (ver > 1)
{
this._nailOption.isDraw = file.Read();
@ -97,11 +109,25 @@ export class TemplateLayerBoard extends TemplateBoardRecord
this._option.calcLeftShrink = this._option.leftShrink.toString();
this._option.calcRightShrink = this._option.rightShrink.toString();
}
if (ver > 3)
{
this.grooveOption.grooveAddLength = file.Read();
this.grooveOption.grooveAddWidth = file.Read();
this.grooveOption.grooveAddDepth = file.Read();
this.grooveOption.knifeRadius = file.Read();
}
else
{
this.grooveOption.grooveAddLength = this.grooveOption.grooveAddLength.toString();
this.grooveOption.grooveAddWidth = this.grooveOption.grooveAddWidth.toString();
this.grooveOption.grooveAddDepth = this.grooveOption.grooveAddDepth.toString();
this.grooveOption.knifeRadius = this.grooveOption.knifeRadius.toString();
}
}
WriteFile(file: CADFiler)
{
file.Write(3);
file.Write(4);
super.WriteFile(file);
file.Write(this._option.type);
file.Write(this._option.name);
@ -134,5 +160,10 @@ export class TemplateLayerBoard extends TemplateBoardRecord
file.Write(this._option.calcLeftShrink);
file.Write(this._option.calcRightShrink);
//ver4
file.Write(this.grooveOption.grooveAddLength);
file.Write(this.grooveOption.grooveAddWidth);
file.Write(this.grooveOption.grooveAddDepth);
file.Write(this.grooveOption.knifeRadius);
}
}

@ -1,10 +1,10 @@
import { BuildVerticalBoards } from "../../../Add-on/DrawBoard/BuildBoardTool";
import { DefaultVerticalBoardConfig } from "../../../Editor/DefaultConfig";
import { ISpaceParse } from "../../../Geometry/SpaceParse/ISpaceParse";
import { VerticalBoardOption } from "../../../UI/Store/BoardInterface";
import { IGrooveOption, VerticalBoardOption } from "../../../UI/Store/BoardInterface";
import { Factory } from "../../CADFactory";
import { TemplateBoardRecord } from "./TemplateBoard";
import { DefaultVerticalBoardConfig } from "../../../Editor/DefaultConfig";
import { CADFiler } from "../../CADFiler";
import { TemplateBoardRecord } from "./TemplateBoard";
/**
*
@ -18,9 +18,20 @@ export class TemplateVerticalBoard extends TemplateBoardRecord
this.name = "立板(自动)";
}
protected _option: VerticalBoardOption = { ...DefaultVerticalBoardConfig };
private grooveOption: IGrooveOption = {
grooveAddLength: "0",
grooveAddWidth: "0",
grooveAddDepth: "0",
knifeRadius: "3",
};
set GrooveOption(option: IGrooveOption)
{
this.WriteAllObjectRecord();
Object.assign(this.grooveOption, option);
}
GeneralBoardList(space: ISpaceParse)
{
return BuildVerticalBoards(this._option, space);
return BuildVerticalBoards(this._option, space, this.grooveOption);
}
ReadFile(file: CADFiler)
{
@ -51,11 +62,24 @@ export class TemplateVerticalBoard extends TemplateBoardRecord
this._option.calcFrontShrink = this._option.frontShrink.toString();
this._option.calcBottomShrink = this._option.bottomShrink.toString();
}
if (ver > 2)
{
this.grooveOption.grooveAddLength = file.Read();
this.grooveOption.grooveAddWidth = file.Read();
this.grooveOption.grooveAddDepth = file.Read();
this.grooveOption.knifeRadius = file.Read();
}
else
{
this.grooveOption.grooveAddLength = this.grooveOption.grooveAddLength.toString();
this.grooveOption.grooveAddWidth = this.grooveOption.grooveAddWidth.toString();
this.grooveOption.grooveAddDepth = this.grooveOption.grooveAddDepth.toString();
this.grooveOption.knifeRadius = this.grooveOption.knifeRadius.toString();
}
}
WriteFile(file: CADFiler)
{
file.Write(2);
file.Write(3);
super.WriteFile(file);
file.Write(this._option.type);
file.Write(this._option.name);
@ -73,5 +97,10 @@ export class TemplateVerticalBoard extends TemplateBoardRecord
file.Write(this._option.calcSpaceSize);
file.Write(this._option.calcFrontShrink);
file.Write(this._option.calcBottomShrink);
file.Write(this.grooveOption.grooveAddLength);
file.Write(this.grooveOption.grooveAddWidth);
file.Write(this.grooveOption.grooveAddDepth);
file.Write(this.grooveOption.knifeRadius);
}
}

@ -12,7 +12,7 @@ import { ELatticeArrayType, ILatticeOption } from "../UI/Store/LatticeInterface"
import { EFullDir, EFullType, EWineRackType, EWRackArrayType, IWineRackOption } from "../UI/Store/WineRackInterface";
export const DefaultLayerBoardConfig: LayerBoardOption = {
version: 2,
version: 3,
type: BoardType.Layer,
name: "层板",
frontShrink: 0,
@ -33,7 +33,7 @@ export const DefaultLayerBoardConfig: LayerBoardOption = {
Object.freeze(DefaultLayerBoardConfig);
export const DefaultVerticalBoardConfig: VerticalBoardOption = {
version: 2,
version: 3,
type: BoardType.Vertical,
name: "立板",
frontShrink: 0,

@ -2,17 +2,17 @@ import { Button, Checkbox, Classes, HTMLSelect, Intent, Radio, RadioGroup } from
import { observer } from 'mobx-react';
import * as React from 'react';
import { app } from '../../../ApplicationServices/Application';
import { EBoardKeyList } from '../../../Common/BoardKeyList';
import { CheckObjectType } from '../../../Common/CheckoutVaildValue';
import { safeEval } from '../../../Common/eval';
import { GetEntity } from '../../../Common/Utils';
import { Board } from '../../../DatabaseServices/Entity/Board';
import { BoardConfigOption, IBaseOption, BoardProcessOption, BrRelativePos, TBBoardOption, DrillType, IHightDrillOption, BoardType, AnyObject, IUiOption, IDrawBoardAutoCutOption } from '../../Store/BoardInterface';
import { TempEditor } from '../../../Editor/TempEditor';
import { userConfig } from '../../../Editor/UserConfig';
import { AnyObject, BoardConfigOption, BoardProcessOption, BoardType, BrRelativePos, DrillType, IBaseOption, IDrawBoardAutoCutOption, IHightDrillOption, IUiOption, TBBoardOption } from '../../Store/BoardInterface';
import { RightPanelStore } from '../../Store/RightPanelStore/RightPanelStore';
import { RightTabId } from '../RightPanel/RightPanel';
import { AppToaster, ToasterInput } from '../Toaster';
import { GetEntity } from '../../../Common/Utils';
import { safeEval } from '../../../Common/eval';
import { EBoardKeyList } from '../../../Common/BoardKeyList';
import { TempEditor } from '../../../Editor/TempEditor';
import { userConfig } from '../../../Editor/UserConfig';
export interface ISetItemOption
{

@ -1,10 +1,10 @@
import { Checkbox, Classes } from '@blueprintjs/core';
import { observer } from 'mobx-react';
import * as React from 'react';
import { CheckObjectType } from '../../../Common/CheckoutVaildValue';
import { BrRelativePos } from '../../Store/BoardInterface';
import { LayerBoardStore } from '../../Store/BoardStore';
import { BoardRePosBlock, ItemName, SetBoardDataBlock, SetBoardDataItem } from './BoardCommon';
import { CheckObjectType } from '../../../Common/CheckoutVaildValue';
export const LayerBoardModal =
(observer((props: { store?: LayerBoardStore; }) =>
@ -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", "槽加深"]];
let brOpt = props.store.m_Option;
let uiOption = props.store.UIOption;
@ -24,6 +24,15 @@ export const LayerBoardModal =
!props.store.EditorTemplate &&
<ItemName title="板名称" opt={brOpt} className="br-name" />
}
<div className="process-data">
<h6 className={Classes.HEADING}></h6>
<SetBoardDataBlock
type={CheckObjectType.BR}
pars={m_ScaleParameter}
option={props.store.grooveOption}
className="flexWrap"
/>
</div>
<div>
<h6 className={Classes.HEADING}></h6>
<div>

@ -1,16 +1,17 @@
import { Checkbox, Classes } from '@blueprintjs/core';
import { observer } from 'mobx-react';
import * as React from 'react';
import { CheckObjectType } from '../../../Common/CheckoutVaildValue';
import { BrRelativePos } from '../../Store/BoardInterface';
import { VerticalBoardStore } from '../../Store/BoardStore';
import { BoardRePosBlock, ItemName, SetBoardDataItem } from './BoardCommon';
import { CheckObjectType } from '../../../Common/CheckoutVaildValue';
import { BoardRePosBlock, ItemName, SetBoardDataBlock, SetBoardDataItem } from './BoardCommon';
export const VerticalBoardModal =
(observer((props: { store?: VerticalBoardStore; }) =>
{
const store = props.store;
const scalePars = [["calcFrontShrink", "前缩"], ["calcBottomShrink", "位高"], ["calcWidth", "板深"], ["calcHeight", "板高"]];
const m_ScaleParameter = [["knifeRadius", "刀半径"], ["grooveAddLength", "槽加长"], ["grooveAddWidth", "槽加宽"], ["grooveAddDepth", "槽加深"]];
const brOpt = store.m_Option;
const uiOption = props.store.UIOption;
@ -63,6 +64,15 @@ export const VerticalBoardModal =
option={brOpt}
posPars={[[BrRelativePos.Left, "靠左"], [BrRelativePos.Right, "靠右"]]}
/>
<div className="process-data">
<h6 className={Classes.HEADING}></h6>
<SetBoardDataBlock
type={CheckObjectType.BR}
pars={m_ScaleParameter}
option={props.store.grooveOption}
className="flexWrap"
/>
</div>
</>
);
}));

@ -488,6 +488,12 @@ 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 layerNailOption: LayerNailOption = Object.assign({}, DefaultNailOption);
uiLayerNailOption: IUiOption<LayerNailOption>;
constructor()
@ -513,6 +519,13 @@ export class LayerBoardStore extends BoardStore<LayerBoardOption>
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()
{
@ -527,6 +540,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.processData.drillType = DrillType.None;
config.processData.highDrill = Array(4).fill(DrillType.None);
configs["活动层板"] = config;
@ -537,6 +554,7 @@ export class LayerBoardStore extends BoardStore<LayerBoardOption>
{
let newConfig = super.SaveConfig();
newConfig.nailData = toJS(this.layerNailOption);
newConfig.grooveData = toJS(this.grooveOption);
return newConfig;
}
UpdateOption(cof: IConfigOption<LayerBoardOption>)
@ -549,7 +567,7 @@ export class LayerBoardStore extends BoardStore<LayerBoardOption>
cof.option.calcHeight = "W";
}
}
else if (cof.option.version < 2)
if (cof.option.version < 2)
{
cof.option.calcSpaceSize = cof.option.spaceSize.toString();
cof.option.calcLeftShrink = cof.option.leftShrink.toString();
@ -557,16 +575,34 @@ export class LayerBoardStore extends BoardStore<LayerBoardOption>
cof.option.calcFrontShrink = cof.option.frontShrink.toString();
cof.option.version = 2;
}
super.UpdateOption(cof);
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);
if (this.uiLayerNailOption)
Object.assign(this.uiLayerNailOption, DataAdapter.ConvertUIData(this.layerNailOption));
if (!cof.grooveData)
{
cof.grooveData = this.grooveOption;
let newConfig = super.SaveConfig();
newConfig.grooveData = toJS(this.grooveOption);
}
else
Object.assign(this.grooveOption, cof.grooveData);
if (this.uiLayerNailOption)
Object.assign(this.uiLayerNailOption, DataAdapter.ConvertUIData(this.layerNailOption));
super.UpdateOption(cof);
}
HasInvailValue()
{
@ -579,9 +615,29 @@ 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",
};
SaveConfig()
{
let newConfig = super.SaveConfig();
newConfig.grooveData = toJS(this.grooveOption);
return newConfig;
}
InitOption()
{
Object.assign(this.m_Option, DefaultVerticalBoardConfig);
let grooveOption: IGrooveOption = {
grooveAddLength: "0",
grooveAddWidth: "0",
grooveAddDepth: "0",
knifeRadius: "3",
};
Object.assign(this.grooveOption, grooveOption);
super.InitOption();
}
UpdateOption(cof: IConfigOption<VerticalBoardOption>)
@ -593,6 +649,26 @@ export class VerticalBoardStore extends BoardStore<VerticalBoardOption>
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.grooveData = this.grooveOption;
let newConfig = super.SaveConfig();
newConfig.grooveData = toJS(this.grooveOption);
}
else
Object.assign(this.grooveOption, cof.grooveData);
super.UpdateOption(cof);
}
}

Loading…
Cancel
Save