!1339 优化:r2b 加入地脚后,是否关联切割参数

pull/1339/MERGE
ZoeLeeFZ 4 years ago committed by ChenX
parent 557538bcf3
commit 91880c48fb

@ -6,9 +6,8 @@ import { Board } from "../../DatabaseServices/Entity/Board";
import { ExtrudeSolid } from "../../DatabaseServices/Entity/Extrude"; import { ExtrudeSolid } from "../../DatabaseServices/Entity/Extrude";
import { HardwareCompositeEntity } from "../../DatabaseServices/Hardware/HardwareCompositeEntity"; import { HardwareCompositeEntity } from "../../DatabaseServices/Hardware/HardwareCompositeEntity";
import { Box3Ext } from "../../Geometry/Box"; import { Box3Ext } from "../../Geometry/Box";
import { DownPanelStore } from "../../UI/Store/DownPanelStore";
export async function CuttingBoardByBoard(meats: Board[], knifs: Board[], isRelevance = true): Promise<void> export function CuttingBoardByBoard(meats: Board[], knifs: Board[], isRelevance = true)
{ {
// //进度条 // //进度条
// let down = DownPanelStore.GetInstance() as DownPanelStore; // let down = DownPanelStore.GetInstance() as DownPanelStore;

@ -24,6 +24,7 @@ import { BoardModalType } from "../../UI/Components/Board/BoardModal";
import { UpdateBoardInfos } from "../BoardEditor/UpdateBoardInfos"; import { UpdateBoardInfos } from "../BoardEditor/UpdateBoardInfos";
import { FixDigits } from "../../Common/Utils"; import { FixDigits } from "../../Common/Utils";
import { GetRectData } from "../../Common/CurveUtils"; import { GetRectData } from "../../Common/CurveUtils";
import { CuttingBoardByBoard } from "../BoardCutting/CuttingUtils2";
const MaxBoardDistance = 200;//左右侧板,顶底板距离边缘的最大距离 const MaxBoardDistance = 200;//左右侧板,顶底板距离边缘的最大距离
@ -98,6 +99,8 @@ export class Polyline2Board implements Command
//板名设置属性配置 //板名设置属性配置
maxThickness: number = 20; maxThickness: number = 20;
backBrName = "背板"; backBrName = "背板";
behindIsRelative = false;
footThickness: number;
InitData(store: Rec2BrStore) InitData(store: Rec2BrStore)
{ {
let option = store.m_Option; let option = store.m_Option;
@ -123,6 +126,8 @@ export class Polyline2Board implements Command
this.grooveWidth = safeEval(option.grooveOption.grooveAddWidth); this.grooveWidth = safeEval(option.grooveOption.grooveAddWidth);
this.maxThickness = option.maxThickness; this.maxThickness = option.maxThickness;
this.backBrName = option.backBrName; this.backBrName = option.backBrName;
this.behindIsRelative = option.behindIsRelative;
this.footThickness = option.footerThickness;
} }
//绘制 传入曲线id表 //绘制 传入曲线id表
async Doit(pls: Polyline[]) async Doit(pls: Polyline[])
@ -472,12 +477,12 @@ export class Polyline2Board implements Command
//修改板名和前缩 //修改板名和前缩
for (let br of leftBoards) for (let br of leftBoards)
{ {
br.ColorIndex = 15; br.ColorIndex = 11;
br.Name = storeOption.farLeftVerticalBrName; br.Name = storeOption.farLeftVerticalBrName;
} }
for (let br of rightBoards) for (let br of rightBoards)
{ {
br.ColorIndex = 12; br.ColorIndex = 11;
br.Name = storeOption.farRightVerticalBrName; br.Name = storeOption.farRightVerticalBrName;
} }
@ -502,17 +507,17 @@ export class Polyline2Board implements Command
br.ColorIndex = 8; br.ColorIndex = 8;
} }
const FixdjsktThickness = (br: Board) => const FixdjsktThickness = (br: Board, thicknee?: number) =>
{ {
let oldPt = br.MinPoint; let oldPt = br.MinPoint;
br.Thickness = this.boardThick; br.Thickness = thicknee ?? this.boardThick;
let newPt = br.MinPoint; let newPt = br.MinPoint;
br.Position = br.Position.add(oldPt.sub(newPt)); br.Position = br.Position.add(oldPt.sub(newPt));
}; };
for (let br of djxs)//地脚 for (let br of djxs)//地脚
{ {
FixdjsktThickness(br); FixdjsktThickness(br, this.footThickness);
if (storeOption.isbottomMostBackBrName) if (storeOption.isbottomMostBackBrName)
br.Name = storeOption.bottomMostBackBrName; br.Name = storeOption.bottomMostBackBrName;
@ -558,12 +563,19 @@ export class Polyline2Board implements Command
UpdateBoardInfos.ModifyBr(b, nameOption); UpdateBoardInfos.ModifyBr(b, nameOption);
} }
for (let br of layerVerBoards) if (this.behindIsRelative)
{ {
//柜体内缩 for (let br of layerVerBoards)
CurtailFunc(br, this.fontDis); CurtailFunc(br, this.fontDis);
br.Subtract(backBoards); CuttingBoardByBoard(layerVerBoards, backBoards);
} }
else
for (let br of layerVerBoards)
{
//柜体内缩
CurtailFunc(br, this.fontDis);
br.Subtract(backBoards);
}
} }
DrawBoard(pls: Polyline[], isBack = false, color?: number): Board[] DrawBoard(pls: Polyline[], isBack = false, color?: number): Board[]

@ -44,6 +44,7 @@ export class R2BProcessComponent extends React.Component<IR2BProcessComponentPro
<div className="flex br-mat"> <div className="flex br-mat">
<div> <div>
<SetBoardDataItem <SetBoardDataItem
titleStyle={{ width: "3.5rem" }}
type={CheckObjectType.R2B} type={CheckObjectType.R2B}
optKey="roomName" optKey="roomName"
option={store.m_Option} option={store.m_Option}

@ -67,6 +67,13 @@ export class R2BConfigComponent extends React.Component<IR2BConfigComponentProps
uiOption={store.UIOption} uiOption={store.UIOption}
title="最大板厚" title="最大板厚"
/> />
<SetBoardDataItem
type={CheckObjectType.R2B}
optKey="footerThickness"
option={store.m_Option}
uiOption={store.UIOption}
title="地脚厚度"
/>
</div> </div>
<H5></H5> <H5></H5>
<div className="flex" style={{ flexDirection: "column" }}> <div className="flex" style={{ flexDirection: "column" }}>
@ -98,6 +105,7 @@ export class R2BConfigComponent extends React.Component<IR2BConfigComponentProps
option={store.m_Option} option={store.m_Option}
uiOption={store.UIOption} uiOption={store.UIOption}
/> />
<Checkbox label="是否关联切割" checked={store.m_Option.behindIsRelative} onChange={() => store.m_Option.behindIsRelative = !store.m_Option.behindIsRelative} />
</div> </div>
<H5></H5> <H5></H5>
<div className="flex" style={{}}> <div className="flex" style={{}}>

@ -64,4 +64,6 @@ export interface IRec2BrOption extends IBaseOption
useBrName: boolean; //使用板件名配置 useBrName: boolean; //使用板件名配置
configName: string; configName: string;
backBrName: string;//背板名称 backBrName: string;//背板名称
behindIsRelative: boolean;
footerThickness: number;
} }

@ -26,7 +26,7 @@ export class Rec2BrStore extends BoardStore<IRec2BrOption>
} }
HasInvailValue() HasInvailValue()
{ {
return CheckoutValid.HasInvailValue(this.m_Option, CheckObjectType.R2B);// return CheckoutValid.HasInvailValue(this.UIOption, CheckObjectType.R2B);//
} }
SaveConfig() SaveConfig()
{ {
@ -59,6 +59,13 @@ export class Rec2BrStore extends BoardStore<IRec2BrOption>
cof.option.version = 2; cof.option.version = 2;
cof.option.backBrName = "背板"; cof.option.backBrName = "背板";
} }
if (cof.option.version < 3)
{
cof.option.version = 3;
cof.option.behindIsRelative = false;
cof.option.footerThickness = 18;
}
let grooveOption = cof.option.grooveOption; let grooveOption = cof.option.grooveOption;
delete cof.option.grooveOption; delete cof.option.grooveOption;
Object.assign(this.m_Option, cof.option); Object.assign(this.m_Option, cof.option);

@ -286,12 +286,18 @@ export namespace CheckoutValid
case "cabinetDeep": case "cabinetDeep":
case "cabinetBrThick": case "cabinetBrThick":
case "backBrThick": case "backBrThick":
case "maxThickness":
if (isNaN(val)) if (isNaN(val))
return "数值不能为空且必须为数字"; return "数值不能为空且必须为数字";
if (!(val >= 0)) if (!(val >= 0))
return "数值必须大于等于0"; return "数值必须大于等于0";
return ""; return "";
case "maxThickness":
case "footerThickness":
if (isNaN(val))
return "数值不能为空且必须为数字";
if (val <= 0)
return "数值必须大于0";
return "";
case "cabinetCurtail": case "cabinetCurtail":
case "backBrBiggerThanHeight": case "backBrBiggerThanHeight":
case "backBrBiggerThanWidth": case "backBrBiggerThanWidth":

@ -647,5 +647,7 @@ export const DefaultR2bOption: IRec2BrOption = {
useBrName: true, useBrName: true,
configName: "", configName: "",
backBrName: "背板", backBrName: "背板",
behindIsRelative: false,
footerThickness: 18,
}; };
Object.freeze(DefaultR2bOption); Object.freeze(DefaultR2bOption);

@ -35,6 +35,7 @@ export interface ISetItemOption
mounted?(); /**组件挂载完成触发 */ mounted?(); /**组件挂载完成触发 */
isUpper?: boolean; isUpper?: boolean;
tip?: string; tip?: string;
titleStyle?: React.CSSProperties;
} }
interface ISetBlockOption interface ISetBlockOption
{ {
@ -75,7 +76,7 @@ export class SetBoardDataItem extends React.Component<ISetItemOption, {}>
const props = this.props; const props = this.props;
return ( return (
<div title={this.props.tip ?? ""} className={props.className + " br-set " + (props.inline ? "inline" : "")}> <div title={this.props.tip ?? ""} className={props.className + " br-set " + (props.inline ? "inline" : "")}>
<span> <span style={props.titleStyle ?? {}}>
{props.title}: {props.title}:
</span> </span>
<ToasterInput <ToasterInput

Loading…
Cancel
Save