!1878 变更:还原绘制收口条面板UI赋值

pull/1880/MERGE
林三 2 years ago committed by ChenX
parent ed064f6fef
commit a1db9ef36e

@ -1,6 +1,9 @@
import { Intent } from '@blueprintjs/core';
import { reaction } from 'mobx';
import { Matrix4, Vector3 } from 'three';
import { end } from 'xaop';
import { app } from '../../ApplicationServices/Application';
import { EBoardKeyList } from '../../Common/BoardKeyList';
import { Board } from '../../DatabaseServices/Entity/Board';
import { Command } from '../../Editor/CommandMachine';
import { PromptStatus } from '../../Editor/PromptResult';
@ -19,11 +22,10 @@ const DEFAULT_STRIP_WIDTH = 80;
export class DrawClosingStrip implements Command
{
private store: ClosingStripStore;
async exec()
{
let useUcs = false;
//选择板交互
let useUcs = false;//使用UCS坐标系空间
let boards: Board[];
const UCSKeyword = { msg: "", key: "T" };
while (true)
@ -48,27 +50,53 @@ export class DrawClosingStrip implements Command
else return;
}
if (!boards || boards.length === 0) return;
if (boards.length > 0)
{
AppToaster.show({
message: "正在绘制收口条",
timeout: 0,
intent: Intent.PRIMARY,
});
this.store = ClosingStripStore.GetInstance();
app.Editor.ModalManage.RenderModeless(BoardModal, { store: this.store, type: BoardModalType.Skt }, { canMinimize: false });
//store初始化
let store = ClosingStripStore.GetInstance() as ClosingStripStore;
store.GetBoardProcessOption(boards[0]);//设置房名和柜名(这个是个神奇的特性 默认使用周围板的板名和柜名)
store.ChangeCabinetName();//修改柜名(柜名+收口条 有的用户不喜欢这个)
app.Editor.ModalManage.RenderModeless(BoardModal, { store: store, type: BoardModalType.Skt }, { canMinimize: false });
//用周围板件加工数据
const UseAroundBoardData = () =>
{
if (store.m_BoardProcessOption.useBoardProcessOption)
{
store.m_BoardProcessOption[EBoardKeyList.RoomName] = boards[0].BoardProcessOption[EBoardKeyList.RoomName];
store.m_BoardProcessOption[EBoardKeyList.CabinetName] = boards[0].BoardProcessOption[EBoardKeyList.CabinetName];
store.m_BoardProcessOption[EBoardKeyList.Mat] = boards[0].BoardProcessOption[EBoardKeyList.Mat];
store.m_BoardProcessOption[EBoardKeyList.BrMat] = boards[0].BoardProcessOption[EBoardKeyList.BrMat];
store.m_BoardProcessOption[EBoardKeyList.Color] = boards[0].BoardProcessOption[EBoardKeyList.Color];
store.ChangeCabinetName();//修改柜名
}
};
//点击复选框时(使用周围板数据)
let disposeReaction = reaction(() => store.m_BoardProcessOption.useBoardProcessOption, UseAroundBoardData, { fireImmediately: true });
//切换配置时
let disposeAop = end(store, store.UpdateOption, () =>
{
//奇怪的bug 切换配置后变量丢失autorun了 所以这里重新开启一个autorun
if (disposeReaction) disposeReaction();
disposeReaction = reaction(() => store.m_BoardProcessOption.useBoardProcessOption, UseAroundBoardData, { fireImmediately: true });
});
// this.store.GetBoardProcessOption(boards[0]);
this.store.ChangeCabinetName();
const exec = async () =>
{
let res = await app.Editor.ModalManage.Wait();
if (res.Status !== ModalState.Ok)
{
AppToaster.clear();
return;
}
let spaceParse = new TotalSpaceParse(boards);
await spaceParse.Parse();
@ -78,26 +106,34 @@ export class DrawClosingStrip implements Command
while (true)
{
this.buildClosingStrip(spaceParse.SpaceBox, spaceParse.SpaceOCS, boards[0]);
this.buildClosingStrip(spaceParse.SpaceBox, spaceParse.SpaceOCS);
AppToaster.show({
message: "收口条已绘制",
timeout: 1000,
intent: Intent.SUCCESS,
});
res = await app.Editor.ModalManage.Wait();
if (res.Status !== ModalState.Ok)
break;
}
AppToaster.clear();
if (this.store.autoCutOption.isAutoCut)
await AutoCutting(this.store.autoCutOption.isRelevance);
}
if (store.autoCutOption.isAutoCut)
await AutoCutting(store.autoCutOption.isRelevance);
};
await exec();
disposeAop();
disposeReaction();
AppToaster.clear();
}
//构建收口条,更新总空间
buildClosingStrip(totalSpace: Box3Ext, rot: Matrix4, board: Board)
buildClosingStrip(totalSpace: Box3Ext, rot: Matrix4)
{
const opt = this.store.m_Option;
let store = ClosingStripStore.GetInstance();
const opt = store.m_Option;
let size = totalSpace.getSize(new Vector3());
let max = totalSpace.max;
let min = totalSpace.min;
@ -115,14 +151,14 @@ export class DrawClosingStrip implements Command
{
br = Board.CreateBoard(size.x, width, thickness,
BoardType.Layer);
br.BoardProcessOption = this.store.BoardProcessOption;
br.BoardProcessOption = store.BoardProcessOption;
pos.set(max.x, min.y + frontShrink, max.z);
}
else
{
br = Board.CreateBoard(width, size.x, thickness,
BoardType.Behind);
br.BoardProcessOption = this.store.BoardProcessOption;
br.BoardProcessOption = store.BoardProcessOption;
br.BoardProcessOption.lines = LinesType.Reverse;
pos.set(min.x, min.y + thickness + frontShrink, max.z);
if (opt.isDrawFuZhu)
@ -182,16 +218,14 @@ export class DrawClosingStrip implements Command
}
br.Name = "右收口条";
}
br.BoardProcessOption = this.store.BoardProcessOption;
br.BoardProcessOption = store.BoardProcessOption;
}
this.useBoardProcessOption(br, board);
let brs = [br];
if (opt.isDrawFuZhu && br2)
{
brs.push(br2);
br2.BoardProcessOption = this.store.BoardProcessOption;
this.useBoardProcessOption(br2, board);
br2.BoardProcessOption = store.BoardProcessOption;
}
br.Position = pos;
//更新总空间
@ -207,16 +241,4 @@ export class DrawClosingStrip implements Command
app.Editor.UpdateScreen();
}
private useBoardProcessOption(br: Board, board: Board)//使用周围板件数据
{
if (this.store.BoardProcessOption.useBoardProcessOption)
{
br.BoardProcessOption.roomName = board.BoardProcessOption.roomName;
br.BoardProcessOption.cabinetName = board.BoardProcessOption.cabinetName + br.Name.replace("条", "");
br.BoardProcessOption.material = board.BoardProcessOption.material;
br.BoardProcessOption.boardName = board.BoardProcessOption.boardName;
br.BoardProcessOption.color = board.BoardProcessOption.color;
}
}
}

@ -201,12 +201,7 @@ export class BoardModal extends React.Component<BoardModalProps, {}>
{
store.m_BoardProcessOption.useBoardProcessOption = !store.m_BoardProcessOption.useBoardProcessOption;
}} />
<BoardProcessModal
opt={store.m_BoardProcessOption}
drillOption={store.rectDrillOption}
uiOpt={store.UIBoardProcessOption}
isDisabled={store.m_BoardProcessOption.useBoardProcessOption}
/>
<BoardProcessModal opt={store.m_BoardProcessOption} drillOption={store.rectDrillOption} uiOpt={store.UIBoardProcessOption} />
</div>
<div className={Classes.CARD}>
<Notes remarks={this.props.store.remarks} />

@ -33,7 +33,6 @@ interface BoardProcessProps
br?: Board;
drillOption?: IHightDrillOption;
otherBoardData?: { [key: string]: any; };
isDisabled?: boolean;
}
@observer
export class BoardProcessModal extends React.Component<BoardProcessProps, {}>{
@ -70,7 +69,6 @@ export class BoardProcessModal extends React.Component<BoardProcessProps, {}>{
option={this.props.opt}
title="房间名"
placeHolder="输入房间名"
isDisabled={this.props.isDisabled}
/>
<SetBoardDataItem
type={CheckObjectType.BR}
@ -78,7 +76,6 @@ export class BoardProcessModal extends React.Component<BoardProcessProps, {}>{
option={this.props.opt}
title="柜名"
placeHolder="输入柜名"
isDisabled={this.props.isDisabled}
/></>;
if (this.props.br)
{

Loading…
Cancel
Save