!2721 新增:圆弧板圆弧槽通用默认配置

pull/2728/MERGE
黄诗津 5 months ago committed by ChenX
parent f4c0c2a74c
commit 9de55c8344

@ -17,7 +17,7 @@ export interface ArcBoardOptions
grooveWidth: number;
retainedThickness: number;
knifeRadius: number;
grooveAddLengt: number;
grooveAddLength: number;
grooveAddWidth: number;
grooveAddDepth: number;
arcExtension: number;
@ -30,7 +30,7 @@ export const defultArcBoardOption: ArcBoardOptions = {
grooveWidth: 6,
retainedThickness: 2,
knifeRadius: 3,
grooveAddLengt: 0,
grooveAddLength: 0,
grooveAddWidth: 0,
grooveAddDepth: 0,
arcExtension: 0,
@ -122,7 +122,7 @@ export function ParseBoardArcFeed(br: Board, path: Polyline, angle: number, dir:
thickness: br.Thickness - arcBoardOption.retainedThickness,
dir: dir === 0 ? FaceDirection.Back : FaceDirection.Front,
knifeRadius: arcBoardOption.knifeRadius,
addLen: arcBoardOption.grooveAddLengt,
addLen: arcBoardOption.grooveAddLength,
addWidth: arcBoardOption.grooveAddWidth,
addDepth: arcBoardOption.grooveAddDepth,
});

@ -0,0 +1,107 @@
import { Button, Checkbox, Classes } from "@blueprintjs/core";
import { observer } from "mobx-react";
import React from "react";
import { CheckObjectType } from "../../../Common/CheckoutVaildValue";
import { SetBoardDataItem } from "../../../UI/Components/Board/BoardCommon";
import { BoardModalType } from "../../../UI/Components/Board/BoardModalType";
import { Config_ModalType } from "../../../UI/Components/Board/UserConfigComponent";
import { CommonModal } from "../../../UI/Components/Modal/ModalContainer";
import { ModalState } from "../../../UI/Components/Modal/ModalInterface";
import { ArcBoardGrooveStore } from "./ArcBoardGrooveStore";
@observer
export class ArcBoardGroove extends React.Component<{ store: ArcBoardGrooveStore, type: BoardModalType; }, {}>
{
curveBoardPars = [
["retainedThickness", "留底厚度"],
["knifeRadius", "刀半径"],
["grooveAddLength", "槽加长"],
["grooveAddWidth", "槽加宽"],
["grooveAddDepth", "槽加深"],
];
render()
{
const { store, type } = this.props;
return (
<CommonModal
title={store.title}
icon="bold"
modalId="arcBoardGeoove"
close={async () => store.OnOk(ModalState.Cancel)}
configType={Config_ModalType.ConfigListModal}
store={store}
type={type}
footerChildren={
<>
<Button
className={Classes.INTENT_SUCCESS}
text="确定"
onClick={() =>
{
store.OnOk(ModalState.Ok, true, { isOk: true });
}} />
<Button
className={Classes.INTENT_DANGER}
text="取消"
onClick={() =>
{
store.OnOk(ModalState.Cancel);
}} />
</>
}
>
<div
className={Classes.DIALOG_BODY}
style={{ padding: 10 }}
>
<div>
<Checkbox
style={{ marginRight: 7, width: 70 }}
checked={!store.m_Option.isDrawArcGroove}
label="不开槽"
onChange={() =>
{
store.m_Option.isDrawArcGroove = !store.m_Option.isDrawArcGroove;
}}
/>
</div>
<div
style={{
display: "flex",
maxWidth: 1000,
overflow: "scroll"
}}>
{
<div style={{ marginRight: 3 }}>
<span>{"通用转角槽配置"}</span>
<div
className="curveBoardOption"
style={{
padding: 5,
border: "1px solid #ccc",
width: 160
}}>
{
this.curveBoardPars.map(([optKey, title], index) =>
{
return (
<SetBoardDataItem
key={optKey}
type={CheckObjectType.BR}
titleStyle={{ width: 60 }}
option={store.m_Option}
optKey={optKey}
title={title}
/>);
})
}
</div>
</div>
}
</div>
</div>
</CommonModal>
);
}
}

@ -0,0 +1,28 @@
import { observable, toJS } from "mobx";
import { DefaultArcBoardGrooveOption } from "../../../Editor/DefaultConfig";
import { IConfigOption } from "../../../UI/Components/Board/UserConfigComponent";
import { BoardStore } from "../../../UI/Store/BoardStore";
import { IArcBoardGrooveOption } from "../../../UI/Store/OptionInterface/IOptionInterface";
export class ArcBoardGrooveStore extends BoardStore<IArcBoardGrooveOption>
{
title = "圆弧板通用配置";
@observable m_Option: IArcBoardGrooveOption = { ...DefaultArcBoardGrooveOption, };
InitOption()
{
Object.assign(this.m_Option, DefaultArcBoardGrooveOption);
}
UpdateOption(cof: IConfigOption<IArcBoardGrooveOption>): void
{
Object.assign(this.m_Option, cof.option);
}
SaveConfig()
{
let newConfig: IConfigOption = {};
newConfig.option = toJS(this.m_Option);
return newConfig;
}
}

@ -3,10 +3,12 @@ import { app } from "../../ApplicationServices/Application";
import { GetPointAtCurveDir } from "../../Common/CurveUtils";
import { Draw } from "../../Common/Draw";
import { FixedNotZero } from "../../Common/Utils";
import { safeEval } from "../../Common/eval";
import { Board } from "../../DatabaseServices/Entity/Board";
import { Line } from "../../DatabaseServices/Entity/Line";
import { Polyline } from "../../DatabaseServices/Entity/Polyline";
import { Command } from "../../Editor/CommandMachine";
import { DefaultArcBoardGrooveOption } from "../../Editor/DefaultConfig";
import { JigUtils } from "../../Editor/JigUtils";
import { PromptStatus } from "../../Editor/PromptResult";
import { UCSUtils } from "../../Editor/UCSRAII";
@ -14,16 +16,38 @@ import { ZAxis, ZeroVec, equaln, equalv3, isPerpendicularityTo } from "../../Geo
import { HotCMD } from "../../Hot/HotCommand";
import { BoardModal } from "../../UI/Components/Board/BoardModal";
import { BoardModalType } from "../../UI/Components/Board/BoardModalType";
import { IConfigOption } from "../../UI/Components/Board/UserConfigComponent";
import { ModalState } from "../../UI/Components/Modal/ModalInterface";
import { IArcBoardGrooveOption } from "../../UI/Store/OptionInterface/IOptionInterface";
import { userConfigStore } from "../../UI/Store/UserConfigStore";
import { FaceDirection } from "../DrawDrilling/DrillType";
import { ArcBoardBuild } from "./ArcBoardBuild";
import { ArcBoardGroove } from "./ArcBoardGeooveConfig/ArcBoardGroove";
import { ArcBoardGrooveStore } from "./ArcBoardGeooveConfig/ArcBoardGrooveStore";
import { arcBoardStore } from "./ArcBoardStore";
let arcBoardGrooveOption: IArcBoardGrooveOption = { ...DefaultArcBoardGrooveOption };
@HotCMD
export class Command_DrawArcBoard implements Command
{
arcBoardGrooveStore: ArcBoardGrooveStore = ArcBoardGrooveStore.GetInstance();
constructor()
{
this.InitGrooveOption();
}
async InitGrooveOption()
{
let config = await userConfigStore.GetConfig(BoardModalType.ArcBoardGrooves) as IConfigOption<IArcBoardGrooveOption>;
if (config)
{
this.arcBoardGrooveStore.UpdateOption(config);
arcBoardGrooveOption = config.option;
}
}
async exec()
{
arcBoardGrooveOption = { ...this.arcBoardGrooveStore.m_Option };
// 1.选择要放样的路径
const pathRes = await app.Editor.GetEntity({ Msg: "选择要放样的路径:", Filter: { filterTypes: [Polyline] } });
if (pathRes.Status !== PromptStatus.OK) return;
@ -108,87 +132,111 @@ export async function DrawArcBoard(params: { odir: number; fdir: number; }, path
{
const { odir, fdir } = params;
//4.选择要弯曲的板 或者创建个板
const brRes = await app.Editor.GetSelection({
Msg: "选择要弯曲的板:",
Filter: {
filterTypes: [Board],
},
KeyWordList: [
{
key: "C",
msg: "创建板"
}
]
});
while (true)
{
//4.选择要弯曲的板 或者创建个板
const brRes = await app.Editor.GetSelection({
Msg: "选择要弯曲的板:",
Filter: {
filterTypes: [Board],
},
KeyWordList: [
{
key: "C",
msg: "创建板"
},
{
key: "S",
msg: "配置"
}
]
});
if (!(brRes.Status === PromptStatus.OK || brRes.Status === PromptStatus.Keyword)) return;
if (!(brRes.Status === PromptStatus.OK || brRes.Status === PromptStatus.Keyword)) return;
if (brRes.Status === PromptStatus.Keyword)
{
const store = arcBoardStore;
store.m_Option.width = path1.Length;
store.UpdateUIOption();
app.Editor.ModalManage.RenderModal(BoardModal, { store, type: BoardModalType.ArcBr });
const res = await app.Editor.ModalManage.Wait();
if (res.Status === ModalState.Cancel) return;
if (brRes.Status === PromptStatus.Keyword)
{
if (brRes.StringResult === "C")
{
const store = arcBoardStore;
store.m_Option.width = path1.Length;
store.UpdateUIOption();
app.Editor.ModalManage.RenderModal(BoardModal, { store, type: BoardModalType.ArcBr });
const res = await app.Editor.ModalManage.Wait();
if (res.Status === ModalState.Cancel) continue;
const { name, type, height, thickness } = store.m_Option;
const { name, type, height, thickness } = store.m_Option;
let path2 = path1.GetOffsetCurves(thickness * odir)[0];
let backPath: Polyline;//背面路径
let brWidth: number;
let path2 = path1.GetOffsetCurves(thickness * odir)[0];
let backPath: Polyline;//背面路径
let brWidth: number;
//如果见光面方向等于偏移方向 则使用path1 作为背面路径
if (fdir === odir)
{
backPath = path1;
if (odir < 0)
backPath.Reverse();
//如果见光面方向等于偏移方向 则使用path1 作为背面路径
if (fdir === odir)
{
backPath = path1;
if (odir < 0)
backPath.Reverse();
brWidth = Number.parseFloat(FixedNotZero(path2.Length, 5));
}
else//反之
{
backPath = path2;
if (odir > 0)
backPath.Reverse();
brWidth = Number.parseFloat(FixedNotZero(path2.Length, 5));
}
else//反之
{
backPath = path2;
if (odir > 0)
backPath.Reverse();
brWidth = Number.parseFloat(FixedNotZero(path1.Length, 5));
}
brWidth = Number.parseFloat(FixedNotZero(path1.Length, 5));
}
//针对此path构件一个板
let br = new Board().InitBoard(height, brWidth, thickness, type);
br.Name = name;
br.BoardProcessOption = store.BoardProcessOption;
//针对此path构件一个板
let br = new Board().InitBoard(height, brWidth, thickness, type);
br.Name = name;
br.BoardProcessOption = store.BoardProcessOption;
if (brWidth != store.m_Option.width)
{
br.FixArcSweepPathLength();
}
if (brWidth != store.m_Option.width)
{
br.FixArcSweepPathLength();
}
let x = backPath.EndPoint.sub(backPath.StartPoint).normalize();
if (equalv3(x, ZeroVec))
x = new Vector3(1, 0, 0);
let y = backPath.Normal;
let z = new Vector3().crossVectors(x, y);
let x = backPath.EndPoint.sub(backPath.StartPoint).normalize();
if (equalv3(x, ZeroVec))
x = new Vector3(1, 0, 0);
let y = backPath.Normal;
let z = new Vector3().crossVectors(x, y);
br.ApplyMatrix(new Matrix4().makeBasis(x, y, z).setPosition(backPath.StartPoint));
br.SweepVisibleFace = FaceDirection.Front;
br.ApplyMatrix(new Matrix4().makeBasis(x, y, z).setPosition(backPath.StartPoint));
br.SweepVisibleFace = FaceDirection.Front;
let path = backPath.Clone();
let [angle, isRev] = Path2BoardPath(br, path);
if (isRev)
let path = backPath.Clone();
let [angle, isRev] = Path2BoardPath(br, path);
if (isRev)
{
console.error("未预料到的错误 我们已经根据起点和终点构建了 没想到还是出错了!!!!");
}
br.SetSweepPath(path, angle);
UpdataDefultArcBoardOption(br, arcBoardGrooveOption);
Draw(br);
break;
}
else if (brRes.StringResult === "S")
{
let arcBoardGrooveStore = ArcBoardGrooveStore.GetInstance();
app.Editor.ModalManage.RenderModal(ArcBoardGroove, { store: arcBoardGrooveStore, type: BoardModalType.ArcBoardGrooves });
let res = await app.Editor.ModalManage.Wait();
if (res.Status === ModalState.Ok)
{
arcBoardGrooveOption = arcBoardGrooveStore.m_Option;
}
}
}
else
{
console.error("未预料到的错误 我们已经根据起点和终点构建了 没想到还是出错了!!!!");
const brs = brRes.SelectSet.SelectEntityList as Board[];
await ApplyArcBoardByPathInfo(brs, odir, fdir, path1);
break;
}
br.SetSweepPath(path, angle);
Draw(br);
}
else
{
const brs = brRes.SelectSet.SelectEntityList as Board[];
await ApplyArcBoardByPathInfo(brs, odir, fdir, path1);
}
}
@ -277,6 +325,7 @@ export async function ApplyArcBoardByPathInfo(brs: Board[], odir: number, fdir:
}
br.SetSweepPath(path, angle);
UpdataDefultArcBoardOption(br, arcBoardGrooveOption);
let length = br.ArcBuild.SweepLength;
let brLength = br.ParseBoardLengthInArcSweep();
@ -285,6 +334,7 @@ export async function ApplyArcBoardByPathInfo(brs: Board[], odir: number, fdir:
br.FixContourByArcSweepPath();
else
br.FixArcSweepPathLength();
br.UpdateArcBoardOptions(true);
}
}
@ -390,3 +440,14 @@ export function Path2BoardPath(br: Board, path: Polyline): [number, boolean]
return [0, isReverse];
}
}
async function UpdataDefultArcBoardOption(br: Board, option: IArcBoardGrooveOption)
{
let defaultOption = br.ArcBoardOptions.get(-1);
defaultOption.retainedThickness = safeEval(option.retainedThickness);
defaultOption.knifeRadius = safeEval(option.knifeRadius);
defaultOption.grooveAddLength = safeEval(option.grooveAddLength);
defaultOption.grooveAddWidth = safeEval(option.grooveAddWidth);
defaultOption.grooveAddDepth = safeEval(option.grooveAddDepth);
br.IsDrawArcGroove = option.isDrawArcGroove;
}

@ -201,26 +201,36 @@ export class Board extends ExtrudeSolid
{
this.WriteAllObjectRecord();
this._ArcBoardOptions = opt;
this.UpdateArcBoardOptions();
this.UpdateArcBoardOptions(false);
this.Update();
}
UpdateArcBoardOptions(): void
UpdateArcBoardOptions(isNewPath: boolean): void
{
//更新ArcBuild曲线数据
this._SweepArcBoardBuild = new ArcBoardBuild(this).ParseSweepCurves();
let cus = this.GetSweepPathInWCS().Explode();
if (cus.filter(cu => cu instanceof Arc).length <= this._ArcBoardOptions.size - 1)
let newOpts = new Map<number, ArcBoardOptions>();
newOpts.set(-1, this._ArcBoardOptions.get(-1));
//如果是新的多段线信息,就更新全部数据
if (isNewPath)
{
cus.forEach((cu, i) =>
{
if (cu instanceof Arc)
newOpts.set(i, { ...defultArcBoardOption, arcLength: parseFloat(FixedNotZero(cu.Length, 5)) });
});
}
else if (cus.filter(cu => cu instanceof Arc).length <= this._ArcBoardOptions.size - 1)
{
let newOpts = new Map<number, ArcBoardOptions>();
newOpts.set(-1, this._ArcBoardOptions.get(-1));
cus.forEach((cu, i) =>
{
if (cu instanceof Arc && this._ArcBoardOptions.has(i))
newOpts.set(i, { ...this._ArcBoardOptions.get(i), arcLength: parseFloat(FixedNotZero(cu.Length, 5)) });
});
this._ArcBoardOptions = newOpts;
}
this._ArcBoardOptions = newOpts;
}
get IsArcBoard()
@ -237,7 +247,6 @@ export class Board extends ExtrudeSolid
SetSweepPath(path: Polyline, sweepAngle: number)
{
this.WriteAllObjectRecord();
this._ArcBoardOptions.clear();
this._SweepPath = path;
this._SweepAngle = sweepAngle;
this.Update();
@ -325,7 +334,6 @@ export class Board extends ExtrudeSolid
this._SweepPath = ArcBoardBuild.OffsetPolyline(path, this.thickness);
}
}
this.UpdateArcBoardOptions();
}
ParseBoardLengthInArcSweep(): number
@ -2950,7 +2958,7 @@ export class Board extends ExtrudeSolid
grooveWidth: file.Read(),
retainedThickness: file.Read(),
grooveAddDepth: file.Read(),
grooveAddLengt: file.Read(),
grooveAddLength: file.Read(),
grooveAddWidth: file.Read(),
knifeRadius: file.Read(),
arcExtension: 0,
@ -3054,7 +3062,7 @@ export class Board extends ExtrudeSolid
file.Write(v.grooveWidth);
file.Write(v.retainedThickness);
file.Write(v.grooveAddDepth);
file.Write(v.grooveAddLengt);
file.Write(v.grooveAddLength);
file.Write(v.grooveAddWidth);
file.Write(v.knifeRadius);
file.Write(v.arcExtension);

@ -108,6 +108,7 @@ export class TemplateFilletAction extends TemplateAction
{
br.SetSweepPath(faker.path, br.SweepAngle);
br.FixContourByArcSweepPath();
br.UpdateArcBoardOptions(false);
}
}

@ -16,7 +16,7 @@ import { CurtailType, IBoardBatchCurtailOption } from "../UI/Store/OptionInterfa
import { BoardProcessOption } from "../UI/Store/OptionInterface/BoardProcessOption";
import { BulkheadCeilingOption } from "../UI/Store/OptionInterface/BulkheadCeilingOption";
import { ClosingStripOption, StripType } from "../UI/Store/OptionInterface/ClosingStripOption";
import { BehindBoardOption, BoardConfigOption, ChangeColorByBoardMaterialOption, ChangeColorByRoomOrCabinetOption, CommonPanelConfigOption, DatalistConfigOption, DoorRelatesInfoOption, IBatchModifyPanelOption, IDimStyleOption, LayerBoardOption, LayerNailOption, ModifyTextsConfigOption, OneClickInspectionOption, RightPlaneLightOption, ShareBoardInfConfigurationOption, SideBoardOption, SingleBoardOption, TBBoardOption, VerticalBoardOption, WindowPanelConfigOption } from "../UI/Store/OptionInterface/IOptionInterface";
import { BehindBoardOption, BoardConfigOption, ChangeColorByBoardMaterialOption, ChangeColorByRoomOrCabinetOption, CommonPanelConfigOption, DatalistConfigOption, DoorRelatesInfoOption, IArcBoardGrooveOption, IBatchModifyPanelOption, IDimStyleOption, LayerBoardOption, LayerNailOption, ModifyTextsConfigOption, OneClickInspectionOption, RightPlaneLightOption, ShareBoardInfConfigurationOption, SideBoardOption, SingleBoardOption, TBBoardOption, VerticalBoardOption, WindowPanelConfigOption } from "../UI/Store/OptionInterface/IOptionInterface";
import { PointLightOption, RectAreaLightOption, SpotLightOption } from "../UI/Store/OptionInterface/LightConfigOption";
import { BehindHeightPositon, RadioType, ViewDirection, ViewportPosition } from "../UI/Store/OptionInterface/OptionEnum";
import { Viewport2ConfigOption, Viewport3ConfigOption, Viewport4ConfigOption, ViewportConfigOption } from "../UI/Store/OptionInterface/ViewportConfigOption";
@ -1076,3 +1076,14 @@ export const DefaultOneClickInspectionOption: OneClickInspectionOption = {
}
};
Object.freeze(DefaultOneClickInspectionOption);
export const DefaultArcBoardGrooveOption: IArcBoardGrooveOption = {
version: 1,
isDrawArcGroove: true,
retainedThickness: "2",
knifeRadius: "3",
grooveAddLength: "0",
grooveAddWidth: "0",
grooveAddDepth: "0",
};
Object.freeze(DefaultArcBoardGrooveOption);

@ -27,7 +27,7 @@ export const ArcBoardOption = (observer(({ showCurveBoardOpt, arcBoardOptions, a
["arcExtension", "圆弧头尾延长"],
["retainedThickness", "留底厚度"],
["knifeRadius", "刀半径"],
["grooveAddLengt", "槽加长"],
["grooveAddLength", "槽加长"],
["grooveAddWidth", "槽加宽"],
["grooveAddDepth", "槽加深"],
];
@ -112,6 +112,7 @@ export const ArcBoardOption = (observer(({ showCurveBoardOpt, arcBoardOptions, a
let display = (i === 0 && index <= 2);
return (
<SetBoardDataItem
key={optKey}
type={CheckObjectType.BR}
isDisabled={display}
option={opt}

@ -59,6 +59,7 @@ export enum BoardModalType
BulkheadCeilingContour = "BulkheadCeilingContour",//吊顶轮廓
HeadCeilingProfileMaterial = "HeadCeilingProfileMaterial",//吊顶截面材质
OneClickInspection = "OneClickInspection",//一键检查
ArcBoardGrooves = "ArcBoardGrooves",//圆弧板槽配置
//独立配置,只存在一个的配置
AutoHoleFaceSetting = "AutoHoleFaceSetting",

@ -365,3 +365,13 @@ export interface OneClickInspectionOption extends IBaseOption
isDrawHole: boolean,
};
}
export interface IArcBoardGrooveOption extends IBaseOption
{
isDrawArcGroove: boolean;
retainedThickness: string;
grooveAddLength: string;
grooveAddWidth: string;
grooveAddDepth: string;
knifeRadius: string;
}

Loading…
Cancel
Save