!2540 功能:二维刀路界面右击刀具提取板块刀具轮廓

pull/2425/MERGE
林三 9 months ago committed by ChenX
parent a364d40239
commit 27ad1f8275

@ -375,34 +375,40 @@ export class BoardConfigModal extends React.Component<BoardConfigProps, {}>{
app.Viewer.CameraCtrl.LookAt(ZAxisN); app.Viewer.CameraCtrl.LookAt(ZAxisN);
app.Viewer.CameraCtrl.ZoomExtentsBox3(brCurve.BoundingBox.expandByScalar(1000)); app.Viewer.CameraCtrl.ZoomExtentsBox3(brCurve.BoundingBox.expandByScalar(1000));
let rightPanelStore = RightPanelStore.GetInstance();
await CommandWrap(async () => await CommandWrap(async () =>
{ {
app.Database.ModelSpace.Append(brCurve); app.Database.ModelSpace.Append(brCurve);
//载入配置,设置配置 //载入配置,设置配置
let store = RightPanelStore.GetInstance();
let config = new DialogUserConfig(store.modeling2Store, BoardModalType.ZX2); let config = new DialogUserConfig(rightPanelStore.modeling2Store, BoardModalType.ZX2);
await config.LoadAndInitConfig(false); await config.LoadAndInitConfig(false);
//初始化造型数据Store //初始化造型数据Store
store.modeling2Store.InitModelingItems(); rightPanelStore.modeling2Store.InitModelingItems();
//提取出二维造型轮廓 //提取出二维造型轮廓
for (let data of br.Modeling2D) for (let data of br.Modeling2D)
{ {
let color = data.path.ColorIndex; let color = data.path.ColorIndex;
store.modeling2Store.ChangeModelingValue(color - 1, data); rightPanelStore.modeling2Store.ChangeModelingValue(color - 1, data);
let cu = data.path.Clone().Z0(); let cu = data.path.Clone().Z0();
app.Database.ModelSpace.Append(cu); app.Database.ModelSpace.Append(cu);
} }
//记录源板件
rightPanelStore.modeling2Store.localBoard = br;
//呼出右侧二维刀路对照表 //呼出右侧二维刀路对照表
store.modeling2Store.isNotUpdateStore = true; rightPanelStore.modeling2Store.isNotUpdateStore = true;
store.modeling2Store.configName = ""; rightPanelStore.modeling2Store.configName = "";
store.m_IsShow = true; rightPanelStore.m_IsShow = true;
app.Editor.MaskManage.OnFocusEvent(); app.Editor.MaskManage.OnFocusEvent();
store.m_TabId = RightTabId.Model2; rightPanelStore.m_TabId = RightTabId.Model2;
store.modeling2Store.isNotUpdateStore = false; rightPanelStore.modeling2Store.isNotUpdateStore = false;
}, "提取二维刀路"); }, "提取二维刀路");
@ -414,6 +420,7 @@ export class BoardConfigModal extends React.Component<BoardConfigProps, {}>{
{ {
if (TempEditor.EditorIng) if (TempEditor.EditorIng)
{ {
rightPanelStore.modeling2Store.localBoard = undefined;
app.Editor.ModalManage.DestoryAll(); app.Editor.ModalManage.DestoryAll();
TempEditor.End(); TempEditor.End();
app.Editor.UCSMatrix = backUCSMatrix; app.Editor.UCSMatrix = backUCSMatrix;

@ -1,12 +1,18 @@
import { Button, Classes, Intent, Label } from '@blueprintjs/core'; import { Button, Classes, Intent, Label } from '@blueprintjs/core';
import { observer } from 'mobx-react'; import { observer } from 'mobx-react';
import * as React from 'react'; import * as React from 'react';
import { selectOutlinePosition } from '../../../../Add-on/DrawBoard/DrawSpecialShapeBoardTool';
import { FaceDirection } from "../../../../Add-on/DrawDrilling/DrillType"; import { FaceDirection } from "../../../../Add-on/DrawDrilling/DrillType";
import { app } from '../../../../ApplicationServices/Application'; import { app } from '../../../../ApplicationServices/Application';
import { CheckObjectType } from '../../../../Common/CheckoutVaildValue'; import { CheckObjectType } from '../../../../Common/CheckoutVaildValue';
import { ColorMaterial } from '../../../../Common/ColorPalette'; import { ColorMaterial } from '../../../../Common/ColorPalette';
import { MouseKey } from '../../../../Common/KeyEnum';
import { FixedNotZero } from '../../../../Common/Utils'; import { FixedNotZero } from '../../../../Common/Utils';
import { safeEval } from '../../../../Common/eval'; import { safeEval } from '../../../../Common/eval';
import { Board } from '../../../../DatabaseServices/Entity/Board';
import { CommandWrap } from '../../../../Editor/CommandMachine';
import { JigUtils } from '../../../../Editor/JigUtils';
import { TempEditor } from '../../../../Editor/TempEditor';
import { IKnifeInfo2, IUiVModeing, IVModelingInfo, Modeling2Store } from '../../../Store/RightPanelStore/Modeling2Store'; import { IKnifeInfo2, IUiVModeing, IVModelingInfo, Modeling2Store } from '../../../Store/RightPanelStore/Modeling2Store';
import { BoardModalType } from "../../Board/BoardModalType"; import { BoardModalType } from "../../Board/BoardModalType";
import { Config_ModalType, UserConfigComponent } from '../../Board/UserConfigComponent'; import { Config_ModalType, UserConfigComponent } from '../../Board/UserConfigComponent';
@ -85,6 +91,7 @@ export class ModelingComponent2 extends React.Component<{ store?: Modeling2Store
className="bp3-input select-kinfe" className="bp3-input select-kinfe"
value={d1items[i].knife.name ? `${d1items[i].knife.name},半径:${d1items[i].knife.props.radius},角度:${FixedNotZero(d1items[i].knife.props.angle)}` : "双击选刀"} value={d1items[i].knife.name ? `${d1items[i].knife.name},半径:${d1items[i].knife.props.radius},角度:${FixedNotZero(d1items[i].knife.props.angle)}` : "双击选刀"}
onDoubleClick={() => this.startSelectKnife(d1items[i].knife)} onDoubleClick={() => this.startSelectKnife(d1items[i].knife)}
onMouseDown={(e) => this.handleMouseDown(e, d1items[i])}
readOnly readOnly
/> />
{ {
@ -137,4 +144,26 @@ export class ModelingComponent2 extends React.Component<{ store?: Modeling2Store
{ {
app.Editor.ModalManage.RenderModal(KnifeManage, { knifeInfo: info }); app.Editor.ModalManage.RenderModal(KnifeManage, { knifeInfo: info });
}; };
handleMouseDown = async (e: React.MouseEvent<HTMLElement>, info: IVModelingInfo) =>
{
if (e.button === MouseKey.Right)
{
let br = this.props.store.localBoard as Board;
if (!TempEditor.EditorIng || !br) return;
let knifeId = info.knife.id;
let pl = br.KnifePolylineMap.get(knifeId);
if (pl)
{
let cu = JigUtils.Draw(pl.Clone());
CommandWrap(async () =>
{
await selectOutlinePosition(cu);
});
}
}
e.preventDefault();
};
} }

@ -41,6 +41,7 @@ export class Modeling2Store implements IConfigStore
@observable modelingItems: IModeling2Item[] = []; @observable modelingItems: IModeling2Item[] = [];
@observable uiModeingItems: IUiVModeing[] = []; @observable uiModeingItems: IUiVModeing[] = [];
isNotUpdateStore = false; isNotUpdateStore = false;
localBoard: any; //记录编辑二维刀路的源板件
private _ModelingItemId = 0; private _ModelingItemId = 0;
constructor() constructor()
{ {

Loading…
Cancel
Save