清理m_开头的代码

pull/347/head
ChenX 5 years ago
parent 3cf98d905f
commit 4f6f4576d2

@ -1,19 +1,17 @@
import { Vector3 } from 'three'; import { Vector3 } from 'three';
import { CADFiler } from '../../src/DatabaseServices/CADFiler';
import { Curve } from '../../src/DatabaseServices/Entity/Curve';
import { Line } from '../../src/DatabaseServices/Entity/Line'; import { Line } from '../../src/DatabaseServices/Entity/Line';
import { RegionParse } from './../../src/Geometry/RegionParse';
import { LoadCurvesFromFileData } from '../Utils/LoadEntity.util'; import { LoadCurvesFromFileData } from '../Utils/LoadEntity.util';
import { RegionParse } from './../../src/Geometry/RegionParse';
function expectReg(alg: RegionParse) function expectReg(alg: RegionParse)
{ {
let data1 = alg.m_RegionsInternal.map(o => let data1 = alg.RegionsInternal.map(o =>
{ {
let res = []; let res = [];
o.forEach(r => { res.push(r.to.position.toArray()) }) o.forEach(r => { res.push(r.to.position.toArray()) })
return res; return res;
}); });
let data2 = alg.m_RegionsOutline.map(o => let data2 = alg.RegionsOutline.map(o =>
{ {
let res = []; let res = [];
o.forEach(r => { res.push(r.to.position.toArray()) }) o.forEach(r => { res.push(r.to.position.toArray()) })
@ -43,10 +41,10 @@ test('两个相连的区域', () =>
culist.push(l1, l2, l3, l4, l5, l6, l7); culist.push(l1, l2, l3, l4, l5, l6, l7);
let g = new RegionParse(culist); let g = new RegionParse(culist);
g.m_RegionsOutline.length //? g.RegionsOutline.length //?
g.m_RegionsInternal.length //? g.RegionsInternal.length //?
expect(g.m_RegionsOutline.length).toBe(2); expect(g.RegionsOutline.length).toBe(2);
expect(g.m_RegionsInternal.length).toBe(0); expect(g.RegionsInternal.length).toBe(0);
expectReg(g); expectReg(g);
}); });
@ -67,10 +65,10 @@ test('区域内有分割-三角形', () =>
culist.push(l1, l2, l3, l4, l5); culist.push(l1, l2, l3, l4, l5);
let g = new RegionParse(culist); let g = new RegionParse(culist);
g.m_RegionsOutline.length //? g.RegionsOutline.length //?
g.m_RegionsInternal.length //? g.RegionsInternal.length //?
expect(g.m_RegionsOutline.length).toBe(1); expect(g.RegionsOutline.length).toBe(1);
expect(g.m_RegionsInternal.length).toBe(2); expect(g.RegionsInternal.length).toBe(2);
expectReg(g); expectReg(g);
}); });
@ -90,10 +88,10 @@ test('区域有延长线', () =>
culist.push(l1, l2, l3, l4, l5, l6); culist.push(l1, l2, l3, l4, l5, l6);
let g = new RegionParse(culist); let g = new RegionParse(culist);
g.m_RegionsOutline.length //? g.RegionsOutline.length //?
g.m_RegionsInternal.length //? g.RegionsInternal.length //?
expect(g.m_RegionsOutline.length).toBe(1); expect(g.RegionsOutline.length).toBe(1);
expect(g.m_RegionsInternal.length).toBe(2); expect(g.RegionsInternal.length).toBe(2);
expectReg(g); expectReg(g);
}); });
@ -115,10 +113,10 @@ test('区域内多条线', () =>
culist.push(l1, l2, l3, l4, l5, l6, l7); culist.push(l1, l2, l3, l4, l5, l6, l7);
let g = new RegionParse(culist); let g = new RegionParse(culist);
g.m_RegionsOutline.length //? g.RegionsOutline.length //?
g.m_RegionsInternal.length //? g.RegionsInternal.length //?
expect(g.m_RegionsOutline.length).toBe(1); expect(g.RegionsOutline.length).toBe(1);
expect(g.m_RegionsInternal.length).toBe(3); expect(g.RegionsInternal.length).toBe(3);
expectReg(g); expectReg(g);
}); });
@ -142,10 +140,10 @@ test('包含区域', () =>
culist.push(l1, l2, l3, l4, l5, l6, l7, l8); culist.push(l1, l2, l3, l4, l5, l6, l7, l8);
let g = new RegionParse(culist); let g = new RegionParse(culist);
g.m_RegionsOutline.length //? g.RegionsOutline.length //?
g.m_RegionsInternal.length //? g.RegionsInternal.length //?
expect(g.m_RegionsOutline.length).toBe(2); expect(g.RegionsOutline.length).toBe(2);
expect(g.m_RegionsInternal.length).toBe(0); expect(g.RegionsInternal.length).toBe(0);
expectReg(g); expectReg(g);
}); });
@ -173,10 +171,10 @@ test('测试复杂形状', () =>
] ]
let g = new RegionParse(culist); let g = new RegionParse(culist);
g.m_RegionsOutline.length //? g.RegionsOutline.length //?
g.m_RegionsInternal.length //? g.RegionsInternal.length //?
expect(g.m_RegionsOutline.length).toBe(1); expect(g.RegionsOutline.length).toBe(1);
expect(g.m_RegionsInternal.length).toBe(8); expect(g.RegionsInternal.length).toBe(8);
expectReg(g); expectReg(g);
}); });
@ -199,10 +197,10 @@ test('矩形套矩形', () =>
] ]
let g = new RegionParse(culist); let g = new RegionParse(culist);
g.m_RegionsOutline.length //? g.RegionsOutline.length //?
g.m_RegionsInternal.length //? g.RegionsInternal.length //?
expect(g.m_RegionsOutline.length).toBe(1); expect(g.RegionsOutline.length).toBe(1);
expect(g.m_RegionsInternal.length).toBe(4); expect(g.RegionsInternal.length).toBe(4);
expectReg(g); expectReg(g);
}); });
@ -221,10 +219,10 @@ test('保护伞', () =>
new Line(new Vector3().fromArray([-0.33498759305210946, 0.5583126550868487, 0]), new Vector3().fromArray([-2.0843672456575684, 1.9106699751861045, 0])), new Line(new Vector3().fromArray([-0.33498759305210946, 0.5583126550868487, 0]), new Vector3().fromArray([-2.0843672456575684, 1.9106699751861045, 0])),
] ]
let g = new RegionParse(culist); let g = new RegionParse(culist);
g.m_RegionsOutline.length //? g.RegionsOutline.length //?
g.m_RegionsInternal.length //? g.RegionsInternal.length //?
expect(g.m_RegionsOutline.length).toBe(3); expect(g.RegionsOutline.length).toBe(3);
expect(g.m_RegionsInternal.length).toBe(0); expect(g.RegionsInternal.length).toBe(0);
expectReg(g); expectReg(g);
}); });
@ -237,6 +235,6 @@ test('带圆弧的复杂图形测试', () =>
) )
let g = new RegionParse(cus); let g = new RegionParse(cus);
expect(g.m_RegionsInternal.length).toBe(7); expect(g.RegionsInternal.length).toBe(7);
expect(g.m_RegionsOutline.length).toBe(1); expect(g.RegionsOutline.length).toBe(1);
}); });

@ -66,7 +66,7 @@ function TestFilletPolyline(
) )
{ {
let pl = LoadEntityFromFileData(curveData)[0] as Polyline; let pl = LoadEntityFromFileData(curveData)[0] as Polyline;
fillet.m_FilletRadius = radius; fillet.FilletRadius = radius;
let es1 = new PromptEntityResult(pl, undefined); let es1 = new PromptEntityResult(pl, undefined);

@ -10,19 +10,19 @@ abstract class PtOnBoard implements Command
prompt: string; prompt: string;
async exec() async exec()
{ {
app.m_Viewer._GripScene.visible = true; app.Viewer.GripScene.visible = true;
//获取板件 //获取板件
let br = app.m_Editor.m_SelectCtrl.SelectSet.SelectEntityList[0] as Board; let br = app.Editor.SelectCtrl.SelectSet.SelectEntityList[0] as Board;
if (!br || !(br instanceof Board)) if (!br || !(br instanceof Board))
return; return;
let olducs = app.m_Editor.UCSMatrix; let olducs = app.Editor.UCSMatrix;
app.m_Editor.UCSMatrix = br.OCS; app.Editor.UCSMatrix = br.OCS;
//增删点 //增删点
while (true) while (true)
{ {
let ptRes = await app.m_Editor.GetPoint({ let ptRes = await app.Editor.GetPoint({
AllowDrawRubberBand: true, AllowDrawRubberBand: true,
AllowNone: true, AllowNone: true,
Msg: `点击需要${this.prompt}的点` Msg: `点击需要${this.prompt}的点`
@ -31,16 +31,16 @@ abstract class PtOnBoard implements Command
if (ptRes.Status !== PromptStatus.OK) if (ptRes.Status !== PromptStatus.OK)
break; break;
app.m_Database.hm.StartMark(); app.Database.hm.StartMark();
let newContour = this.operation(br, ptRes); let newContour = this.operation(br, ptRes);
if (newContour === undefined) if (newContour === undefined)
continue; continue;
br.ContourCurve = newContour; br.ContourCurve = newContour;
let brObj = app.m_Editor.m_SelectCtrl.SelectSet.SelectObjectList[0]; let brObj = app.Editor.SelectCtrl.SelectSet.SelectObjectList[0];
app.m_Viewer._GripScene.Update(brObj); app.Viewer.GripScene.Update(brObj);
} }
app.m_Editor.UCSMatrix = olducs; app.Editor.UCSMatrix = olducs;
} }
abstract operation(br: Board, ptRes: PromptPointResult): Polyline; abstract operation(br: Board, ptRes: PromptPointResult): Polyline;
} }
@ -58,12 +58,12 @@ export class AddPtOnBoard extends PtOnBoard
let index = brContour.GetParamAtPoint(npt); let index = brContour.GetParamAtPoint(npt);
if (isNaN(index)) if (isNaN(index))
{ {
app.m_Editor.Prompt('加点出错了'); app.Editor.Prompt('加点出错了');
return undefined; return undefined;
} }
if (index % 1 === 0) if (index % 1 === 0)
{ {
app.m_Editor.Prompt('检测加点位置在点的位置.加点失败.'); app.Editor.Prompt('检测加点位置在点的位置.加点失败.');
return undefined; return undefined;
} }
newPt.applyMatrix4(brContour.OCSInv); newPt.applyMatrix4(brContour.OCSInv);
@ -90,19 +90,19 @@ export class DeletePtOnBoard extends PtOnBoard
} }
if (!pindex) if (!pindex)
{ {
app.m_Editor.Prompt("该位置没有点,无法删除"); app.Editor.Prompt("该位置没有点,无法删除");
return undefined; return undefined;
} }
newPt.applyMatrix4(br.OCSInv).setZ(0); newPt.applyMatrix4(br.OCSInv).setZ(0);
let index = brContour.GetParamAtPoint(newPt); let index = brContour.GetParamAtPoint(newPt);
if (isNaN(index)) if (isNaN(index))
{ {
app.m_Editor.Prompt('删点出错了'); app.Editor.Prompt('删点出错了');
return undefined; return undefined;
} }
if (index % 1 === 0.5) if (index % 1 === 0.5)
{ {
app.m_Editor.Prompt('中点无法删除'); app.Editor.Prompt('中点无法删除');
return undefined; return undefined;
} }
brContour.RemoveVertexAt(index); brContour.RemoveVertexAt(index);

@ -99,8 +99,8 @@ export class ArrayStore extends Singleton
} }
_Return(state: number) _Return(state: number)
{ {
app.m_Editor.m_ModalManage.m_PromisRes({ Status: state }); app.Editor.ModalManage.m_PromisRes({ Status: state });
app.m_Editor.m_ModalManage.Clear(); app.Editor.ModalManage.Clear();
} }
} }
export class Command_Array implements Command export class Command_Array implements Command
@ -111,7 +111,7 @@ export class Command_Array implements Command
{ {
let option = this.arrayStore.m_Option; let option = this.arrayStore.m_Option;
let ssRes = await app.m_Editor.GetSelection({ Msg: "请选择阵列对象:", UseSelect: true }); let ssRes = await app.Editor.GetSelection({ Msg: "请选择阵列对象:", UseSelect: true });
if (ssRes.Status !== PromptStatus.OK) if (ssRes.Status !== PromptStatus.OK)
return; return;
let ss = ssRes.SelectSet; let ss = ssRes.SelectSet;
@ -121,25 +121,25 @@ export class Command_Array implements Command
unionBoxs.union(selectEnt.BoundingBox); unionBoxs.union(selectEnt.BoundingBox);
//渲染模态框 //渲染模态框
app.m_Editor.m_ModalManage.RenderModal(ArrayModal, ModalPosition.Right, { store: this.arrayStore }); app.Editor.ModalManage.RenderModal(ArrayModal, ModalPosition.Right, { store: this.arrayStore });
//鼠标点选 //鼠标点选
while (true) while (true)
{ {
app.m_Database.hm.StartMark(); app.Database.hm.StartMark();
let res = await app.m_Editor.m_ModalManage.Wait(); let res = await app.Editor.ModalManage.Wait();
if (res.Status === ModalState.Cancel) if (res.Status === ModalState.Cancel)
return; return;
//数据准备 //数据准备
let item_total = option.itemTotal; let itemTotal = option.itemTotal;
let fill_angle = option.fillAngle; let fillAngle = option.fillAngle;
let between_angle = option.betweenAngle; let betweenAngle = option.betweenAngle;
let ucsInv = app.m_Editor.UCSMatrixInv; let ucsInv = app.Editor.UCSMatrixInv;
switch (res.Status) switch (res.Status)
{ {
case Pick.centerPoint: case Pick.centerPoint:
let ptRes1 = await app.m_Editor.GetPoint({ Msg: "请选择中心点:" }); let ptRes1 = await app.Editor.GetPoint({ Msg: "请选择中心点:" });
if (ptRes1.Status === PromptStatus.OK) if (ptRes1.Status === PromptStatus.OK)
{ {
let pt1Ucs = ptRes1.Point.applyMatrix4(ucsInv); let pt1Ucs = ptRes1.Point.applyMatrix4(ucsInv);
@ -149,7 +149,7 @@ export class Command_Array implements Command
break; break;
case Pick.rowOffset: case Pick.rowOffset:
let disRes1 = await app.m_Editor.GetDistance({ let disRes1 = await app.Editor.GetDistance({
Msg: "请指定行偏移:", Msg: "请指定行偏移:",
CalcDistance: (baseP, p: Vector3) => CalcDistance: (baseP, p: Vector3) =>
{ {
@ -161,7 +161,7 @@ export class Command_Array implements Command
break; break;
case Pick.colOffset: case Pick.colOffset:
let disRes2 = await app.m_Editor.GetDistance({ let disRes2 = await app.Editor.GetDistance({
Msg: "请指定列偏移:", Msg: "请指定列偏移:",
CalcDistance: (baseP, p: Vector3) => CalcDistance: (baseP, p: Vector3) =>
{ {
@ -173,81 +173,81 @@ export class Command_Array implements Command
break; break;
case Pick.arrayAngle: case Pick.arrayAngle:
let ptRes4 = await app.m_Editor.GetAngle({ Msg: "请指定阵列角度:" }); let ptRes4 = await app.Editor.GetAngle({ Msg: "请指定阵列角度:" });
if (ptRes4.Status === PromptStatus.OK) if (ptRes4.Status === PromptStatus.OK)
option.arrayAngle = Math.round(ptRes4.Distance); option.arrayAngle = Math.round(ptRes4.Distance);
break; break;
case Pick.fillAngle: case Pick.fillAngle:
let ptRes6 = await app.m_Editor.GetAngle({ Msg: "请指定填充角度:" }); let ptRes6 = await app.Editor.GetAngle({ Msg: "请指定填充角度:" });
if (ptRes6.Status === PromptStatus.OK) if (ptRes6.Status === PromptStatus.OK)
{ {
fill_angle = Math.round(ptRes6.Distance); fillAngle = Math.round(ptRes6.Distance);
if (fill_angle === 0 || between_angle === 0) if (fillAngle === 0 || betweenAngle === 0)
{ {
app.m_Editor.Prompt("错误:填充角度或者项目间角度为0!"); app.Editor.Prompt("错误:填充角度或者项目间角度为0!");
} }
else if (option.method === CirArrMethod.itemsAndAngle) else if (option.method === CirArrMethod.itemsAndAngle)
{ {
if (item_total === 1) if (itemTotal === 1)
{ {
item_total = 2; itemTotal = 2;
between_angle = fill_angle; betweenAngle = fillAngle;
} }
else else
{ {
if (fill_angle === 360) if (fillAngle === 360)
between_angle = Math.round(fill_angle / (item_total)); betweenAngle = Math.round(fillAngle / (itemTotal));
else else
between_angle = Math.round(fill_angle / (item_total - 1)); betweenAngle = Math.round(fillAngle / (itemTotal - 1));
} }
} }
else if (option.method === CirArrMethod.fillAngleAndBeAngle) else if (option.method === CirArrMethod.fillAngleAndBeAngle)
{ {
if (between_angle > fill_angle) if (betweenAngle > fillAngle)
between_angle = fill_angle; betweenAngle = fillAngle;
item_total = Math.ceil(fill_angle / between_angle); itemTotal = Math.ceil(fillAngle / betweenAngle);
} }
} }
break; break;
case Pick.betweenAngle: case Pick.betweenAngle:
let ptRes8 = await app.m_Editor.GetAngle({ Msg: "请指定项目间角度:" }); let ptRes8 = await app.Editor.GetAngle({ Msg: "请指定项目间角度:" });
if (ptRes8.Status === PromptStatus.OK) if (ptRes8.Status === PromptStatus.OK)
{ {
between_angle = Math.round(ptRes8.Distance); betweenAngle = Math.round(ptRes8.Distance);
//关联计算 //关联计算
if (option.method === CirArrMethod.itemsAndBeAngle) if (option.method === CirArrMethod.itemsAndBeAngle)
{ {
let biggest_Bangle = Math.round(360 / item_total); let biggestBAngle = Math.round(360 / itemTotal);
if (between_angle > biggest_Bangle) if (betweenAngle > biggestBAngle)
{ {
AppToaster.show({ message: `拾取角度超过当前允许最大值(${biggest_Bangle}),请减小项目总数或项目间角度`, timeout: 2000 }); AppToaster.show({ message: `拾取角度超过当前允许最大值(${biggestBAngle}),请减小项目总数或项目间角度`, timeout: 2000 });
between_angle = biggest_Bangle; betweenAngle = biggestBAngle;
fill_angle = 360; fillAngle = 360;
} }
else else
{ {
if (item_total === 1) if (itemTotal === 1)
fill_angle = 360; fillAngle = 360;
else else
fill_angle = between_angle * (item_total - 1); fillAngle = betweenAngle * (itemTotal - 1);
} }
} }
else if (option.method === CirArrMethod.fillAngleAndBeAngle) else if (option.method === CirArrMethod.fillAngleAndBeAngle)
{ {
if (between_angle !== 0 && fill_angle !== 0) if (betweenAngle !== 0 && fillAngle !== 0)
{ {
if (between_angle > fill_angle) if (betweenAngle > fillAngle)
between_angle = fill_angle; betweenAngle = fillAngle;
item_total = Math.floor(fill_angle / between_angle); itemTotal = Math.floor(fillAngle / betweenAngle);
} }
} }
} }
break; break;
case Pick.rowAndColOffset: case Pick.rowAndColOffset:
let ptRes = await app.m_Editor.GetPoint({ Msg: "指定第一个角点:" }); let ptRes = await app.Editor.GetPoint({ Msg: "指定第一个角点:" });
if (ptRes.Status != PromptStatus.OK) if (ptRes.Status != PromptStatus.OK)
break; break;
@ -255,7 +255,7 @@ export class Command_Array implements Command
let rec = new Polyline(); let rec = new Polyline();
rec.CloseMark = true; rec.CloseMark = true;
rec.ApplyMatrix(app.m_Editor.UCSMatrix); rec.ApplyMatrix(app.Editor.UCSMatrix);
JigUtils.Draw(rec); JigUtils.Draw(rec);
let row: number; let row: number;
@ -281,7 +281,7 @@ export class Command_Array implements Command
{ pt: px4, bul: 0 }]; { pt: px4, bul: 0 }];
} }
ptRes = await app.m_Editor.GetPoint({ ptRes = await app.Editor.GetPoint({
Msg: "指定另一个角点:", Msg: "指定另一个角点:",
Callback: (p) => updateRect(p1, p), Callback: (p) => updateRect(p1, p),
RelativeBasePoint: p1 RelativeBasePoint: p1
@ -301,11 +301,11 @@ export class Command_Array implements Command
if (res.Status === ModalState.Ok) if (res.Status === ModalState.Ok)
break; break;
//数据提交 //数据提交
option.itemTotal = item_total; option.itemTotal = itemTotal;
option.fillAngle = fill_angle; option.fillAngle = fillAngle;
option.betweenAngle = between_angle; option.betweenAngle = betweenAngle;
//呼出模态框 //呼出模态框
app.m_Editor.m_ModalManage.RenderModal(ArrayModal, ModalPosition.Old, { store: this.arrayStore }); app.Editor.ModalManage.RenderModal(ArrayModal, ModalPosition.Old, { store: this.arrayStore });
} }
//根据模态框tab的选择构造阵列 //根据模态框tab的选择构造阵列
@ -336,14 +336,14 @@ export class Command_Array implements Command
betweenAngle = -betweenAngle; betweenAngle = -betweenAngle;
CirArray(ss, ptRes, ArrayNum, THREE.Math.degToRad(betweenAngle)); CirArray(ss, ptRes, ArrayNum, THREE.Math.degToRad(betweenAngle));
} }
app.m_Editor.UpdateScreen(); app.Editor.UpdateScreen();
} }
} }
//构造矩形阵列 //构造矩形阵列
function recArray(ss: SelectSet, rowNum: number, colNum: number, rowOffset: number, colOffset: number, arrayAngle: number = 0) function recArray(ss: SelectSet, rowNum: number, colNum: number, rowOffset: number, colOffset: number, arrayAngle: number = 0)
{ {
let mat = new Matrix4().extractRotation(app.m_Editor.UCSMatrix) let mat = new Matrix4().extractRotation(app.Editor.UCSMatrix)
let xVec = rotatePoint(new Vector3(colOffset), arrayAngle).applyMatrix4(mat); let xVec = rotatePoint(new Vector3(colOffset), arrayAngle).applyMatrix4(mat);
let yVec = rotatePoint(new Vector3(0, rowOffset), arrayAngle).applyMatrix4(mat); let yVec = rotatePoint(new Vector3(0, rowOffset), arrayAngle).applyMatrix4(mat);
@ -361,7 +361,7 @@ function recArray(ss: SelectSet, rowNum: number, colNum: number, rowOffset: numb
{ {
let e = en.Clone(); let e = en.Clone();
e.ApplyMatrix(moveMat); e.ApplyMatrix(moveMat);
app.m_Database.ModelSpace.Append(e); app.Database.ModelSpace.Append(e);
} }
} }
} }
@ -370,7 +370,7 @@ function recArray(ss: SelectSet, rowNum: number, colNum: number, rowOffset: numb
//构造环形阵列 //构造环形阵列
function CirArray(ss: SelectSet, ptRes: Vector3, itemTotal: number, betweenAngle: number) function CirArray(ss: SelectSet, ptRes: Vector3, itemTotal: number, betweenAngle: number)
{ {
let mat = new Matrix4().extractRotation(app.m_Editor.UCSMatrix); let mat = new Matrix4().extractRotation(app.Editor.UCSMatrix);
let pt = ptRes.clone().applyMatrix4(mat); let pt = ptRes.clone().applyMatrix4(mat);
//平移变换矩阵 //平移变换矩阵
let moveMat = MoveMatrix(pt); let moveMat = MoveMatrix(pt);
@ -388,7 +388,7 @@ function CirArray(ss: SelectSet, ptRes: Vector3, itemTotal: number, betweenAngle
newEnt.ApplyMatrix(moveMatInv); newEnt.ApplyMatrix(moveMatInv);
newEnt.ApplyMatrix(roMat); newEnt.ApplyMatrix(roMat);
newEnt.ApplyMatrix(moveMat); newEnt.ApplyMatrix(moveMat);
app.m_Database.ModelSpace.Append(newEnt); app.Database.ModelSpace.Append(newEnt);
} }
} }
} }

@ -27,7 +27,7 @@ export class BoardBatchCurtail implements Command
{ {
let store = BoardBatchCurtailStore.GetInstance() as BoardBatchCurtailStore; let store = BoardBatchCurtailStore.GetInstance() as BoardBatchCurtailStore;
let enRes = await app.m_Editor.GetSelection({ let enRes = await app.Editor.GetSelection({
Msg: "选择需要修改的板件", Msg: "选择需要修改的板件",
Filter: { Filter: {
filterTypes: [Board] filterTypes: [Board]
@ -85,9 +85,9 @@ export class BoardBatchCurtail implements Command
store.checkValue[key] = d.allowDist / 2; store.checkValue[key] = d.allowDist / 2;
} }
app.m_Editor.m_ModalManage.RenderModal(BoardBatchCurtailModal, ModalPosition.Center, { store }); app.Editor.ModalManage.RenderModal(BoardBatchCurtailModal, ModalPosition.Center, { store });
let res = await app.m_Editor.m_ModalManage.Wait(); let res = await app.Editor.ModalManage.Wait();
if (res.Status === ModalState.Ok) if (res.Status === ModalState.Ok)
{ {

@ -12,7 +12,7 @@ export class AutoCuttingReactor
const cuttingCommands = ["QG2", "QG", "QG4", "COPY"]; const cuttingCommands = ["QG2", "QG", "QG4", "COPY"];
app.m_CommandReactor.OnCommandEnd((cmdName, changeObjects, createObjects) => app.CommandReactor.OnCommandEnd((cmdName, changeObjects, createObjects) =>
{ {
if (!this.Enable) return; if (!this.Enable) return;
@ -27,7 +27,7 @@ export class AutoCuttingReactor
{ {
let nc = new NonAssociativeCutting(); let nc = new NonAssociativeCutting();
let brs: Board[] = []; let brs: Board[] = [];
for (let ent of app.m_Viewer.VisibleEntitys) for (let ent of app.Viewer.VisibleEntitys)
{ {
if (ent instanceof Board && !ents.includes(ent)) if (ent instanceof Board && !ents.includes(ent))
brs.push(ent); brs.push(ent);

@ -14,7 +14,7 @@ export class LinearCutting implements Command
{ {
async exec() async exec()
{ {
let brsRes = await app.m_Editor.GetSelection({ let brsRes = await app.Editor.GetSelection({
Msg: "选择被切割的板件(空格选择全部)", Msg: "选择被切割的板件(空格选择全部)",
UseSelect: true, UseSelect: true,
Filter: { filterTypes: [Board] }, Filter: { filterTypes: [Board] },
@ -27,7 +27,7 @@ export class LinearCutting implements Command
let brs: Board[] = brsRes.SelectSet.SelectEntityList as Board[]; let brs: Board[] = brsRes.SelectSet.SelectEntityList as Board[];
if (brs.length === 0) if (brs.length === 0)
{ {
for (let ent of app.m_Viewer.VisibleEntitys) for (let ent of app.Viewer.VisibleEntitys)
{ {
if (ent instanceof Board) if (ent instanceof Board)
brs.push(ent); brs.push(ent);
@ -35,16 +35,16 @@ export class LinearCutting implements Command
} }
//如果只有一个板并且UCS和视图不平行,那么将坐标系临时改成板件坐标系 //如果只有一个板并且UCS和视图不平行,那么将坐标系临时改成板件坐标系
let ucsDir = new Vector3().setFromMatrixColumn(app.m_Editor.UCSMatrix, 2); let ucsDir = new Vector3().setFromMatrixColumn(app.Editor.UCSMatrix, 2);
let oldUcs: Matrix4 = app.m_Editor.UCSMatrix; let oldUcs: Matrix4 = app.Editor.UCSMatrix;
if (brs.length === 1 && !isParallelTo(ucsDir, app.m_Viewer.m_CameraCtrl.Direction)) if (brs.length === 1 && !isParallelTo(ucsDir, app.Viewer.CameraCtrl.Direction))
app.m_Editor.UCSMatrix = brs[0].OCS; app.Editor.UCSMatrix = brs[0].OCS;
let pts: Vector3[] = []; let pts: Vector3[] = [];
while (true) while (true)
{ {
let ptRes = await app.m_Editor.GetPoint({ let ptRes = await app.Editor.GetPoint({
BasePoint: pts.length !== 0 ? arrayLast(pts) : undefined, BasePoint: pts.length !== 0 ? arrayLast(pts) : undefined,
AllowDrawRubberBand: true, AllowDrawRubberBand: true,
AllowNone: true, AllowNone: true,
@ -52,7 +52,7 @@ export class LinearCutting implements Command
}); });
if (ptRes.Status === PromptStatus.Cancel) if (ptRes.Status === PromptStatus.Cancel)
{ {
app.m_Editor.UCSMatrix = oldUcs; app.Editor.UCSMatrix = oldUcs;
return; return;
} }
@ -63,13 +63,13 @@ export class LinearCutting implements Command
} }
if (pts.length < 2) if (pts.length < 2)
{ {
app.m_Editor.Prompt("切割必须有2个点以上!"); app.Editor.Prompt("切割必须有2个点以上!");
app.m_Editor.UCSMatrix = oldUcs; app.Editor.UCSMatrix = oldUcs;
return; return;
} }
let ucsInv = app.m_Editor.UCSMatrixInv; let ucsInv = app.Editor.UCSMatrixInv;
let ucs = app.m_Editor.UCSMatrix; let ucs = app.Editor.UCSMatrix;
let ptsWcs = pts;//缓存世界坐标系,支持UCS不同时使用捕捉. let ptsWcs = pts;//缓存世界坐标系,支持UCS不同时使用捕捉.
pts = pts.map(p => p.clone().applyMatrix4(ucsInv).setZ(0).applyMatrix4(ucs)); pts = pts.map(p => p.clone().applyMatrix4(ucsInv).setZ(0).applyMatrix4(ucs));
@ -153,7 +153,7 @@ export class LinearCutting implements Command
let regionParse = new RegionParse([...brSplitCus, ...allSplitPls]); let regionParse = new RegionParse([...brSplitCus, ...allSplitPls]);
let cus = regionParse.m_RegionsInternal.map(r => let cus = regionParse.RegionsInternal.map(r =>
{ {
let pl = new Polyline(); let pl = new Polyline();
for (let route of r) for (let route of r)
@ -173,15 +173,15 @@ export class LinearCutting implements Command
let br2 = br.Clone(); let br2 = br.Clone();
br2.ContourCurve = cus[i]; br2.ContourCurve = cus[i];
br2.GrooveCheckAll(splitBoards); br2.GrooveCheckAll(splitBoards);
app.m_Database.ModelSpace.Append(br2); app.Database.ModelSpace.Append(br2);
} }
br.ContourCurve = cus[0]; br.ContourCurve = cus[0];
br.GrooveCheckAll(splitBoards); br.GrooveCheckAll(splitBoards);
for (let nb of splitBoards) for (let nb of splitBoards)
app.m_Database.ModelSpace.Append(nb); app.Database.ModelSpace.Append(nb);
} }
app.m_Editor.UCSMatrix = oldUcs; app.Editor.UCSMatrix = oldUcs;
} }
} }

@ -8,7 +8,7 @@ export class NonAssociativeCutting implements Command
{ {
async exec() async exec()
{ {
let brsRes2 = await app.m_Editor.GetSelection({ let brsRes2 = await app.Editor.GetSelection({
Msg: "选择切割的板件", Msg: "选择切割的板件",
UseSelect: true, UseSelect: true,
Filter: { filterTypes: [Board] } Filter: { filterTypes: [Board] }
@ -17,9 +17,9 @@ export class NonAssociativeCutting implements Command
if (brsRes2.Status !== PromptStatus.OK) if (brsRes2.Status !== PromptStatus.OK)
return; return;
let brs2 = brsRes2.SelectSet.SelectEntityList as Board[]; let brs2 = brsRes2.SelectSet.SelectEntityList as Board[];
app.m_Editor.Prompt(`选择切割的板件: 总计${brs2.length}`); app.Editor.Prompt(`选择切割的板件: 总计${brs2.length}`);
let brsRes = await app.m_Editor.GetSelection({ let brsRes = await app.Editor.GetSelection({
Msg: "选择被切割的板件<全部选择>", Msg: "选择被切割的板件<全部选择>",
UseSelect: true, UseSelect: true,
Filter: { Filter: {
@ -38,13 +38,13 @@ export class NonAssociativeCutting implements Command
let brs: Board[] = brsRes.SelectSet.SelectEntityList as Board[]; let brs: Board[] = brsRes.SelectSet.SelectEntityList as Board[];
if (brs.length === 0) if (brs.length === 0)
{ {
for (let ent of app.m_Viewer.VisibleEntitys) for (let ent of app.Viewer.VisibleEntitys)
{ {
if (ent instanceof Board && !brs2.includes(ent)) if (ent instanceof Board && !brs2.includes(ent))
brs.push(ent); brs.push(ent);
} }
} }
app.m_Editor.Prompt(`选择了被切割的板件: 总计${brs.length}`); app.Editor.Prompt(`选择了被切割的板件: 总计${brs.length}`);
for (let br of brs) for (let br of brs)
this.CuttingBoard(br, brs2); this.CuttingBoard(br, brs2);
@ -69,7 +69,7 @@ export class NonAssociativeCutting implements Command
for (let br of splitBoard) for (let br of splitBoard)
{ {
app.m_Database.ModelSpace.Append(br); app.Database.ModelSpace.Append(br);
} }
} }
} }

@ -15,7 +15,7 @@ export class ReferenceCutting implements Command
{ {
async exec() async exec()
{ {
let brRes = await app.m_Editor.GetSelection({ let brRes = await app.Editor.GetSelection({
Once: true, Once: true,
Msg: "选择切割的板件(单块)", Msg: "选择切割的板件(单块)",
Filter: { Filter: {
@ -26,7 +26,7 @@ export class ReferenceCutting implements Command
if (brRes.Status !== PromptStatus.OK) return; if (brRes.Status !== PromptStatus.OK) return;
let brKnife = brRes.SelectSet.SelectEntityList[0] as Board; let brKnife = brRes.SelectSet.SelectEntityList[0] as Board;
brRes = await app.m_Editor.GetSelection({ brRes = await app.Editor.GetSelection({
Msg: "选择被切割的板件(空格选择剩余全部)", Msg: "选择被切割的板件(空格选择剩余全部)",
Filter: { Filter: {
filterTypes: [Board], filterTypes: [Board],
@ -41,13 +41,13 @@ export class ReferenceCutting implements Command
let brs: Board[] = brRes.SelectSet.SelectEntityList as Board[]; let brs: Board[] = brRes.SelectSet.SelectEntityList as Board[];
if (brs.length === 0) if (brs.length === 0)
{ {
for (let ent of app.m_Viewer.VisibleEntitys) for (let ent of app.Viewer.VisibleEntitys)
{ {
if (ent instanceof Board && ent !== brKnife) if (ent instanceof Board && ent !== brKnife)
brs.push(ent); brs.push(ent);
} }
} }
app.m_Editor.Prompt(`选择了被切割的板件: 总计${brs.length}`); app.Editor.Prompt(`选择了被切割的板件: 总计${brs.length}`);
//偏移量 //偏移量
let offset: number; let offset: number;
@ -56,8 +56,8 @@ export class ReferenceCutting implements Command
let option = referenceCuttingStore.m_Option; let option = referenceCuttingStore.m_Option;
option.halfThickness = brKnife.Thickness / 2; option.halfThickness = brKnife.Thickness / 2;
option.boardType = brKnife.BoardType; option.boardType = brKnife.BoardType;
app.m_Editor.m_ModalManage.RenderModal(ReferenceCuttingModal, ModalPosition.Center, { store: referenceCuttingStore }); app.Editor.ModalManage.RenderModal(ReferenceCuttingModal, ModalPosition.Center, { store: referenceCuttingStore });
let res = await app.m_Editor.m_ModalManage.Wait(); let res = await app.Editor.ModalManage.Wait();
if (res.Status === ModalState.Ok) if (res.Status === ModalState.Ok)
{ {
@ -87,7 +87,7 @@ export class ReferenceCutting implements Command
if (!equaln(brNorm.dot(brKnifNorm), 0))//垂直测试 if (!equaln(brNorm.dot(brKnifNorm), 0))//垂直测试
{ {
failCount++; failCount++;
app.m_Editor.Prompt('板件不垂直,无法切割!'); app.Editor.Prompt('板件不垂直,无法切割!');
continue; continue;
} }
@ -109,7 +109,7 @@ export class ReferenceCutting implements Command
if (pts1.length < 2 && pts2.length < 2) if (pts1.length < 2 && pts2.length < 2)
{ {
failCount++; failCount++;
app.m_Editor.Prompt("板件与板件没有交集."); app.Editor.Prompt("板件与板件没有交集.");
continue; continue;
} }
@ -132,7 +132,7 @@ export class ReferenceCutting implements Command
cutCus = cutCus.filter(c => brContour.PtInCurve(c.GetPointAtParam(0.5))); cutCus = cutCus.filter(c => brContour.PtInCurve(c.GetPointAtParam(0.5)));
let regionParse = new RegionParse([...brCus, ...cutCus]); let regionParse = new RegionParse([...brCus, ...cutCus]);
let contours = regionParse.m_RegionsInternal.map(r => let contours = regionParse.RegionsInternal.map(r =>
{ {
let pl = new Polyline(); let pl = new Polyline();
for (let route of r) for (let route of r)
@ -144,7 +144,7 @@ export class ReferenceCutting implements Command
if (contours.length === 0) if (contours.length === 0)
{ {
//预期之外. //预期之外.
app.m_Editor.Prompt(`切割中断:第${i}个切割失败了!`); app.Editor.Prompt(`切割中断:第${i}个切割失败了!`);
return; return;
} }
@ -153,10 +153,10 @@ export class ReferenceCutting implements Command
{ {
let br2 = br.Clone(); let br2 = br.Clone();
br2.ContourCurve = contours[i]; br2.ContourCurve = contours[i];
app.m_Database.ModelSpace.Append(br2); app.Database.ModelSpace.Append(br2);
} }
br.ContourCurve = contours[0]; br.ContourCurve = contours[0];
} }
app.m_Editor.Prompt(`切割成功: 有效${brs.length - failCount}个, 无效${failCount}`); app.Editor.Prompt(`切割成功: 有效${brs.length - failCount}个, 无效${failCount}`);
} }
} }

@ -53,8 +53,8 @@ export class ReferenceCuttingStore extends Singleton
} }
_Return(state: number) _Return(state: number)
{ {
app.m_Editor.m_ModalManage.m_PromisRes({ Status: state }); app.Editor.ModalManage.m_PromisRes({ Status: state });
app.m_Editor.m_ModalManage.Clear(); app.Editor.ModalManage.Clear();
} }
HasInvailValue() HasInvailValue()
{ {
@ -95,8 +95,8 @@ export class ReferenceCuttingModal extends React.Component<{ store: ReferenceCut
} }
registerEvent() registerEvent()
{ {
app.m_Editor.m_ModalManage.events.push( app.Editor.ModalManage.events.push(
begin(app.m_Editor.m_ModalManage, app.m_Editor.m_ModalManage.OnKeyDown, (e: KeyboardEvent) => begin(app.Editor.ModalManage, app.Editor.ModalManage.OnKeyDown, (e: KeyboardEvent) =>
{ {
if (e.keyCode === KeyBoard.Enter || e.keyCode === KeyBoard.Space) if (e.keyCode === KeyBoard.Enter || e.keyCode === KeyBoard.Space)
{ {

@ -23,10 +23,10 @@ export class BoardFindModify implements Command
async exec() async exec()
{ {
const store = BoardFindStore.GetInstance() as BoardFindStore; const store = BoardFindStore.GetInstance() as BoardFindStore;
app.m_Editor.m_ModalManage.RenderModeless(BoardFindModifyModal, ModalPosition.Right, { store }); app.Editor.ModalManage.RenderModeless(BoardFindModifyModal, ModalPosition.Right, { store });
app.m_Editor.m_SelectCtrl.Cancel(); app.Editor.SelectCtrl.Cancel();
app.m_Editor.m_ModalManage.Callback = async (res) => app.Editor.ModalManage.Callback = async (res) =>
{ {
switch (res.type) switch (res.type)
{ {
@ -47,22 +47,22 @@ export class BoardFindModify implements Command
default: default:
break; break;
} }
app.m_Editor.m_ModalManage.ToggleShow(); app.Editor.ModalManage.ToggleShow();
if (store.m_Option.isClose) if (store.m_Option.isClose)
{ {
app.m_Editor.m_ModalManage.Clear(); app.Editor.ModalManage.Clear();
app.m_Editor.m_ModalManage.EndCmd(); app.Editor.ModalManage.EndCmd();
} }
else else
{ {
app.m_Editor.m_MaskManage.ShowMask(); app.Editor.MaskManage.ShowMask();
} }
} }
} }
private async GetBoards(otherEnts = []) private async GetBoards(otherEnts = [])
{ {
let enRes = await app.m_Editor.GetSelection({ let enRes = await app.Editor.GetSelection({
Msg: "选择板件", Msg: "选择板件",
Filter: { filterTypes: [Board, ...otherEnts] } Filter: { filterTypes: [Board, ...otherEnts] }
}); });
@ -73,10 +73,10 @@ export class BoardFindModify implements Command
} }
private PutSelectList(brs: Board[]) private PutSelectList(brs: Board[])
{ {
let selectData = new SelectSetBase(app.m_Viewer); let selectData = new SelectSetBase(app.Viewer);
selectData.m_SelectList.push(...brs.map(e => e.DrawObject)); selectData.m_SelectList.push(...brs.map(e => e.DrawObject));
app.m_Editor.m_SelectCtrl.SelectSet.AddSelect(selectData); app.Editor.SelectCtrl.SelectSet.AddSelect(selectData);
app.m_Editor.m_SelectCtrl.UpdateView(); app.Editor.SelectCtrl.UpdateView();
} }
private async FindBrs(option: IBoardFindOption) private async FindBrs(option: IBoardFindOption)
{ {
@ -224,7 +224,7 @@ export class BoardFindModify implements Command
} }
private async ModifyBrs(option: IBoardFindOption) private async ModifyBrs(option: IBoardFindOption)
{ {
let brs = app.m_Editor.m_SelectCtrl.SelectSet.SelectEntityList as Board[]; let brs = app.Editor.SelectCtrl.SelectSet.SelectEntityList as Board[];
if (brs.length === 0) if (brs.length === 0)
brs = await this.GetBoards(); brs = await this.GetBoards();
@ -329,7 +329,7 @@ export class BoardFindModify implements Command
} }
private async GetBoardOption(option: IBoardFindOption, data: { key: string, content: string }) private async GetBoardOption(option: IBoardFindOption, data: { key: string, content: string })
{ {
let brRes = await app.m_Editor.GetEntity({ let brRes = await app.Editor.GetEntity({
Msg: data.content, Msg: data.content,
Filter: { filterTypes: [Board] } Filter: { filterTypes: [Board] }
}); });

@ -19,7 +19,7 @@ function RegionsBoolOperate(regs: Region[], boolType: BoolOpeartionType): Region
async function SelectRegions(): Promise<Region[]> async function SelectRegions(): Promise<Region[]>
{ {
let enRes = await app.m_Editor.GetSelection({ let enRes = await app.Editor.GetSelection({
Msg: "选择面域" Msg: "选择面域"
}); });
if (enRes.Status === PromptStatus.OK) if (enRes.Status === PromptStatus.OK)

@ -8,7 +8,7 @@ export class Command_Break implements Command
{ {
async exec() async exec()
{ {
let cuRes = await app.m_Editor.GetEntity({ let cuRes = await app.Editor.GetEntity({
Msg: "请选择被打断的曲线:" Msg: "请选择被打断的曲线:"
}); });
if (cuRes.Status !== PromptStatus.OK) if (cuRes.Status !== PromptStatus.OK)
@ -21,8 +21,8 @@ export class Command_Break implements Command
while (true) while (true)
{ {
app.m_Database.hm.StartMark(); app.Database.hm.StartMark();
let ptRes = await app.m_Editor.GetPoint({ let ptRes = await app.Editor.GetPoint({
Msg: "请点击被打断的点:" Msg: "请点击被打断的点:"
, KeyWordList: breakPts.length === 0 ? [{ key: "D", msg: "定距等分" }, { key: "S", msg: "定数等分" }] : [] , KeyWordList: breakPts.length === 0 ? [{ key: "D", msg: "定距等分" }, { key: "S", msg: "定数等分" }] : []
}); });
@ -37,13 +37,13 @@ export class Command_Break implements Command
{ {
if (ptRes.StringResult === "D") if (ptRes.StringResult === "D")
{ {
let divRes = await app.m_Editor.GetDistance({ Msg: "请输入等分距离:" }); let divRes = await app.Editor.GetDistance({ Msg: "请输入等分距离:" });
if (divRes.Status !== PromptStatus.OK) if (divRes.Status !== PromptStatus.OK)
return; return;
if (divRes.Distance === 0) if (divRes.Distance === 0)
{ {
app.m_Editor.Prompt("距离不能为0!"); app.Editor.Prompt("距离不能为0!");
continue; continue;
} }
let lenDiv = cu.Length / divRes.Distance; let lenDiv = cu.Length / divRes.Distance;
@ -52,13 +52,13 @@ export class Command_Break implements Command
} }
else if (ptRes.StringResult === "S") else if (ptRes.StringResult === "S")
{ {
let divRes = await app.m_Editor.GetDistance({ Msg: "请输入等分个数:" }); let divRes = await app.Editor.GetDistance({ Msg: "请输入等分个数:" });
if (divRes.Status !== PromptStatus.OK) if (divRes.Status !== PromptStatus.OK)
return; return;
if (divRes.Distance === 0) if (divRes.Distance === 0)
{ {
app.m_Editor.Prompt("个数不能为0!"); app.Editor.Prompt("个数不能为0!");
return; return;
} }
let divCount = cu.Length / divRes.Distance; let divCount = cu.Length / divRes.Distance;
@ -67,7 +67,7 @@ export class Command_Break implements Command
} }
else else
{ {
app.m_Editor.Prompt("未知输入!"); app.Editor.Prompt("未知输入!");
continue; continue;
} }
@ -83,7 +83,7 @@ export class Command_Break implements Command
cu.Erase(); cu.Erase();
cus.forEach(c => cus.forEach(c =>
{ {
app.m_Database.ModelSpace.Append(c); app.Database.ModelSpace.Append(c);
}); });
} }
} }

@ -10,7 +10,7 @@ export class ChangeColor implements Command
} }
async exec() async exec()
{ {
let enRes = await app.m_Editor.GetSelection({ let enRes = await app.Editor.GetSelection({
Msg: '选择对象', Msg: '选择对象',
UseSelect: true UseSelect: true
}); });

@ -12,7 +12,7 @@ export class FeedingCommand implements Command
{ {
async exec() async exec()
{ {
let brRes = await app.m_Editor.GetSelection({ let brRes = await app.Editor.GetSelection({
Msg: "选择板件", Msg: "选择板件",
UseSelect: true, UseSelect: true,
Filter: { filterTypes: [Board] } Filter: { filterTypes: [Board] }
@ -29,7 +29,7 @@ export class FeedingCommand implements Command
let retCus = brs.map(br => feedingTool.TestCalcPath(br)); let retCus = brs.map(br => feedingTool.TestCalcPath(br));
let ptRes = await app.m_Editor.GetPoint({ Msg: "点取位置" }); let ptRes = await app.Editor.GetPoint({ Msg: "点取位置" });
if (ptRes.Status === PromptStatus.OK) if (ptRes.Status === PromptStatus.OK)
{ {
@ -45,8 +45,8 @@ export class FeedingCommand implements Command
for (let cu of cus) for (let cu of cus)
{ {
cu.ApplyMatrix(MoveMatrix(pos)); cu.ApplyMatrix(MoveMatrix(pos));
app.m_Database.ModelSpace.Append(cu); app.Database.ModelSpace.Append(cu);
app.m_Database.ModelSpace.Append(new Point(cu.StartPoint)); app.Database.ModelSpace.Append(new Point(cu.StartPoint));
} }
} }
} }

@ -7,7 +7,7 @@ export class Command_CommandPanel implements Command
{ {
async exec() async exec()
{ {
let store = app.m_Editor.m_CommandStore; let store = app.Editor.CommandStore;
app.m_Editor.m_ModalManage.RenderModal(CommandPanel, ModalPosition.Top, { store }); app.Editor.ModalManage.RenderModal(CommandPanel, ModalPosition.Top, { store });
} }
} }

@ -8,6 +8,6 @@ export class Command_Options implements Command
async exec() async exec()
{ {
let OptionStore = OptionModalStore.GetInstance() as OptionModalStore; let OptionStore = OptionModalStore.GetInstance() as OptionModalStore;
app.m_Editor.m_ModalManage.RenderModal(OptionModal, ModalPosition.Center, { store: OptionStore }); app.Editor.ModalManage.RenderModal(OptionModal, ModalPosition.Center, { store: OptionStore });
} }
} }

@ -13,11 +13,11 @@ export class Command_Copy implements Command
{ {
async exec() async exec()
{ {
let ssRes = await app.m_Editor.GetSelection({ Msg: "请选择需要拷贝的实体:", UseSelect: true }); let ssRes = await app.Editor.GetSelection({ Msg: "请选择需要拷贝的实体:", UseSelect: true });
if (ssRes.Status !== PromptStatus.OK) if (ssRes.Status !== PromptStatus.OK)
return; return;
let ptRes = await app.m_Editor.GetPoint({ Msg: "请选择复制基点:" }); let ptRes = await app.Editor.GetPoint({ Msg: "请选择复制基点:" });
if (ptRes.Status !== PromptStatus.OK) if (ptRes.Status !== PromptStatus.OK)
return; return;
@ -37,8 +37,8 @@ export class Command_Copy implements Command
let jigEns = orgEns.map(e => JigUtils.Draw(e)); let jigEns = orgEns.map(e => JigUtils.Draw(e));
while (true) while (true)
{ {
app.m_Database.hm.StartMark(); app.Database.hm.StartMark();
let ptRes2 = await app.m_Editor.GetPoint({ let ptRes2 = await app.Editor.GetPoint({
Msg: "请选择复制终点:", Msg: "请选择复制终点:",
Callback: (p) => Callback: (p) =>
{ {
@ -53,7 +53,7 @@ export class Command_Copy implements Command
if (ptRes2.Status === PromptStatus.OK) if (ptRes2.Status === PromptStatus.OK)
{ {
let moveM = MoveMatrix(ptRes2.Point.sub(ptBase)); let moveM = MoveMatrix(ptRes2.Point.sub(ptBase));
let cloneEns = app.m_Database.DeepCloneObjects(orgEns, app.m_Database.ModelSpace) as Entity[]; let cloneEns = app.Database.DeepCloneObjects(orgEns, app.Database.ModelSpace) as Entity[];
for (let en of cloneEns) for (let en of cloneEns)
{ {

@ -9,7 +9,7 @@ export class CopyClip
{ {
async exec() async exec()
{ {
let ss = app.m_Editor.m_SelectCtrl.SelectSet; let ss = app.Editor.SelectCtrl.SelectSet;
if (ss.SelectEntityList.length === 0) return; if (ss.SelectEntityList.length === 0) return;
let ens = ss.SelectEntityList; let ens = ss.SelectEntityList;
@ -21,7 +21,7 @@ export class CopyClip
ens.forEach(e => f.WriteObject(e)); ens.forEach(e => f.WriteObject(e));
copyTextToClipboard(JSON.stringify({ copyTextToClipboard(JSON.stringify({
file: f.Data, file: f.Data,
basePt: app.m_Editor.m_MouseCtrl.m_CurMousePointWCS, basePt: app.Editor.MouseCtrl.m_CurMousePointWCS,
})); }));
} }
} }

@ -6,7 +6,7 @@ export class Command_CopyPoint
{ {
async exec() async exec()
{ {
let ptRes = await app.m_Editor.GetPoint(); let ptRes = await app.Editor.GetPoint();
if (ptRes.Status === PromptStatus.OK) if (ptRes.Status === PromptStatus.OK)
copyTextToClipboard(`new Vector3().fromArray(${JSON.stringify(ptRes.Point.toArray())});`); copyTextToClipboard(`new Vector3().fromArray(${JSON.stringify(ptRes.Point.toArray())});`);

@ -8,7 +8,7 @@ export class CustomUcs implements Command
{ {
async exec() async exec()
{ {
let p1Res = await app.m_Editor.GetPoint( let p1Res = await app.Editor.GetPoint(
{ {
Msg: "请点击坐标原点或", Msg: "请点击坐标原点或",
KeyWordList: [{ key: "W", msg: "世界" }] KeyWordList: [{ key: "W", msg: "世界" }]
@ -18,30 +18,30 @@ export class CustomUcs implements Command
{ {
if (p1Res.StringResult === "W") if (p1Res.StringResult === "W")
{ {
app.m_Editor.UCSMatrix = new Matrix4(); app.Editor.UCSMatrix = new Matrix4();
} }
} }
if (p1Res.Status != PromptStatus.OK) return; if (p1Res.Status != PromptStatus.OK) return;
let mat = app.m_Editor.UCSMatrix; let mat = app.Editor.UCSMatrix;
let oldMat = mat.clone(); let oldMat = mat.clone();
mat.setPosition(p1Res.Point); mat.setPosition(p1Res.Point);
app.m_Editor.UCSMatrix = mat; app.Editor.UCSMatrix = mat;
let xv: Vector3, yv: Vector3, zv: Vector3; let xv: Vector3, yv: Vector3, zv: Vector3;
while (true) while (true)
{ {
let xRes = await app.m_Editor.GetPoint({ Msg: "请点击X轴方向:", BasePoint: p1Res.Point, AllowDrawRubberBand: true }); let xRes = await app.Editor.GetPoint({ Msg: "请点击X轴方向:", BasePoint: p1Res.Point, AllowDrawRubberBand: true });
if (xRes.Status !== PromptStatus.OK) if (xRes.Status !== PromptStatus.OK)
{ {
app.m_Editor.UCSMatrix = oldMat; app.Editor.UCSMatrix = oldMat;
return; return;
} }
else else
{ {
if (equalv3(xRes.Point, p1Res.Point)) if (equalv3(xRes.Point, p1Res.Point))
{ {
app.m_Editor.Prompt("与第一个点重复!"); app.Editor.Prompt("与第一个点重复!");
} }
else else
{ {
@ -57,7 +57,7 @@ export class CustomUcs implements Command
while (true) while (true)
{ {
let yRes = await app.m_Editor.GetPoint({ let yRes = await app.Editor.GetPoint({
Msg: "XY轴平面上的点(接受):", Msg: "XY轴平面上的点(接受):",
BasePoint: p1Res.Point, BasePoint: p1Res.Point,
AllowDrawRubberBand: true, AllowDrawRubberBand: true,
@ -68,7 +68,7 @@ export class CustomUcs implements Command
else if (yRes.Status === PromptStatus.OK) else if (yRes.Status === PromptStatus.OK)
{ {
if (equalv3(yRes.Point, p1Res.Point)) if (equalv3(yRes.Point, p1Res.Point))
app.m_Editor.Prompt("与第一个点重复!"); app.Editor.Prompt("与第一个点重复!");
else else
{ {
yv = yRes.Point.sub(p1Res.Point).normalize(); yv = yRes.Point.sub(p1Res.Point).normalize();
@ -80,7 +80,7 @@ export class CustomUcs implements Command
} }
else else
{ {
app.m_Editor.UCSMatrix = oldMat; app.Editor.UCSMatrix = oldMat;
return; return;
} }
} }
@ -90,6 +90,6 @@ export class CustomUcs implements Command
{ {
mat.makeBasis(xv.normalize(), yv.normalize(), zv.normalize()); mat.makeBasis(xv.normalize(), yv.normalize(), zv.normalize());
mat.setPosition(p1Res.Value); mat.setPosition(p1Res.Value);
app.m_Editor.UCSMatrix = mat; app.Editor.UCSMatrix = mat;
} }
} }

@ -29,7 +29,7 @@ export async function CreateBoardFromData(data: Object)
br.material = boardMaterial; br.material = boardMaterial;
br.castShadow = true; br.castShadow = true;
br.receiveShadow = true; br.receiveShadow = true;
app.m_Viewer.Scene.add(board); app.Viewer.Scene.add(board);
} }
//加载fbx文件 //加载fbx文件
@ -51,10 +51,10 @@ export async function CreateBoardFromData(data: Object)
{ {
let meshC = mesh.clone(); let meshC = mesh.clone();
meshC.applyMatrix(fbxState.object.matrix); meshC.applyMatrix(fbxState.object.matrix);
app.m_Viewer.Scene.add(meshC); app.Viewer.Scene.add(meshC);
} }
} }
} }
app.m_Viewer.m_bNeedUpdate = true; app.Viewer.UpdateRender();
} }

@ -38,24 +38,24 @@ export class Command_DXFImport
}; };
}); });
pl.CloseMark = en.shape; pl.CloseMark = en.shape;
app.m_Database.ModelSpace.Append(pl); app.Database.ModelSpace.Append(pl);
} }
else if (en.type === "ARC") else if (en.type === "ARC")
{ {
let arc = new Arc(AsVector3(en.center), en.radius, en.startAngle, en.endAngle, false); let arc = new Arc(AsVector3(en.center), en.radius, en.startAngle, en.endAngle, false);
app.m_Database.ModelSpace.Append(arc); app.Database.ModelSpace.Append(arc);
} }
else if (en.type === "CIRCLE") else if (en.type === "CIRCLE")
{ {
let cir = new Circle(AsVector3(en.center), en.radius); let cir = new Circle(AsVector3(en.center), en.radius);
app.m_Database.ModelSpace.Append(cir); app.Database.ModelSpace.Append(cir);
} }
else if (en.type === "LINE") else if (en.type === "LINE")
{ {
if (!(en.vertices.length === 2)) if (!(en.vertices.length === 2))
return; return;
let line = new Line(AsVector3(en.vertices[0]), AsVector3(en.vertices[1])); let line = new Line(AsVector3(en.vertices[0]), AsVector3(en.vertices[1]));
app.m_Database.ModelSpace.Append(line); app.Database.ModelSpace.Append(line);
} }
} }
} }

@ -8,7 +8,7 @@ export class CMD_Divide implements Command
{ {
async exec() async exec()
{ {
let enRes = await app.m_Editor.GetEntity( let enRes = await app.Editor.GetEntity(
{ {
Msg: "请选择定数等分的对象", Msg: "请选择定数等分的对象",
KeyWordList: [{ key: "D", msg: "定数等分" }, { key: "S", msg: "定距等分" }] KeyWordList: [{ key: "D", msg: "定数等分" }, { key: "S", msg: "定距等分" }]
@ -43,14 +43,14 @@ export class CMD_Divide implements Command
async Divided(enRes: PromptEntityResult)//定数等分 async Divided(enRes: PromptEntityResult)//定数等分
{ {
let numRes = await app.m_Editor.GetDistance({ Msg: "请输入段数" }); let numRes = await app.Editor.GetDistance({ Msg: "请输入段数" });
if (numRes.Status != PromptStatus.OK) if (numRes.Status != PromptStatus.OK)
return; return;
let divCount = numRes.Distance; let divCount = numRes.Distance;
if (divCount === 0) if (divCount === 0)
{ {
app.m_Editor.Prompt("您不能等分0"); app.Editor.Prompt("您不能等分0");
return; return;
} }
if (enRes.Entity instanceof Curve) if (enRes.Entity instanceof Curve)
@ -66,19 +66,19 @@ export class CMD_Divide implements Command
{ {
let pt = cu.GetPointAtDistance(divLen * (i + 1)); let pt = cu.GetPointAtDistance(divLen * (i + 1));
let ptEnt = new Point(pt); let ptEnt = new Point(pt);
app.m_Database.ModelSpace.Append(ptEnt); app.Database.ModelSpace.Append(ptEnt);
} }
} }
} }
async Measured()//定距等分 async Measured()//定距等分
{ {
let enRes = await app.m_Editor.GetEntity({ Msg: "请选择定距等分的对象" }); let enRes = await app.Editor.GetEntity({ Msg: "请选择定距等分的对象" });
let numRes = await app.m_Editor.GetDistance({ Msg: "请指定分段的长度" }); let numRes = await app.Editor.GetDistance({ Msg: "请指定分段的长度" });
let divLen = numRes.Distance; let divLen = numRes.Distance;
if (divLen === 0) if (divLen === 0)
{ {
app.m_Editor.Prompt("分段长度不能为0"); app.Editor.Prompt("分段长度不能为0");
return; return;
} }
if (enRes.Entity instanceof Curve) if (enRes.Entity instanceof Curve)
@ -87,7 +87,7 @@ export class CMD_Divide implements Command
let len = cu.Length; let len = cu.Length;
if (divLen > len) if (divLen > len)
{ {
app.m_Editor.Prompt("分段长度不能超过对象长度"); app.Editor.Prompt("分段长度不能超过对象长度");
return; return;
} }
let divCount = len / divLen; let divCount = len / divLen;
@ -95,7 +95,7 @@ export class CMD_Divide implements Command
{ {
let pt = cu.GetPointAtDistance(divLen * (i + 1)); let pt = cu.GetPointAtDistance(divLen * (i + 1));
let ptEnt = new Point(pt); let ptEnt = new Point(pt);
app.m_Database.ModelSpace.Append(ptEnt); app.Database.ModelSpace.Append(ptEnt);
} }
} }
} }

@ -9,17 +9,17 @@ export class DrawArc implements Command
{ {
async exec() async exec()
{ {
let ptRes = await app.m_Editor.GetPoint({ Msg: "请输入第一个点:" }); let ptRes = await app.Editor.GetPoint({ Msg: "请输入第一个点:" });
if (ptRes.Status != PromptStatus.OK) if (ptRes.Status != PromptStatus.OK)
return; return;
let pt1 = ptRes.Point; let pt1 = ptRes.Point;
let ptRes2 = await app.m_Editor.GetPoint({ Msg: "请输入第二个点:", BasePoint: pt1, AllowDrawRubberBand: true }); let ptRes2 = await app.Editor.GetPoint({ Msg: "请输入第二个点:", BasePoint: pt1, AllowDrawRubberBand: true });
if (ptRes2.Status != PromptStatus.OK) if (ptRes2.Status != PromptStatus.OK)
return; return;
let pt2 = ptRes2.Point; let pt2 = ptRes2.Point;
let arc = new Arc(); let arc = new Arc();
arc.ApplyMatrix(app.m_Editor.UCSMatrix); arc.ApplyMatrix(app.Editor.UCSMatrix);
const updateArc = (p) => const updateArc = (p) =>
{ {
@ -31,7 +31,7 @@ export class DrawArc implements Command
} }
JigUtils.Draw(arc); JigUtils.Draw(arc);
let ptRes3 = await app.m_Editor.GetPoint({ let ptRes3 = await app.Editor.GetPoint({
Msg: "请输入第三个点:", Msg: "请输入第三个点:",
Callback: updateArc Callback: updateArc
}); });
@ -39,7 +39,7 @@ export class DrawArc implements Command
if (ptRes3.Status === PromptStatus.OK) if (ptRes3.Status === PromptStatus.OK)
{ {
updateArc(ptRes3.Point); updateArc(ptRes3.Point);
app.m_Database.ModelSpace.Append(arc); app.Database.ModelSpace.Append(arc);
} }
JigUtils.End(); JigUtils.End();
} }

@ -87,7 +87,7 @@ export class DrawBehindBoard extends DrawBoardTool
))); )));
b.ApplyMatrix(spaceOcs); b.ApplyMatrix(spaceOcs);
app.m_Database.ModelSpace.Append(b); app.Database.ModelSpace.Append(b);
} }
} }
} }

@ -32,12 +32,12 @@ export abstract class DrawBoardTool implements Command
this.store = BehindBoardStore.GetInstance(); this.store = BehindBoardStore.GetInstance();
this.modalType = BoardModalType.Be; this.modalType = BoardModalType.Be;
} }
app.m_Editor.m_ModalManage.RenderModeless( app.Editor.ModalManage.RenderModeless(
BoardModal, BoardModal,
ModalPosition.Center, ModalPosition.Center,
{ store: this.store, type: this.modalType }); { store: this.store, type: this.modalType });
app.m_Editor.m_ModalManage.Callback = async () => app.Editor.ModalManage.Callback = async () =>
{ {
await this.SelectAndBuildBoard(); await this.SelectAndBuildBoard();
} }
@ -45,8 +45,8 @@ export abstract class DrawBoardTool implements Command
private async SelectAndBuildBoard() private async SelectAndBuildBoard()
{ {
//原来禁用捕捉开启状态 //原来禁用捕捉开启状态
let oldSnapState = app.m_Editor.GetPointServices.snapServices.Disabled; let oldSnapState = app.Editor.GetPointServices.snapServices.Disabled;
app.m_Editor.GetPointServices.snapServices.Disabled = true; app.Editor.GetPointServices.snapServices.Disabled = true;
while (true) while (true)
{ {
@ -55,7 +55,7 @@ export abstract class DrawBoardTool implements Command
if (selectSpace.GetPointRes.Status === PromptStatus.None) if (selectSpace.GetPointRes.Status === PromptStatus.None)
{ {
app.m_Editor.m_ModalManage.RenderModeless( app.Editor.ModalManage.RenderModeless(
BoardModal, BoardModal,
ModalPosition.Old, ModalPosition.Old,
{ store: this.store, type: this.modalType }); { store: this.store, type: this.modalType });
@ -71,13 +71,13 @@ export abstract class DrawBoardTool implements Command
this.buildBoard(); this.buildBoard();
app.m_Editor.UpdateScreen(); app.Editor.UpdateScreen();
if (!userConfig.isContinuousDraw) if (!userConfig.isContinuousDraw)
break; break;
} }
//恢复原先状态 //恢复原先状态
app.m_Editor.GetPointServices.snapServices.Disabled = oldSnapState; app.Editor.GetPointServices.snapServices.Disabled = oldSnapState;
} }
//构建板件 //构建板件

@ -19,7 +19,7 @@ export class DrawClosingStrip implements Command
private store: ClosingStripStore; private store: ClosingStripStore;
async exec() async exec()
{ {
let exSsRes = await app.m_Editor.GetSelection({ Msg: "请选择对象<全部选择>:", UseSelect: true, Filter: { filterTypes: [Board] } }); let exSsRes = await app.Editor.GetSelection({ Msg: "请选择对象<全部选择>:", UseSelect: true, Filter: { filterTypes: [Board] } });
if (exSsRes.Status === PromptStatus.Cancel) if (exSsRes.Status === PromptStatus.Cancel)
return; return;
@ -28,7 +28,7 @@ export class DrawClosingStrip implements Command
if (boards.length > 0) if (boards.length > 0)
{ {
this.store = ClosingStripStore.GetInstance(); this.store = ClosingStripStore.GetInstance();
app.m_Editor.m_ModalManage.RenderModeless(BoardModal, ModalPosition.Center, { store: this.store, type: BoardModalType.Skt }); app.Editor.ModalManage.RenderModeless(BoardModal, ModalPosition.Center, { store: this.store, type: BoardModalType.Skt });
let useOptionCallback = begin(this.store, this.store.UpdateOption, (cof) => let useOptionCallback = begin(this.store, this.store.UpdateOption, (cof) =>
{ {
@ -44,7 +44,7 @@ export class DrawClosingStrip implements Command
useOptionCallback(); useOptionCallback();
useOptionCallback = null; useOptionCallback = null;
}) })
let res = await app.m_Editor.m_ModalManage.Wait(); let res = await app.Editor.ModalManage.Wait();
if (res.Status !== ModalState.Ok) return; if (res.Status !== ModalState.Ok) return;
@ -58,7 +58,7 @@ export class DrawClosingStrip implements Command
message: "收口条已绘制", message: "收口条已绘制",
timeout: 1000 timeout: 1000
}); });
res = await app.m_Editor.m_ModalManage.Wait(); res = await app.Editor.ModalManage.Wait();
if (res.Status !== ModalState.Ok) if (res.Status !== ModalState.Ok)
break; break;
} }
@ -157,9 +157,9 @@ export class DrawClosingStrip implements Command
//收口条颜色 //收口条颜色
b.ColorIndex = 4; b.ColorIndex = 4;
b.ApplyMatrix(rot); b.ApplyMatrix(rot);
app.m_Database.ModelSpace.Append(b); app.Database.ModelSpace.Append(b);
} }
app.m_Editor.UpdateScreen(); app.Editor.UpdateScreen();
} }
} }

@ -33,8 +33,8 @@ export class DrawDoor implements Command
store.totalDepth = parseFloat(ToFixed(size.y, 2)); store.totalDepth = parseFloat(ToFixed(size.y, 2));
store.m_Option.depth = store.totalDepth; store.m_Option.depth = store.totalDepth;
app.m_Editor.m_ModalManage.RenderModal(DoorModal, ModalPosition.Center, { store }); app.Editor.ModalManage.RenderModal(DoorModal, ModalPosition.Center, { store });
let res = await app.m_Editor.m_ModalManage.Wait(); let res = await app.Editor.ModalManage.Wait();
if (res.Status === ModalState.Ok) if (res.Status === ModalState.Ok)
{ {
@ -129,7 +129,7 @@ export class DrawDoor implements Command
for (let br of brs) for (let br of brs)
{ {
br.ApplyMatrix(spaceParse.m_SpaceOCS); br.ApplyMatrix(spaceParse.m_SpaceOCS);
app.m_Database.ModelSpace.Append(br); app.Database.ModelSpace.Append(br);
} }
} }
} }

@ -25,8 +25,8 @@ export class DrawDrawrer implements Command
store.totalDepth = parseFloat(FixedNotZero(size.y, 2)); store.totalDepth = parseFloat(FixedNotZero(size.y, 2));
store.m_Option.depth = store.totalDepth; store.m_Option.depth = store.totalDepth;
app.m_Editor.m_ModalManage.RenderModal(DoorModal, ModalPosition.Center, { store }); app.Editor.ModalManage.RenderModal(DoorModal, ModalPosition.Center, { store });
let res = await app.m_Editor.m_ModalManage.Wait(); let res = await app.Editor.ModalManage.Wait();
if (res.Status === ModalState.Ok) if (res.Status === ModalState.Ok)
{ {

@ -86,7 +86,7 @@ export class DrawLayerBoard extends DrawBoardTool
b.ApplyMatrix(spaceOCS); b.ApplyMatrix(spaceOCS);
//绘制层板钉 //绘制层板钉
this.buildLayerNail(b); this.buildLayerNail(b);
app.m_Database.ModelSpace.Append(b); app.Database.ModelSpace.Append(b);
} }
} }
//初始化层板钉 //初始化层板钉
@ -284,7 +284,7 @@ export class DrawLayerBoard extends DrawBoardTool
for (let nailProps of buildNails) for (let nailProps of buildNails)
{ {
nailProps.nail.ApplyMatrix(br.OCS); nailProps.nail.ApplyMatrix(br.OCS);
app.m_Database.ModelSpace.Append(nailProps.nail); app.Database.ModelSpace.Append(nailProps.nail);
nailIDs.push(nailProps.nail.Id); nailIDs.push(nailProps.nail.Id);
if (nailProps.pos === NailPos.Left) if (nailProps.pos === NailPos.Left)

@ -15,9 +15,9 @@ export class DrawLeftRight implements Command
{ {
let store = SideBoardStore.GetInstance(); let store = SideBoardStore.GetInstance();
app.m_Editor.m_ModalManage.RenderModeless(BoardModal, ModalPosition.Center, { store, type: BoardModalType.LR }); app.Editor.ModalManage.RenderModeless(BoardModal, ModalPosition.Center, { store, type: BoardModalType.LR });
app.m_Editor.m_ModalManage.Callback = async () => app.Editor.ModalManage.Callback = async () =>
{ {
let data = store.m_Option; let data = store.m_Option;
let lenght = data.height; let lenght = data.height;
@ -29,7 +29,7 @@ export class DrawLeftRight implements Command
let rightBoard = JigUtils.Draw(Board.CreateBoard(lenght, width, thickness, BoardType.Vertical)); let rightBoard = JigUtils.Draw(Board.CreateBoard(lenght, width, thickness, BoardType.Vertical));
rightBoard.ApplyMatrix(MoveMatrix(new Vector3(spacing - thickness))); rightBoard.ApplyMatrix(MoveMatrix(new Vector3(spacing - thickness)));
let ptRes = await app.m_Editor.GetPoint({ let ptRes = await app.Editor.GetPoint({
Msg: "请拾取基点:", Msg: "请拾取基点:",
Callback: (v) => Callback: (v) =>
{ {
@ -51,8 +51,8 @@ export class DrawLeftRight implements Command
rightBoard.Name = "右侧板" rightBoard.Name = "右侧板"
rightBoard.BoardProcessOption = store.BoardProcessOption; rightBoard.BoardProcessOption = store.BoardProcessOption;
app.m_Database.ModelSpace.Append(leftBoard); app.Database.ModelSpace.Append(leftBoard);
app.m_Database.ModelSpace.Append(rightBoard); app.Database.ModelSpace.Append(rightBoard);
} }
JigUtils.End(); JigUtils.End();

@ -14,9 +14,9 @@ export class DrawSingleBoard implements Command
async exec() async exec()
{ {
let store = SingleBoardStore.GetInstance(); let store = SingleBoardStore.GetInstance();
app.m_Editor.m_ModalManage.RenderModeless(BoardModal, ModalPosition.Center, { store, type: BoardModalType.Sg }); app.Editor.ModalManage.RenderModeless(BoardModal, ModalPosition.Center, { store, type: BoardModalType.Sg });
app.m_Editor.m_ModalManage.Callback = async () => app.Editor.ModalManage.Callback = async () =>
{ {
const opt = store.m_Option; const opt = store.m_Option;
let board = JigUtils.Draw(Board.CreateBoard(opt.height, opt.width, opt.thickness, opt.type)); let board = JigUtils.Draw(Board.CreateBoard(opt.height, opt.width, opt.thickness, opt.type));
@ -28,7 +28,7 @@ export class DrawSingleBoard implements Command
board.RotateBoard(rx, ry, rz); board.RotateBoard(rx, ry, rz);
let ptRes = await app.m_Editor.GetPoint({ let ptRes = await app.Editor.GetPoint({
Msg: "选择基点", Msg: "选择基点",
Callback: v => Callback: v =>
{ {
@ -41,7 +41,7 @@ export class DrawSingleBoard implements Command
{ {
let vec = ptRes.Point.sub(board.MinPoint); let vec = ptRes.Point.sub(board.MinPoint);
board.ApplyMatrix(MoveMatrix(vec)); board.ApplyMatrix(MoveMatrix(vec));
app.m_Database.ModelSpace.Append(board); app.Database.ModelSpace.Append(board);
} }
JigUtils.End(); JigUtils.End();

@ -23,7 +23,7 @@ export async function selectOutlinePosition(cus: Curve[] | Curve)
else else
moveCus = cus; moveCus = cus;
let ptRes = await app.m_Editor.GetPoint({ let ptRes = await app.Editor.GetPoint({
Msg: "点取位置", Msg: "点取位置",
Callback: v => Callback: v =>
{ {
@ -33,7 +33,7 @@ export async function selectOutlinePosition(cus: Curve[] | Curve)
}); });
if (ptRes.Status === PromptStatus.OK) if (ptRes.Status === PromptStatus.OK)
moveCus.forEach(cu => app.m_Database.ModelSpace.Append(cu)); moveCus.forEach(cu => app.Database.ModelSpace.Append(cu));
JigUtils.End(); JigUtils.End();
} }
@ -55,7 +55,7 @@ export function BoardApplyContour(contour: ExtureContour, brs: Board[], isKeepSi
br.Width = oldWidth; br.Width = oldWidth;
} }
} }
app.m_Editor.UpdateScreen(); app.Editor.UpdateScreen();
} }
@ -72,7 +72,7 @@ export async function SelectExtrudeContour(selectInside = false, useExtrude = fa
let Msg = useExtrude ? "请选择(拉伸实体,面域或曲线):" : "请选择(面域或曲线):"; let Msg = useExtrude ? "请选择(拉伸实体,面域或曲线):" : "请选择(面域或曲线):";
let filterTypes = useExtrude ? [Region, ExtureSolid, Curve] : [Region, Curve]; let filterTypes = useExtrude ? [Region, ExtureSolid, Curve] : [Region, Curve];
let ssRes = await app.m_Editor.GetSelection({ let ssRes = await app.Editor.GetSelection({
Msg, Msg,
Filter: { filterTypes }, Filter: { filterTypes },
Once: true Once: true
@ -87,7 +87,7 @@ export async function SelectExtrudeContour(selectInside = false, useExtrude = fa
{ {
if (selectInside || !en.IsClose) if (selectInside || !en.IsClose)
{ {
let cus = app.m_Viewer.VisibleEntitys.filter(e => e instanceof Curve) as Curve[]; let cus = app.Viewer.VisibleEntitys.filter(e => e instanceof Curve) as Curve[];
let cuGroups = curveLinkGroup(cus); let cuGroups = curveLinkGroup(cus);
@ -148,9 +148,9 @@ export function ExtrudeApplyContour(ext: ExtureSolid, contour: ExtureContour): M
applyMatrix = ext.OCSInv; applyMatrix = ext.OCSInv;
else if (isParallelTo( else if (isParallelTo(
contour.Normal, contour.Normal,
new Vector3().setFromMatrixColumn(app.m_Editor.UCSMatrix, 2) new Vector3().setFromMatrixColumn(app.Editor.UCSMatrix, 2)
)) ))
applyMatrix = app.m_Editor.UCSMatrixInv; applyMatrix = app.Editor.UCSMatrixInv;
else else
applyMatrix = contour.OCSInv; applyMatrix = contour.OCSInv;

@ -25,9 +25,9 @@ export class DrawSpecialShapedBoard implements Command
store.m_Option.height = parseFloat(FixedNotZero(this.ext.Height, 2)); store.m_Option.height = parseFloat(FixedNotZero(this.ext.Height, 2));
store.m_Option.width = parseFloat(FixedNotZero(this.ext.Width, 2)); store.m_Option.width = parseFloat(FixedNotZero(this.ext.Width, 2));
app.m_Editor.m_ModalManage.RenderModeless(SpecialShapeBoardModal, ModalPosition.Center, { store }); app.Editor.ModalManage.RenderModeless(SpecialShapeBoardModal, ModalPosition.Center, { store });
app.m_Editor.m_ModalManage.Callback = async () => app.Editor.ModalManage.Callback = async () =>
{ {
let br = new Board(); let br = new Board();
br.BoardType = store.m_Option.type; br.BoardType = store.m_Option.type;
@ -61,7 +61,7 @@ export class DrawSpecialShapedBoard implements Command
} }
br.ApplyMatrix(toCurve); br.ApplyMatrix(toCurve);
ExtrudeApplyContour(br, contour); ExtrudeApplyContour(br, contour);
app.m_Database.ModelSpace.Append(br); app.Database.ModelSpace.Append(br);
//删除被应用的轮廓 //删除被应用的轮廓
if (useCurves) if (useCurves)
@ -70,6 +70,6 @@ export class DrawSpecialShapedBoard implements Command
} }
} }
else else
app.m_Editor.Prompt('选择对象无效') app.Editor.Prompt('选择对象无效')
} }
} }

@ -8,7 +8,7 @@ export class DrawSpecialShapedBoardByContour implements Command
{ {
async exec() async exec()
{ {
let brRes = await app.m_Editor.GetSelection({ let brRes = await app.Editor.GetSelection({
Msg: "请选择应用异形轮廓的板件", Msg: "请选择应用异形轮廓的板件",
Filter: { filterTypes: [Board] } Filter: { filterTypes: [Board] }
}) })
@ -24,7 +24,7 @@ export class DrawSpecialShapedBoardByContour implements Command
return; return;
} }
let keyWord = await app.m_Editor.GetKeyWords({ let keyWord = await app.Editor.GetKeyWords({
Msg: "不改变板件大小:", Msg: "不改变板件大小:",
KeyWordList: [{ key: "Y", msg: "是" }, { key: "N", msg: "否" }] KeyWordList: [{ key: "Y", msg: "是" }, { key: "N", msg: "否" }]
}); });

@ -18,9 +18,9 @@ export class DrawTopBottomBoard implements Command
async exec() async exec()
{ {
this.store = TopBottomBoardStore.GetInstance(); this.store = TopBottomBoardStore.GetInstance();
app.m_Editor.m_ModalManage.RenderModal(BoardModal, ModalPosition.Center, { store: this.store, type: BoardModalType.TB }); app.Editor.ModalManage.RenderModal(BoardModal, ModalPosition.Center, { store: this.store, type: BoardModalType.TB });
let res = await app.m_Editor.m_ModalManage.Wait(); let res = await app.Editor.ModalManage.Wait();
if (res.Status === ModalState.Ok) if (res.Status === ModalState.Ok)
{ {
@ -149,7 +149,7 @@ export class DrawTopBottomBoard implements Command
basePt.add(new Vector3(rightExt, -frontDist)); basePt.add(new Vector3(rightExt, -frontDist));
board.ApplyMatrix(MoveMatrix(basePt)); board.ApplyMatrix(MoveMatrix(basePt));
board.ApplyMatrix(spaceParse.m_SpaceOCS); board.ApplyMatrix(spaceParse.m_SpaceOCS);
app.m_Database.ModelSpace.Append(board); app.Database.ModelSpace.Append(board);
} }
private DrawFoolBoard(opt: TBBoardOption, spaceParse: ISpaceParse) private DrawFoolBoard(opt: TBBoardOption, spaceParse: ISpaceParse)
@ -166,7 +166,7 @@ export class DrawTopBottomBoard implements Command
footBoard.BoardProcessOption.lines = LinesType.Reverse; footBoard.BoardProcessOption.lines = LinesType.Reverse;
footBoard.ApplyMatrix(MoveMatrix(spaceParse.m_SpaceBox.min.add(new Vector3(0, opt.footThickness + opt.footBehindShrink)))); footBoard.ApplyMatrix(MoveMatrix(spaceParse.m_SpaceBox.min.add(new Vector3(0, opt.footThickness + opt.footBehindShrink))));
footBoard.ApplyMatrix(spaceParse.m_SpaceOCS); footBoard.ApplyMatrix(spaceParse.m_SpaceOCS);
app.m_Database.ModelSpace.Append(footBoard); app.Database.ModelSpace.Append(footBoard);
} }
} }
} }

@ -70,7 +70,7 @@ export class DrawVerticalBoard extends DrawBoardTool
))); )));
b.ApplyMatrix(spaceOCS); b.ApplyMatrix(spaceOCS);
app.m_Database.ModelSpace.Append(b); app.Database.ModelSpace.Append(b);
} }
} }
} }

@ -10,7 +10,7 @@ export class DrawCircle implements Command
{ {
async exec() async exec()
{ {
let ptRes = await app.m_Editor.GetPoint({ let ptRes = await app.Editor.GetPoint({
Msg: "指定圆的圆心", Msg: "指定圆的圆心",
KeyWordList: [{ key: "3P", msg: "三点" }, { key: "2P", msg: "二点" }, { key: "T", msg: "切点、切点、半径" }] KeyWordList: [{ key: "3P", msg: "三点" }, { key: "2P", msg: "二点" }, { key: "T", msg: "切点、切点、半径" }]
}); });
@ -44,10 +44,10 @@ export class DrawCircle implements Command
async DrawCircleUseRadious(val: Vector3) async DrawCircleUseRadious(val: Vector3)
{ {
let cir = new Circle(); let cir = new Circle();
cir.ApplyMatrix(app.m_Editor.UCSMatrix); cir.ApplyMatrix(app.Editor.UCSMatrix);
cir.Center = val; cir.Center = val;
JigUtils.Draw(cir); JigUtils.Draw(cir);
let disRes = await app.m_Editor.GetDistance({ let disRes = await app.Editor.GetDistance({
Msg: "指定圆的半径:", Msg: "指定圆的半径:",
BasePoint: val, BasePoint: val,
Callback: (v) => cir.Radius = v, Callback: (v) => cir.Radius = v,
@ -55,18 +55,18 @@ export class DrawCircle implements Command
if (disRes.Status === PromptStatus.OK) if (disRes.Status === PromptStatus.OK)
{ {
cir.Radius = disRes.Distance; cir.Radius = disRes.Distance;
app.m_Database.ModelSpace.Append(cir); app.Database.ModelSpace.Append(cir);
} }
JigUtils.Destroy(); JigUtils.Destroy();
} }
async DrawCicleUseTwoPoint() async DrawCicleUseTwoPoint()
{ {
let ptRes1 = await app.m_Editor.GetPoint({ Msg: "指定圆直径的第一个端点:" }); let ptRes1 = await app.Editor.GetPoint({ Msg: "指定圆直径的第一个端点:" });
if (ptRes1.Status != PromptStatus.OK) if (ptRes1.Status != PromptStatus.OK)
return; return;
let cir = new Circle(); let cir = new Circle();
JigUtils.Draw(cir); JigUtils.Draw(cir);
let ptRes2 = await app.m_Editor.GetPoint({ let ptRes2 = await app.Editor.GetPoint({
Msg: "指定圆直径的第二个端点:", Msg: "指定圆直径的第二个端点:",
BasePoint: ptRes1.Point, BasePoint: ptRes1.Point,
AllowDrawRubberBand: true, AllowDrawRubberBand: true,
@ -80,18 +80,18 @@ export class DrawCircle implements Command
{ {
cir.Radius = ptRes2.Point.distanceTo(ptRes1.Point) / 2; cir.Radius = ptRes2.Point.distanceTo(ptRes1.Point) / 2;
cir.Center = midPoint(ptRes2.Point, ptRes1.Point); cir.Center = midPoint(ptRes2.Point, ptRes1.Point);
app.m_Database.ModelSpace.Append(cir); app.Database.ModelSpace.Append(cir);
} }
JigUtils.Destroy(); JigUtils.Destroy();
} }
async DrawCicleUseThreePoint() async DrawCicleUseThreePoint()
{ {
let ptRes1 = await app.m_Editor.GetPoint({ Msg: "指定圆上第一个点:" }); let ptRes1 = await app.Editor.GetPoint({ Msg: "指定圆上第一个点:" });
if (ptRes1.Status != PromptStatus.OK) if (ptRes1.Status != PromptStatus.OK)
return; return;
let cir = new Circle(); let cir = new Circle();
let ar = new Arc(); let ar = new Arc();
let ptRes2 = await app.m_Editor.GetPoint({ let ptRes2 = await app.Editor.GetPoint({
Msg: "指定圆上第二个点:", Msg: "指定圆上第二个点:",
BasePoint: ptRes1.Point, BasePoint: ptRes1.Point,
AllowDrawRubberBand: true AllowDrawRubberBand: true
@ -99,7 +99,7 @@ export class DrawCircle implements Command
if (ptRes2.Status != PromptStatus.OK) if (ptRes2.Status != PromptStatus.OK)
return; return;
JigUtils.Draw(cir); JigUtils.Draw(cir);
let ptRes3 = await app.m_Editor.GetPoint({ let ptRes3 = await app.Editor.GetPoint({
Msg: "指定圆上第三个点:", Msg: "指定圆上第三个点:",
BasePoint: ptRes2.Point, BasePoint: ptRes2.Point,
AllowDrawRubberBand: true, AllowDrawRubberBand: true,
@ -115,7 +115,7 @@ export class DrawCircle implements Command
ar.FromThreePoint(ptRes1.Point, ptRes2.Point, ptRes3.Point); ar.FromThreePoint(ptRes1.Point, ptRes2.Point, ptRes3.Point);
cir.Radius = ar.Radius; cir.Radius = ar.Radius;
cir.Center = ar.Center; cir.Center = ar.Center;
app.m_Database.ModelSpace.Append(cir); app.Database.ModelSpace.Append(cir);
} }
JigUtils.Destroy(); JigUtils.Destroy();
} }

@ -8,14 +8,14 @@ export class DrawCylineder implements Command
{ {
async exec() async exec()
{ {
let ptRes = await app.m_Editor.GetPoint({ Msg: "指定底面中心点" }); let ptRes = await app.Editor.GetPoint({ Msg: "指定底面中心点" });
if (ptRes.Status === PromptStatus.Cancel) if (ptRes.Status === PromptStatus.Cancel)
return; return;
let cylineder = JigUtils.Draw(new Cylineder()); let cylineder = JigUtils.Draw(new Cylineder());
cylineder.Center = ptRes.Point; cylineder.Center = ptRes.Point;
let disRes = await app.m_Editor.GetDistance({ let disRes = await app.Editor.GetDistance({
Msg: "指定底圆的半径:", Msg: "指定底圆的半径:",
BasePoint: ptRes.Point, BasePoint: ptRes.Point,
Callback: (v) => cylineder.Radius = v, Callback: (v) => cylineder.Radius = v,
@ -24,7 +24,7 @@ export class DrawCylineder implements Command
return; return;
cylineder.Radius = disRes.Distance; cylineder.Radius = disRes.Distance;
disRes = await app.m_Editor.GetDistance({ disRes = await app.Editor.GetDistance({
Msg: "指定圆柱高度:", Msg: "指定圆柱高度:",
BasePoint: ptRes.Point, BasePoint: ptRes.Point,
Callback: (v) => cylineder.Height = v, Callback: (v) => cylineder.Height = v,
@ -34,7 +34,7 @@ export class DrawCylineder implements Command
if (disRes.Status === PromptStatus.OK) if (disRes.Status === PromptStatus.OK)
{ {
cylineder.Height = disRes.Distance; cylineder.Height = disRes.Distance;
app.m_Database.ModelSpace.Append(cylineder); app.Database.ModelSpace.Append(cylineder);
} }
} }
} }

@ -28,7 +28,7 @@ export class Command_DimContinue implements Command
{ {
async exec() async exec()
{ {
let dimRes = await app.m_Editor.GetEntity({ let dimRes = await app.Editor.GetEntity({
Msg: "选择连续标注", Msg: "选择连续标注",
Filter: { filterTypes: [AlignedDimension, LineAngularDimension, LinearDimension] } Filter: { filterTypes: [AlignedDimension, LineAngularDimension, LinearDimension] }
}); });

@ -11,13 +11,13 @@ export class DimContinue
async StartDraw(lastDim: Dimension) async StartDraw(lastDim: Dimension)
{ {
this.m_LastDim = lastDim.Clone(); this.m_LastDim = lastDim.Clone();
let oldUcs = app.m_Editor.UCSMatrix; let oldUcs = app.Editor.UCSMatrix;
app.m_Editor.UCSMatrix = this.m_LastDim.OCS; app.Editor.UCSMatrix = this.m_LastDim.OCS;
while (true) while (true)
{ {
let newDim = this.CloneDimension(this.m_LastDim); let newDim = this.CloneDimension(this.m_LastDim);
JigUtils.Draw(newDim); JigUtils.Draw(newDim);
let ptRes = await app.m_Editor.GetPoint({ let ptRes = await app.Editor.GetPoint({
AllowNone: true, AllowNone: true,
BasePoint: this.m_BasePoint, BasePoint: this.m_BasePoint,
Msg: "指定第二个尺寸原点", Msg: "指定第二个尺寸原点",
@ -27,14 +27,14 @@ export class DimContinue
{ {
let p = ptRes.Point; let p = ptRes.Point;
this.UpdateNextPoint(p, newDim); this.UpdateNextPoint(p, newDim);
app.m_Database.ModelSpace.Append(newDim); app.Database.ModelSpace.Append(newDim);
this.Drawed(newDim, p); this.Drawed(newDim, p);
} }
else else
break; break;
} }
this.EndDraw(); this.EndDraw();
app.m_Editor.UCSMatrix = oldUcs; app.Editor.UCSMatrix = oldUcs;
} }
/** /**
* : ,, * : ,,

@ -23,7 +23,7 @@ export class Command_Draw2LineAngularDim
{ {
if (l1) if (l1)
msg = "请选择第二条直线"; msg = "请选择第二条直线";
let lineRes = await app.m_Editor.GetEntity({ let lineRes = await app.Editor.GetEntity({
Msg: msg, Msg: msg,
Filter: { Filter: {
filterTypes: [Curve], filterTypes: [Curve],
@ -85,7 +85,7 @@ export class Command_Draw2LineAngularDim
{ {
if (!cenPt) if (!cenPt)
{ {
let cenPtRes = await app.m_Editor.GetPoint({ let cenPtRes = await app.Editor.GetPoint({
Msg: "指定角的顶点" Msg: "指定角的顶点"
}) })
if (cenPtRes.Status === PromptStatus.Cancel) if (cenPtRes.Status === PromptStatus.Cancel)
@ -94,7 +94,7 @@ export class Command_Draw2LineAngularDim
} }
if (!p1) if (!p1)
{ {
let ptRes = await app.m_Editor.GetPoint({ let ptRes = await app.Editor.GetPoint({
Msg: "指定角的第一个端点", Msg: "指定角的第一个端点",
BasePoint: cenPt, BasePoint: cenPt,
AllowDrawRubberBand: true AllowDrawRubberBand: true
@ -104,7 +104,7 @@ export class Command_Draw2LineAngularDim
p1 = ptRes.Point; p1 = ptRes.Point;
} }
let ptRes = await app.m_Editor.GetPoint({ let ptRes = await app.Editor.GetPoint({
Msg: "指定角的第二个端点", Msg: "指定角的第二个端点",
BasePoint: cenPt, BasePoint: cenPt,
AllowDrawRubberBand: true AllowDrawRubberBand: true
@ -124,14 +124,14 @@ export class Command_Draw2LineAngularDim
let derv2 = l2.GetFistDeriv(0).normalize(); let derv2 = l2.GetFistDeriv(0).normalize();
if (isParallelTo(derv1, derv2)) if (isParallelTo(derv1, derv2))
{ {
app.m_Editor.Prompt("两直线平行!"); app.Editor.Prompt("两直线平行!");
return; return;
} }
let norm = derv1.clone().cross(derv2); let norm = derv1.clone().cross(derv2);
let ocs: Matrix4; let ocs: Matrix4;
for (const mat of [app.m_Editor.UCSMatrix, l1.OCS, l2.OCS]) for (const mat of [app.Editor.UCSMatrix, l1.OCS, l2.OCS])
{ {
if (isParallelTo( if (isParallelTo(
new Vector3().setFromMatrixColumn(mat, 2), new Vector3().setFromMatrixColumn(mat, 2),
@ -144,7 +144,7 @@ export class Command_Draw2LineAngularDim
} }
if (!ocs) if (!ocs)
{ {
app.m_Editor.Prompt("绘制的标注实体和当前的UCS坐标系不一致,绘制失败."); app.Editor.Prompt("绘制的标注实体和当前的UCS坐标系不一致,绘制失败.");
return; return;
} }
let dim = new LineAngularDimension(); let dim = new LineAngularDimension();
@ -160,7 +160,7 @@ export class Command_Draw2LineAngularDim
JigUtils.Draw(dim); JigUtils.Draw(dim);
let ptRes = await app.m_Editor.GetPoint({ let ptRes = await app.Editor.GetPoint({
Callback: (p) => Callback: (p) =>
{ {
dim.UpdateDimData(undefined, undefined, undefined, undefined, p); dim.UpdateDimData(undefined, undefined, undefined, undefined, p);
@ -169,7 +169,7 @@ export class Command_Draw2LineAngularDim
if (ptRes.Status === PromptStatus.OK) if (ptRes.Status === PromptStatus.OK)
{ {
app.m_Database.ModelSpace.Append(dim); app.Database.ModelSpace.Append(dim);
await ContinueDrawDimension(dim); await ContinueDrawDimension(dim);
} }
} }

@ -23,7 +23,7 @@ export class DrawAlignedDimension implements Command
protected DimType = DimensionType.Align; protected DimType = DimensionType.Align;
async exec() async exec()
{ {
let ptRes = await app.m_Editor.GetPoint({ Msg: "请指定第一条尺寸线原点:", AllowNone: true }); let ptRes = await app.Editor.GetPoint({ Msg: "请指定第一条尺寸线原点:", AllowNone: true });
if (ptRes.Status === PromptStatus.OK) if (ptRes.Status === PromptStatus.OK)
await this.SelectPointDim(ptRes.Point); await this.SelectPointDim(ptRes.Point);
@ -33,7 +33,7 @@ export class DrawAlignedDimension implements Command
} }
private async SelectPointDim(footPt1: Vector3) private async SelectPointDim(footPt1: Vector3)
{ {
let ptRes = await app.m_Editor.GetPoint({ let ptRes = await app.Editor.GetPoint({
Msg: "请输入第二条尺寸线原点:", Msg: "请输入第二条尺寸线原点:",
BasePoint: footPt1, BasePoint: footPt1,
AllowDrawRubberBand: true, AllowDrawRubberBand: true,
@ -47,7 +47,7 @@ export class DrawAlignedDimension implements Command
} }
private async PickUpDim() private async PickUpDim()
{ {
let enRes = await app.m_Editor.GetEntity({ let enRes = await app.Editor.GetEntity({
Msg: "选择对象", Msg: "选择对象",
Filter: { filterTypes: [Curve] } Filter: { filterTypes: [Curve] }
}); });
@ -84,7 +84,7 @@ export class DrawAlignedDimension implements Command
else else
alDim = new LinearDimension(); alDim = new LinearDimension();
alDim.ApplyMatrix(app.m_Editor.UCSMatrix); alDim.ApplyMatrix(app.Editor.UCSMatrix);
alDim.FootP1 = footPt1; alDim.FootP1 = footPt1;
alDim.ArmP1 = footPt1; alDim.ArmP1 = footPt1;
@ -105,7 +105,7 @@ export class DrawAlignedDimension implements Command
return p; return p;
} }
let ptRes = await app.m_Editor.GetPoint({ let ptRes = await app.Editor.GetPoint({
Msg: "指定尺寸线位置:", Msg: "指定尺寸线位置:",
Callback: (v) => { alDim.TextPosition = getPt(v); } Callback: (v) => { alDim.TextPosition = getPt(v); }
}); });
@ -113,7 +113,7 @@ export class DrawAlignedDimension implements Command
if (ptRes.Status == PromptStatus.OK) if (ptRes.Status == PromptStatus.OK)
{ {
alDim.TextPosition = getPt(ptRes.Point); alDim.TextPosition = getPt(ptRes.Point);
app.m_Database.ModelSpace.Append(alDim); app.Database.ModelSpace.Append(alDim);
await ContinueDrawDimension(alDim); await ContinueDrawDimension(alDim);
} }
} }

@ -22,7 +22,7 @@ export class DrawRadiusDim implements Command
let cu: Arc | Circle; let cu: Arc | Circle;
while (true) while (true)
{ {
let enRes = await app.m_Editor.GetEntity({ let enRes = await app.Editor.GetEntity({
Msg: "选择圆或者圆弧", Msg: "选择圆或者圆弧",
Filter: { filterTypes: [Circle, Arc] } Filter: { filterTypes: [Circle, Arc] }
}); });
@ -45,7 +45,7 @@ export class DrawRadiusDim implements Command
JigUtils.Draw(dim); JigUtils.Draw(dim);
let ptRes = await app.m_Editor.GetPoint({ let ptRes = await app.Editor.GetPoint({
Msg: "指定尺寸线位置", Msg: "指定尺寸线位置",
Callback: (p) => Callback: (p) =>
{ {
@ -55,7 +55,7 @@ export class DrawRadiusDim implements Command
if (ptRes.Status === PromptStatus.OK) if (ptRes.Status === PromptStatus.OK)
{ {
this.UpdateDim(dim, ptRes.Point, startPt, rad); this.UpdateDim(dim, ptRes.Point, startPt, rad);
app.m_Database.ModelSpace.Append(dim); app.Database.ModelSpace.Append(dim);
} }
} }
private UpdateDim(dim: RadiusDimension, endPt: Vector3, startPt: Vector3, rad: number) private UpdateDim(dim: RadiusDimension, endPt: Vector3, startPt: Vector3, rad: number)

@ -54,7 +54,7 @@ export class DeleteDrill implements Command
break; break;
} }
let brRes = await app.m_Editor.GetSelection({ let brRes = await app.Editor.GetSelection({
Msg: promptMsg, Msg: promptMsg,
KeyWordList: kw, KeyWordList: kw,
Filter: { filterTypes } Filter: { filterTypes }

@ -9,7 +9,7 @@ export class DrawDrilling implements Command
{ {
async exec() async exec()
{ {
let brsRes = await app.m_Editor.GetSelection({ let brsRes = await app.Editor.GetSelection({
Msg: "选择板件", Msg: "选择板件",
UseSelect: true, UseSelect: true,
Filter: { filterTypes: [Board] } Filter: { filterTypes: [Board] }

@ -220,7 +220,7 @@ export class DrawDrillingTool extends Singleton
cloneD.FId = this.m_Face.m_LocalBoard.Id; cloneD.FId = this.m_Face.m_LocalBoard.Id;
cloneD.ApplyMatrix(MoveMatrix(new Vector3(dist))) cloneD.ApplyMatrix(MoveMatrix(new Vector3(dist)))
.ApplyMatrix(this.m_Face.OCS); .ApplyMatrix(this.m_Face.OCS);
app.m_Database.ModelSpace.Append(cloneD); app.Database.ModelSpace.Append(cloneD);
newDrillEnts.push(cloneD.Id); newDrillEnts.push(cloneD.Id);
} }
newDrillentList.push(newDrillEnts); newDrillentList.push(newDrillEnts);
@ -420,7 +420,7 @@ export class DrawDrillingTool extends Singleton
if (!suitableOption) if (!suitableOption)
{ {
app.m_Editor.Prompt("长度" + f.m_Length + "没有合适的规则,或者当前配置不存在" + f.drillType + "类型排钻"); app.Editor.Prompt("长度" + f.m_Length + "没有合适的规则,或者当前配置不存在" + f.drillType + "类型排钻");
continue; continue;
} }
let notGangDist = suitableOption.notGangDist; let notGangDist = suitableOption.notGangDist;

@ -9,6 +9,6 @@ export class DrillConfig implements Command
async exec() async exec()
{ {
let store = DrillStore.GetInstance(); let store = DrillStore.GetInstance();
app.m_Editor.m_ModalManage.RenderModal(DrillModal, ModalPosition.Center, { store }); app.Editor.ModalManage.RenderModal(DrillModal, ModalPosition.Center, { store });
} }
} }

@ -13,7 +13,7 @@ export class DrillingReactor
constructor() constructor()
{ {
this.Enable = userConfig.openDrillingReactor; this.Enable = userConfig.openDrillingReactor;
app.m_CommandReactor.OnCommandEnd((cmdName: string, changeObjects, createObjects) => app.CommandReactor.OnCommandEnd((cmdName: string, changeObjects, createObjects) =>
{ {
if (!this.Enable) return; if (!this.Enable) return;
@ -47,7 +47,7 @@ export class DrillingReactor
private GetSurroundBoards(brList: Board[]) private GetSurroundBoards(brList: Board[])
{ {
let brs: Board[] = []; let brs: Board[] = [];
for (let ent of app.m_Viewer.VisibleEntitys) for (let ent of app.Viewer.VisibleEntitys)
{ {
if (ent instanceof Board && !brList.includes(ent)) if (ent instanceof Board && !brList.includes(ent))
brs.push(ent); brs.push(ent);

@ -15,7 +15,7 @@ export class DrawEllipse implements Command
{ {
async exec() async exec()
{ {
let ptRes = await app.m_Editor.GetPoint({ let ptRes = await app.Editor.GetPoint({
Msg: "指定椭圆中心", Msg: "指定椭圆中心",
}); });
@ -23,7 +23,7 @@ export class DrawEllipse implements Command
return; return;
//椭圆X轴半径点 //椭圆X轴半径点
let radXRes = await app.m_Editor.GetPoint({ let radXRes = await app.Editor.GetPoint({
Msg: "指定轴端点:", Msg: "指定轴端点:",
BasePoint: ptRes.Point, BasePoint: ptRes.Point,
AllowDrawRubberBand: true, AllowDrawRubberBand: true,
@ -32,7 +32,7 @@ export class DrawEllipse implements Command
return; return;
let disVec = radXRes.Point.sub(ptRes.Point); let disVec = radXRes.Point.sub(ptRes.Point);
let ucs = app.m_Editor.UCSMatrix; let ucs = app.Editor.UCSMatrix;
disVec.applyMatrix4(new Matrix4().getInverse(ucs)); disVec.applyMatrix4(new Matrix4().getInverse(ucs));
//实例化椭圆 //实例化椭圆
let ellipse = new Ellipse(new Vector3(), disVec.length(), 0, Math.atan2(disVec.y, disVec.x)); let ellipse = new Ellipse(new Vector3(), disVec.length(), 0, Math.atan2(disVec.y, disVec.x));
@ -41,7 +41,7 @@ export class DrawEllipse implements Command
JigUtils.Draw(ellipse); JigUtils.Draw(ellipse);
//椭圆Y轴 //椭圆Y轴
let radYRes = await app.m_Editor.GetDistance({ let radYRes = await app.Editor.GetDistance({
Msg: "指定轴端点:", Msg: "指定轴端点:",
BasePoint: ptRes.Point, BasePoint: ptRes.Point,
Callback: (v) => ellipse.RadY = v, Callback: (v) => ellipse.RadY = v,
@ -50,7 +50,7 @@ export class DrawEllipse implements Command
if (radYRes.Status === PromptStatus.OK) if (radYRes.Status === PromptStatus.OK)
{ {
ellipse.RadY = radYRes.Distance; ellipse.RadY = radYRes.Distance;
app.m_Database.ModelSpace.Append(ellipse); app.Database.ModelSpace.Append(ellipse);
} }
JigUtils.Destroy(); JigUtils.Destroy();
} }

@ -11,7 +11,7 @@ export class DrawFloor implements Command
get scene() get scene()
{ {
return app.m_Viewer.Scene; return app.Viewer.Scene;
} }
constructor() constructor()
{ {
@ -19,7 +19,7 @@ export class DrawFloor implements Command
} }
async exec() async exec()
{ {
app.m_Viewer.Camera.position.set(0, 0, 2); app.Viewer.Camera.position.set(0, 0, 2);
this.drawFloor(); this.drawFloor();
this.drawLight(); this.drawLight();
@ -34,7 +34,7 @@ export class DrawFloor implements Command
this.loadMaterial(); this.loadMaterial();
app.m_Viewer.m_Render.toneMappingExposure = Math.pow(0.68, 5.0); // to allow for very bright scenes. app.Viewer.Renderer.toneMappingExposure = Math.pow(0.68, 5.0); // to allow for very bright scenes.
} }
async loadFbx() async loadFbx()
@ -153,12 +153,12 @@ export class DrawFloor implements Command
var clock = new THREE.Clock(); var clock = new THREE.Clock();
begin(app.m_Viewer, app.m_Viewer.StartRender, () => begin(app.Viewer, app.Viewer.StartRender, () =>
{ {
var time = Date.now() * 0.0005; var time = Date.now() * 0.0005;
var delta = clock.getDelta(); var delta = clock.getDelta();
bulbLight.position.z = Math.cos(time) * 0.75 + 1.25; bulbLight.position.z = Math.cos(time) * 0.75 + 1.25;
app.m_Viewer.m_bNeedUpdate = true; app.Viewer.UpdateRender();
}) })
} }
private drawHemiLight() private drawHemiLight()

@ -14,9 +14,9 @@ export class DrawGripStretch implements Command
{ {
async exec() async exec()
{ {
if (app.m_Viewer.m_OutlinePass.selectedObjects.length === 0) if (app.Viewer.OutlinePass.selectedObjects.length === 0)
{ {
app.m_Editor.Prompt("未选择对象:"); app.Editor.Prompt("未选择对象:");
return; return;
} }
@ -30,7 +30,7 @@ export class DrawGripStretch implements Command
}); });
for (let en of app.m_Viewer.m_OutlinePass.selectedObjects) for (let en of app.Viewer.OutlinePass.selectedObjects)
{ {
if (en instanceof THREE.Mesh || en instanceof THREE.Line) if (en instanceof THREE.Mesh || en instanceof THREE.Line)
{ {
@ -43,7 +43,7 @@ export class DrawGripStretch implements Command
} }
} }
let pts = new THREE.Points(geometry, material); let pts = new THREE.Points(geometry, material);
app.m_Viewer.Scene.add(pts); app.Viewer.Scene.add(pts);
} }
} }
} }

@ -9,12 +9,12 @@ export class DrawPointLight implements Command
{ {
let light = JigUtils.Draw(new PointLight()); let light = JigUtils.Draw(new PointLight());
let ptRes = await app.m_Editor.GetPoint({ let ptRes = await app.Editor.GetPoint({
Msg: "选择点光源位置", Msg: "选择点光源位置",
Callback: p => light.Position = p Callback: p => light.Position = p
}); });
let valRes = await app.m_Editor.GetDistance({ let valRes = await app.Editor.GetDistance({
Msg: "设置点光源强度", Msg: "设置点光源强度",
Default: 1 Default: 1
}); });
@ -23,7 +23,7 @@ export class DrawPointLight implements Command
return; return;
light.Intensity = valRes.Distance; light.Intensity = valRes.Distance;
valRes = await app.m_Editor.GetDistance({ valRes = await app.Editor.GetDistance({
Msg: "设置点光源照射距离", Msg: "设置点光源照射距离",
Default: 100 Default: 100
}); });
@ -31,7 +31,7 @@ export class DrawPointLight implements Command
if (ptRes.Status === PromptStatus.OK) if (ptRes.Status === PromptStatus.OK)
{ {
light.Distance = valRes.Distance; light.Distance = valRes.Distance;
app.m_Database.ModelSpace.Append(light); app.Database.ModelSpace.Append(light);
} }
} }
} }
@ -41,7 +41,7 @@ export class DrawPointLight2 implements Command
{ {
let light = JigUtils.Draw(new PointLight()); let light = JigUtils.Draw(new PointLight());
let ptRes = await app.m_Editor.GetPoint({ let ptRes = await app.Editor.GetPoint({
Msg: "选择点光源位置", Msg: "选择点光源位置",
Callback: p => light.Position = p Callback: p => light.Position = p
}); });
@ -49,7 +49,7 @@ export class DrawPointLight2 implements Command
if (ptRes.Status === PromptStatus.OK) if (ptRes.Status === PromptStatus.OK)
{ {
light.Position = ptRes.Point; light.Position = ptRes.Point;
app.m_Database.ModelSpace.Append(light); app.Database.ModelSpace.Append(light);
} }
} }
} }

@ -10,24 +10,24 @@ export class DrawRectAreaLight implements Command
{ {
async exec() async exec()
{ {
let ptRes = await app.m_Editor.GetPoint({ let ptRes = await app.Editor.GetPoint({
Msg: "选择矩形光范围点" Msg: "选择矩形光范围点"
}); });
if (ptRes.Status === PromptStatus.Cancel) if (ptRes.Status === PromptStatus.Cancel)
return; return;
let light = JigUtils.Draw(new RectAreaLight()); let light = JigUtils.Draw(new RectAreaLight());
light.ApplyMatrix(app.m_Editor.UCSMatrix); light.ApplyMatrix(app.Editor.UCSMatrix);
let p1 = ptRes.Point; let p1 = ptRes.Point;
ptRes = await app.m_Editor.GetPoint({ ptRes = await app.Editor.GetPoint({
Msg: "选择矩形光范围点2", Msg: "选择矩形光范围点2",
Callback: p => this.UpdateLight(p1, p, light) Callback: p => this.UpdateLight(p1, p, light)
}); });
if (ptRes.Status === PromptStatus.OK) if (ptRes.Status === PromptStatus.OK)
{ {
this.UpdateLight(p1, ptRes.Point, light); this.UpdateLight(p1, ptRes.Point, light);
app.m_Database.ModelSpace.Append(light); app.Database.ModelSpace.Append(light);
} }
} }
private UpdateLight(p1: Vector3, p2: Vector3, light: RectAreaLight) private UpdateLight(p1: Vector3, p2: Vector3, light: RectAreaLight)
@ -37,7 +37,7 @@ export class DrawRectAreaLight implements Command
light.Target = cen.add(light.Normal.multiplyScalar(100).negate()); light.Target = cen.add(light.Normal.multiplyScalar(100).negate());
let box = new Box3(); let box = new Box3();
box.setFromPoints([p1, p2].map(p => p.clone().applyMatrix4(app.m_Editor.UCSMatrixInv))); box.setFromPoints([p1, p2].map(p => p.clone().applyMatrix4(app.Editor.UCSMatrixInv)));
let size = box.getSize(new Vector3()); let size = box.getSize(new Vector3());
if (equaln(size.x, 0) || equaln(size.y, 0)) return; if (equaln(size.x, 0) || equaln(size.y, 0)) return;
if (!equaln(light.Normal.x, 0)) if (!equaln(light.Normal.x, 0))

@ -10,7 +10,7 @@ export class DrawSpotLight implements Command
{ {
async exec() async exec()
{ {
let ptRes = await app.m_Editor.GetPoint({ let ptRes = await app.Editor.GetPoint({
Msg: "选择光源位置" Msg: "选择光源位置"
}); });
@ -18,10 +18,10 @@ export class DrawSpotLight implements Command
return; return;
let light = JigUtils.Draw(new SpotLight()); let light = JigUtils.Draw(new SpotLight());
light.ApplyMatrix(app.m_Editor.UCSMatrix); light.ApplyMatrix(app.Editor.UCSMatrix);
light.Position = ptRes.Point; light.Position = ptRes.Point;
ptRes = await app.m_Editor.GetPoint({ ptRes = await app.Editor.GetPoint({
Msg: "选择照射目标点", Msg: "选择照射目标点",
BasePoint: ptRes.Point, BasePoint: ptRes.Point,
Callback: p => light.Target = p Callback: p => light.Target = p
@ -30,7 +30,7 @@ export class DrawSpotLight implements Command
if (ptRes.Status === PromptStatus.OK) if (ptRes.Status === PromptStatus.OK)
{ {
light.Target = ptRes.Point; light.Target = ptRes.Point;
app.m_Database.ModelSpace.Append(light); app.Database.ModelSpace.Append(light);
} }
} }
@ -40,8 +40,8 @@ export class DrawSpotLight2 implements Command
async exec() async exec()
{ {
let light = JigUtils.Draw(new SpotLight()); let light = JigUtils.Draw(new SpotLight());
light.ApplyMatrix(app.m_Editor.UCSMatrix); light.ApplyMatrix(app.Editor.UCSMatrix);
let ptRes = await app.m_Editor.GetPoint({ let ptRes = await app.Editor.GetPoint({
Msg: "选择射灯位置", Msg: "选择射灯位置",
Callback: p => this.update(light, p) Callback: p => this.update(light, p)
}); });
@ -49,13 +49,13 @@ export class DrawSpotLight2 implements Command
if (ptRes.Status === PromptStatus.OK) if (ptRes.Status === PromptStatus.OK)
{ {
this.update(light, ptRes.Point); this.update(light, ptRes.Point);
app.m_Database.ModelSpace.Append(light); app.Database.ModelSpace.Append(light);
} }
} }
update(light: SpotLight, p: Vector3) update(light: SpotLight, p: Vector3)
{ {
let ucs = app.m_Editor.UCSMatrix; let ucs = app.Editor.UCSMatrix;
let ucsInv = app.m_Editor.UCSMatrixInv; let ucsInv = app.Editor.UCSMatrixInv;
light.Position = p; light.Position = p;
let target = p.clone().applyMatrix4(ucsInv) let target = p.clone().applyMatrix4(ucsInv)
.setZ(0).applyMatrix4(ucs); .setZ(0).applyMatrix4(ucs);

@ -13,7 +13,7 @@ export class DrawLine implements Command
{ {
async exec() async exec()
{ {
let ptRes = await app.m_Editor.GetPoint({ Msg: "请输入第一个点:" }); let ptRes = await app.Editor.GetPoint({ Msg: "请输入第一个点:" });
if (ptRes.Status != PromptStatus.OK) if (ptRes.Status != PromptStatus.OK)
return; return;
@ -22,8 +22,8 @@ export class DrawLine implements Command
let cir: Circle | Arc; let cir: Circle | Arc;
if (isTan) if (isTan)
{ {
let pick = new SelectPick(app.m_Viewer, app.m_Viewer.WorldToScreen(ptRes.Point)); let pick = new SelectPick(app.Viewer, app.Viewer.WorldToScreen(ptRes.Point));
pick.Select(app.m_Viewer.VisibleObjects, { filterTypes: [Circle, Arc] }); pick.Select(app.Viewer.VisibleObjects, { filterTypes: [Circle, Arc] });
let cirs = pick.SelectEntityList as Circle[]; let cirs = pick.SelectEntityList as Circle[];
for (let e of cirs) for (let e of cirs)
@ -37,7 +37,7 @@ export class DrawLine implements Command
while (true) while (true)
{ {
let line = new Line(); let line = new Line();
let ucsMatrix = app.m_Editor.UCSMatrix; let ucsMatrix = app.Editor.UCSMatrix;
line.ApplyMatrix(ucsMatrix); line.ApplyMatrix(ucsMatrix);
line.StartPoint = ptLast; line.StartPoint = ptLast;
@ -59,7 +59,7 @@ export class DrawLine implements Command
line.EndPoint = p; line.EndPoint = p;
} }
ptRes = await app.m_Editor.GetPoint({ ptRes = await app.Editor.GetPoint({
Msg: "请输入点2:", Msg: "请输入点2:",
BasePoint: isFirstAndTan ? undefined : ptLast, BasePoint: isFirstAndTan ? undefined : ptLast,
AllowDrawRubberBand: true, AllowDrawRubberBand: true,
@ -75,7 +75,7 @@ export class DrawLine implements Command
{ {
updateEndPt(ptRes.Point); updateEndPt(ptRes.Point);
app.m_Database.ModelSpace.Append(line); app.Database.ModelSpace.Append(line);
drawLines.push(line); drawLines.push(line);
ptLast = ptRes.Point; ptLast = ptRes.Point;
continue; continue;
@ -87,7 +87,7 @@ export class DrawLine implements Command
if (drawLines.length > 0) if (drawLines.length > 0)
{ {
let lastLine = drawLines[drawLines.length - 1]; let lastLine = drawLines[drawLines.length - 1];
app.m_Database.ModelSpace.Remove(lastLine); app.Database.ModelSpace.Remove(lastLine);
drawLines.pop(); drawLines.pop();
ptLast = lastLine.StartPoint; ptLast = lastLine.StartPoint;
@ -98,7 +98,7 @@ export class DrawLine implements Command
if (drawLines.length > 1) if (drawLines.length > 1)
{ {
let line = new Line(ptLast, drawLines[0].StartPoint); let line = new Line(ptLast, drawLines[0].StartPoint);
app.m_Database.ModelSpace.Append(line); app.Database.ModelSpace.Append(line);
break; break;
} }
} }

@ -10,14 +10,14 @@ export class CMD_DrawPoint implements Command
{ {
while (true) while (true)
{ {
app.m_Database.hm.StartMark(); app.Database.hm.StartMark();
let ptRes = await app.m_Editor.GetPoint({ Msg: "请输入或点取点的位置" }); let ptRes = await app.Editor.GetPoint({ Msg: "请输入或点取点的位置" });
if (ptRes.Status != PromptStatus.OK) if (ptRes.Status != PromptStatus.OK)
break; break;
else else
{ {
let ptEnt = new Point(ptRes.Point); let ptEnt = new Point(ptRes.Point);
app.m_Database.ModelSpace.Append(ptEnt); app.Database.ModelSpace.Append(ptEnt);
continue; continue;
} }
} }

@ -21,8 +21,8 @@ export class DrawPolyline
this.model = PolylineModel.Line; this.model = PolylineModel.Line;
let pl = new Polyline(); let pl = new Polyline();
pl.ApplyMatrix(app.m_Editor.UCSMatrix); pl.ApplyMatrix(app.Editor.UCSMatrix);
app.m_Database.ModelSpace.Append(pl); app.Database.ModelSpace.Append(pl);
let plJig = JigUtils.Draw(pl); let plJig = JigUtils.Draw(pl);
@ -50,7 +50,7 @@ export class DrawPolyline
} }
plJig.AddVertexAt(plJig.NumberOfVertices, new Vector2()); plJig.AddVertexAt(plJig.NumberOfVertices, new Vector2());
let p = await app.m_Editor.GetPoint(ops); let p = await app.Editor.GetPoint(ops);
if (p.Status === PromptStatus.OK) if (p.Status === PromptStatus.OK)
{ {
@ -104,7 +104,7 @@ export class DrawPolyline
JigUtils.End(); JigUtils.End();
if (pl.NumberOfVertices < 2) if (pl.NumberOfVertices < 2)
{ {
app.m_Database.ModelSpace.Remove(pl); app.Database.ModelSpace.Remove(pl);
return true; return true;
} }
} }
@ -133,7 +133,7 @@ export class DrawPolyline
pl.SetBulgeAt(ptCout - 2, Math.tan(cirAng * 0.25)); pl.SetBulgeAt(ptCout - 2, Math.tan(cirAng * 0.25));
} }
app.m_Editor.UpdateScreen(); app.Editor.UpdateScreen();
} }
RemoveLastVertex(pl: Polyline) RemoveLastVertex(pl: Polyline)

@ -7,15 +7,15 @@ export class DrawRect implements Command
async exec() async exec()
{ {
let rectRes = await app.m_Editor.GetRectPoint(); let rectRes = await app.Editor.GetRectPoint();
if (rectRes.Status === PromptStatus.OK) if (rectRes.Status === PromptStatus.OK)
{ {
let rec = new Polyline(); let rec = new Polyline();
rec.Create2Pt(rectRes.Point1UCS, rectRes.Point2UCS); rec.Create2Pt(rectRes.Point1UCS, rectRes.Point2UCS);
rec.ApplyMatrix(app.m_Editor.UCSMatrix); rec.ApplyMatrix(app.Editor.UCSMatrix);
app.m_Database.ModelSpace.Append(rec); app.Database.ModelSpace.Append(rec);
} }
} }
} }

@ -9,7 +9,7 @@ export class DrawRegion implements Command
{ {
async exec() async exec()
{ {
let ssRes = await app.m_Editor.GetSelection({ UseSelect: true, Filter: { filterTypes: [Curve] } }); let ssRes = await app.Editor.GetSelection({ UseSelect: true, Filter: { filterTypes: [Curve] } });
if (ssRes.Status !== PromptStatus.OK) if (ssRes.Status !== PromptStatus.OK)
return; return;
@ -23,9 +23,9 @@ export class DrawRegion implements Command
if (cu.IsClose) if (cu.IsClose)
{ {
let reg = Region.CreateFromCurves([cu.Clone() as Curve]); let reg = Region.CreateFromCurves([cu.Clone() as Curve]);
if(reg) if (reg)
{ {
app.m_Database.ModelSpace.Append(reg); app.Database.ModelSpace.Append(reg);
cu.Erase(); cu.Erase();
} }
} }
@ -36,9 +36,9 @@ export class DrawRegion implements Command
{ {
let reg = new RegionParse(lines, 3); let reg = new RegionParse(lines, 3);
for (let routes of reg.m_RegionsOutline) for (let routes of reg.RegionsOutline)
this.DrawRegion(routes); this.DrawRegion(routes);
for (let routes of reg.m_RegionsInternal) for (let routes of reg.RegionsInternal)
this.DrawRegion(routes); this.DrawRegion(routes);
for (let cu of cus) for (let cu of cus)
@ -47,11 +47,11 @@ export class DrawRegion implements Command
cu.Erase(); cu.Erase();
} }
for (let [, cus] of reg.m_ExpLineMap) for (let [, cus] of reg.ExpLineMap)
{ {
for (let c of cus) for (let c of cus)
if (!reg.GetCueveUsed(c)) if (!reg.GetCueveUsed(c))
app.m_Database.ModelSpace.Append(c); app.Database.ModelSpace.Append(c);
} }
} }
} }
@ -62,6 +62,6 @@ export class DrawRegion implements Command
cus.push(r.curve); cus.push(r.curve);
let reg = Region.CreateFromCurves(cus); let reg = Region.CreateFromCurves(cus);
if (reg) if (reg)
app.m_Database.ModelSpace.Append(reg); app.Database.ModelSpace.Append(reg);
} }
} }

@ -9,7 +9,7 @@ export class DrawSky implements Command
async exec() async exec()
{ {
let sky = new Sky(); let sky = new Sky();
app.m_Viewer.Scene.add(sky); app.Viewer.Scene.add(sky);
sky.scale.setScalar(50); sky.scale.setScalar(50);
sky.rotateY(Math.PI); sky.rotateY(Math.PI);

@ -6,12 +6,12 @@ export class DrawSphere implements Command
async exec() async exec()
{ {
let sphere = new Mesh(new SphereGeometry(1, 16, 16)); let sphere = new Mesh(new SphereGeometry(1, 16, 16));
let ptRes = app.m_Editor.GetPoint({ let ptRes = app.Editor.GetPoint({
Callback: (pt) => Callback: (pt) =>
{ {
sphere.position.copy(pt); sphere.position.copy(pt);
} }
}); });
app.m_Viewer.Scene.add(sphere); app.Viewer.Scene.add(sphere);
} }
} }

@ -9,8 +9,8 @@ export class DrawSpline implements Command
{ {
async exec() async exec()
{ {
app.m_Editor.Prompt("请输入一个点:"); app.Editor.Prompt("请输入一个点:");
let ptRes = await app.m_Editor.GetPoint({ Msg: "请输入第一个点:" }); let ptRes = await app.Editor.GetPoint({ Msg: "请输入第一个点:" });
if (ptRes.Status != PromptStatus.OK) if (ptRes.Status != PromptStatus.OK)
return; return;
let ptLast = ptRes.Point; let ptLast = ptRes.Point;
@ -25,10 +25,10 @@ export class DrawSpline implements Command
pts.push(ptLast); pts.push(ptLast);
if (pts.length === 2) if (pts.length === 2)
{ {
app.m_Database.ModelSpace.Append(spline); app.Database.ModelSpace.Append(spline);
} }
app.m_Editor.Prompt("请输入点2:"); app.Editor.Prompt("请输入点2:");
ptRes = await app.m_Editor.GetPoint({ ptRes = await app.Editor.GetPoint({
Msg: "请输入点2:", Msg: "请输入点2:",
BasePoint: ptLast, BasePoint: ptLast,
AllowDrawRubberBand: true, AllowDrawRubberBand: true,

@ -167,17 +167,17 @@ export class DrawRegTest implements Command
for (let e of culist) for (let e of culist)
{ {
app.m_Database.ModelSpace.Append(e); app.Database.ModelSpace.Append(e);
} }
let alg = new RegionParse(culist); let alg = new RegionParse(culist);
for (let r of alg.m_RegionsOutline) for (let r of alg.RegionsOutline)
{ {
createReg(r); createReg(r);
} }
for (let r of alg.m_RegionsInternal) for (let r of alg.RegionsInternal)
{ {
createReg(r); createReg(r);
} }
@ -208,5 +208,5 @@ function createReg(r: Set<Route>)
let cus: Curve[] = []; let cus: Curve[] = [];
r.forEach(route => cus.push(route.curve.Clone() as Curve)); r.forEach(route => cus.push(route.curve.Clone() as Curve));
let re = Region.CreateFromCurves(cus) let re = Region.CreateFromCurves(cus)
app.m_Database.ModelSpace.Append(re); app.Database.ModelSpace.Append(re);
} }

@ -9,11 +9,11 @@ export class DrawText implements Command
{ {
async exec() async exec()
{ {
let ptRes = await app.m_Editor.GetPoint({ Msg: "指定文字的起点" }); let ptRes = await app.Editor.GetPoint({ Msg: "指定文字的起点" });
if (ptRes.Status === PromptStatus.Cancel) if (ptRes.Status === PromptStatus.Cancel)
return; return;
let startPoint = ptRes.Point; let startPoint = ptRes.Point;
let hRes = await app.m_Editor.GetDistance({ let hRes = await app.Editor.GetDistance({
Msg: "指定高度", Msg: "指定高度",
BasePoint: startPoint, BasePoint: startPoint,
Default: 30 Default: 30
@ -24,7 +24,7 @@ export class DrawText implements Command
if (equaln(height, 0) || !height) return; if (equaln(height, 0) || !height) return;
hRes = await app.m_Editor.GetAngle({ hRes = await app.Editor.GetAngle({
Msg: "指定文字旋转角度", Msg: "指定文字旋转角度",
BasePoint: startPoint, BasePoint: startPoint,
Default: 0 Default: 0

@ -13,7 +13,7 @@ import { Line } from "../DatabaseServices/Entity/Line";
/**构建顶线 */ /**构建顶线 */
export async function buildTopline(outline: Polyline) export async function buildTopline(outline: Polyline)
{ {
let brsRes = await app.m_Editor.GetSelection({ let brsRes = await app.Editor.GetSelection({
Msg: "选择柜体或者曲线", Msg: "选择柜体或者曲线",
Filter: { filterTypes: [Board, Arc, Line, Polyline] } Filter: { filterTypes: [Board, Arc, Line, Polyline] }
}); });
@ -52,7 +52,7 @@ async function handleBoard(outline: Polyline, brs: Board[])
JigUtils.Draw(cu); JigUtils.Draw(cu);
updateBrsVisible(false); updateBrsVisible(false);
let cuRes = await app.m_Editor.GetSelection({ let cuRes = await app.Editor.GetSelection({
Msg: "选择没有靠墙的边", Msg: "选择没有靠墙的边",
Filter: { filterTypes: [Curve] } Filter: { filterTypes: [Curve] }
}) })
@ -77,6 +77,6 @@ function draw(outline: Polyline, cus: Curve[])
path.Join(c); path.Join(c);
let sweepSolid = new SweepSolid(outline, path); let sweepSolid = new SweepSolid(outline, path);
app.m_Database.ModelSpace.Append(sweepSolid); app.Database.ModelSpace.Append(sweepSolid);
} }
} }

@ -9,6 +9,6 @@ export class ConfigureWineRack implements Command
async exec() async exec()
{ {
let store = WineRackStore.GetInstance() as WineRackStore; let store = WineRackStore.GetInstance() as WineRackStore;
app.m_Editor.m_ModalManage.RenderModal(WineRackModal, ModalPosition.Center, { store }); app.Editor.ModalManage.RenderModal(WineRackModal, ModalPosition.Center, { store });
} }
} }

@ -642,7 +642,7 @@ export class DrawBlisWineRackTool extends DrawWineRackTool
br.ApplyMatrix(MoveMatrix(new Vector3(this.space.Size.x - actualWidth))); br.ApplyMatrix(MoveMatrix(new Vector3(this.space.Size.x - actualWidth)));
} }
br.ApplyMatrix(this.space.m_SpaceOCS); br.ApplyMatrix(this.space.m_SpaceOCS);
app.m_Database.ModelSpace.Append(br); app.Database.ModelSpace.Append(br);
} }
} }
} }

@ -99,7 +99,7 @@ export class DrawUprightWineRackTool extends DrawWineRackTool
let br = verBr.Clone(); let br = verBr.Clone();
br.Name = "右板" + i; br.Name = "右板" + i;
br.ApplyMatrix(MoveMatrix(min.clone().add(new Vector3(config.gripWidth * i + (i - 1) * brThick)))).ApplyMatrix(space.m_SpaceOCS); br.ApplyMatrix(MoveMatrix(min.clone().add(new Vector3(config.gripWidth * i + (i - 1) * brThick)))).ApplyMatrix(space.m_SpaceOCS);
app.m_Database.ModelSpace.Append(br); app.Database.ModelSpace.Append(br);
} }
@ -112,7 +112,7 @@ export class DrawUprightWineRackTool extends DrawWineRackTool
br.ApplyMatrix(MoveMatrix( br.ApplyMatrix(MoveMatrix(
min.clone().add(new Vector3(spaceWidth, 0, gripHeight * i + (i - 1) * brThick)))) min.clone().add(new Vector3(spaceWidth, 0, gripHeight * i + (i - 1) * brThick))))
.ApplyMatrix(space.m_SpaceOCS); .ApplyMatrix(space.m_SpaceOCS);
app.m_Database.ModelSpace.Append(br); app.Database.ModelSpace.Append(br);
} }
} }
ParseBrTooth(br: Board, gripHeight?: number) ParseBrTooth(br: Board, gripHeight?: number)

@ -135,7 +135,7 @@ export class DrawWineRackTool extends Singleton
br.BoardProcessOption.bigHoleDir = FaceDirection.Back; br.BoardProcessOption.bigHoleDir = FaceDirection.Back;
br.Position = position; br.Position = position;
br.ApplyMatrix(this.space.m_SpaceOCS); br.ApplyMatrix(this.space.m_SpaceOCS);
app.m_Database.ModelSpace.Append(br); app.Database.ModelSpace.Append(br);
} }
if (config.isDrawVer && (config.arrayType === EWRackArrayType.Fixed || config.fullType === EFullType.ByHeight)) if (config.isDrawVer && (config.arrayType === EWRackArrayType.Fixed || config.fullType === EFullType.ByHeight))
{ {
@ -157,7 +157,7 @@ export class DrawWineRackTool extends Singleton
this.GetBoardProcessOption(br); this.GetBoardProcessOption(br);
br.Position = position; br.Position = position;
br.ApplyMatrix(this.space.m_SpaceOCS); br.ApplyMatrix(this.space.m_SpaceOCS);
app.m_Database.ModelSpace.Append(br); app.Database.ModelSpace.Append(br);
} }
} }
} }

@ -10,16 +10,16 @@ export class DrawCircle0 implements Command
async exec() async exec()
{ {
let cir = new Circle(new THREE.Vector3(0, 0, 0), 10); let cir = new Circle(new THREE.Vector3(0, 0, 0), 10);
app.m_Database.ModelSpace.Append(cir); app.Database.ModelSpace.Append(cir);
let p = new THREE.Vector3(0, 0, 0); let p = new THREE.Vector3(0, 0, 0);
app.m_Viewer.WorldToScreen(p); app.Viewer.WorldToScreen(p);
app.m_Viewer.ScreenToWorld(p); app.Viewer.ScreenToWorld(p);
let line = new Line(new THREE.Vector3(0, 0, 0), new THREE.Vector3(100, 0, 0)); let line = new Line(new THREE.Vector3(0, 0, 0), new THREE.Vector3(100, 0, 0));
app.m_Database.ModelSpace.Append(line); app.Database.ModelSpace.Append(line);
} }
} }

@ -13,13 +13,13 @@ export class Entsel implements Command
async exec() async exec()
{ {
let dyn = new PromptBlock(DynamicInputManage.GetManage()); let dyn = new PromptBlock(DynamicInputManage.GetManage());
let en = await app.m_Editor.GetEntity({ let en = await app.Editor.GetEntity({
Callback: (res) => Callback: (res) =>
{ {
if (res.Status == PromptStatus.OK) if (res.Status == PromptStatus.OK)
{ {
dyn.Visible = true; dyn.Visible = true;
let vcs = app.m_Editor.m_MouseCtrl.m_CurMousePointVCS.clone(); let vcs = app.Editor.MouseCtrl.m_CurMousePointVCS.clone();
vcs.add(new Vector3(0, -20, 0)); vcs.add(new Vector3(0, -20, 0));
dyn.SetPostion(vcs); dyn.SetPostion(vcs);
@ -36,7 +36,7 @@ export class Entsel implements Command
if (en.Status == PromptStatus.OK) if (en.Status == PromptStatus.OK)
{ {
en.Entity.ColorIndex = 1; en.Entity.ColorIndex = 1;
app.m_Viewer.m_bNeedUpdate = true; app.Viewer.UpdateRender();
} }
dyn.Destroy(); dyn.Destroy();

@ -7,7 +7,7 @@ export class Command_Erase implements Command
{ {
async exec() async exec()
{ {
let ssRes = await app.m_Editor.GetSelection({ UseSelect: true }); let ssRes = await app.Editor.GetSelection({ UseSelect: true });
if (ssRes.Status != PromptStatus.OK) return; if (ssRes.Status != PromptStatus.OK) return;
for (let obj of ssRes.SelectSet.SelectObjectList) for (let obj of ssRes.SelectSet.SelectObjectList)

@ -5,6 +5,6 @@ export class Command_Esc implements Command
{ {
async exec() async exec()
{ {
app.m_Editor.m_SelectCtrl.Cancel(); app.Editor.SelectCtrl.Cancel();
} }
} }

@ -9,7 +9,7 @@ export class Command_Explode implements Command
{ {
async exec() async exec()
{ {
let ssRes = await app.m_Editor.GetSelection({ UseSelect: true }); let ssRes = await app.Editor.GetSelection({ UseSelect: true });
if (ssRes.Status != PromptStatus.OK) return; if (ssRes.Status != PromptStatus.OK) return;
let ss = ssRes.SelectSet; let ss = ssRes.SelectSet;
@ -18,7 +18,7 @@ export class Command_Explode implements Command
{ {
if (en instanceof Line || en instanceof Arc || en instanceof Circle) if (en instanceof Line || en instanceof Arc || en instanceof Circle)
{ {
app.m_Editor.Prompt('无法分解'); app.Editor.Prompt('无法分解');
continue; continue;
} }
let ens = en.Explode(); let ens = en.Explode();
@ -26,7 +26,7 @@ export class Command_Explode implements Command
for (let e of ens) for (let e of ens)
{ {
app.m_Database.ModelSpace.Append(e); app.Database.ModelSpace.Append(e);
} }
} }
} }

@ -16,7 +16,7 @@ export class Command_ExplosionMap implements Command
count = 0; count = 0;
async exec() async exec()
{ {
let view = app.m_Viewer; let view = app.Viewer;
if (this.timer) if (this.timer)
{ {
clearInterval(this.timer); clearInterval(this.timer);
@ -31,7 +31,7 @@ export class Command_ExplosionMap implements Command
view.UpdateRender(); view.UpdateRender();
} }
let brs = await app.m_Editor.GetSelection({ let brs = await app.Editor.GetSelection({
UseSelect: true, UseSelect: true,
Msg: "请选择需要展示爆炸图的板件", Msg: "请选择需要展示爆炸图的板件",
Filter: { Filter: {
@ -57,7 +57,7 @@ export class Command_ExplosionMap implements Command
if (this.moveObjs.length === 0) if (this.moveObjs.length === 0)
{ {
app.m_Editor.Prompt("没有检测到板件,无法展示爆炸图"); app.Editor.Prompt("没有检测到板件,无法展示爆炸图");
return; return;
} }

@ -27,7 +27,7 @@ export class Command_Extend implements Command
{ {
async exec() async exec()
{ {
let exRefSsRes = await app.m_Editor.GetSelection({ let exRefSsRes = await app.Editor.GetSelection({
Msg: "请选择对象<全部选择>:", Msg: "请选择对象<全部选择>:",
AllowNone: true, AllowNone: true,
UseSelect: true, UseSelect: true,
@ -37,14 +37,14 @@ export class Command_Extend implements Command
let exRefCus = exRefSsRes.SelectSet.SelectEntityList as Curve[]; let exRefCus = exRefSsRes.SelectSet.SelectEntityList as Curve[];
if (exRefCus.length === 0) if (exRefCus.length === 0)
exRefCus = (app.m_Database.ModelSpace.Entitys as Curve[]) exRefCus = (app.Database.ModelSpace.Entitys as Curve[])
.filter(en => en instanceof Curve && !en.IsErase); .filter(en => en instanceof Curve && !en.IsErase);
while (true) while (true)
{ {
app.m_Database.hm.StartMark(); app.Database.hm.StartMark();
//选择延伸的对象. //选择延伸的对象.
let exSs = await app.m_Editor.GetSelection({ let exSs = await app.Editor.GetSelection({
Msg: "请选择延伸对象:", Msg: "请选择延伸对象:",
Once: true, Once: true,
AllowNone: true, AllowNone: true,
@ -67,7 +67,7 @@ export class Command_Extend implements Command
{ {
JigUtils.End(); JigUtils.End();
this.Extend(entss.SelectSet, exRefCus, true); this.Extend(entss.SelectSet, exRefCus, true);
app.m_Editor.UpdateScreen(); app.Editor.UpdateScreen();
} }
Extend(selectSet: SelectSet, exRefCus: Curve[], bDynmic: boolean = false) Extend(selectSet: SelectSet, exRefCus: Curve[], bDynmic: boolean = false)
@ -86,7 +86,7 @@ export class Command_Extend implements Command
{ {
selectCenterPt = set.m_PickPointVcs.clone(); selectCenterPt = set.m_PickPointVcs.clone();
} }
app.m_Viewer.ScreenToWorld(selectCenterPt); app.Viewer.ScreenToWorld(selectCenterPt);
for (let cu of set.SelectEntityList as Curve[]) for (let cu of set.SelectEntityList as Curve[])
{ {

@ -25,11 +25,11 @@ export class CommandFillet implements Command
} }
async exec() async exec()
{ {
this.m_FilletUtils.m_FilletRadius = this.m_FilletRadius; this.m_FilletUtils.FilletRadius = this.m_FilletRadius;
let oldUcs = app.m_Editor.UCSMatrix; let oldUcs = app.Editor.UCSMatrix;
app.m_Editor.Prompt(`倒角半径:${FixedNotZero(this.m_FilletRadius, 3)}`); app.Editor.Prompt(`倒角半径:${FixedNotZero(this.m_FilletRadius, 3)}`);
//拾取曲线 //拾取曲线
let enRes1 = await this.SelectCurve([ let enRes1 = await this.SelectCurve([
{ msg: "放弃", key: "U" }, { msg: "放弃", key: "U" },
@ -37,7 +37,7 @@ export class CommandFillet implements Command
{ msg: "半径", key: "R" }, { msg: "半径", key: "R" },
{ msg: "修剪", key: "T" }, { msg: "修剪", key: "T" },
{ msg: "多个", key: "M" }]); { msg: "多个", key: "M" }]);
app.m_Editor.UCSMatrix = oldUcs; app.Editor.UCSMatrix = oldUcs;
if (!enRes1) return; if (!enRes1) return;
enRes1.Entity.UpdateJigMaterial(); enRes1.Entity.UpdateJigMaterial();
@ -56,35 +56,35 @@ export class CommandFillet implements Command
if (!res2.Entity) if (!res2.Entity)
{ {
lastCu = undefined; lastCu = undefined;
app.m_Editor.UpdateScreen(); app.Editor.UpdateScreen();
return; return;
} }
app.m_Editor.UCSMatrix = res2.Entity.OCS; app.Editor.UCSMatrix = res2.Entity.OCS;
res2.Entity.UpdateJigMaterial(); res2.Entity.UpdateJigMaterial();
lastCu = res2.Entity as Curve; lastCu = res2.Entity as Curve;
let fres = this.m_FilletUtils.Fillet(enRes1, res2); let fres = this.m_FilletUtils.Fillet(enRes1, res2);
for (let v in fres) for (let v in fres)
if (fres[v]) if (fres[v])
JigUtils.Draw(fres[v]) JigUtils.Draw(fres[v])
app.m_Editor.UpdateScreen(); app.Editor.UpdateScreen();
} }
let keydownUpdateRadius = (e: KeyboardEvent) => let keydownUpdateRadius = (e: KeyboardEvent) =>
{ {
if (enRes2 && e.code === KeyCode.ShiftLeft) if (enRes2 && e.code === KeyCode.ShiftLeft)
{ {
if (app.m_Editor.m_KeyCtrl.KeyIsDown(KeyCode.ShiftLeft)) if (app.Editor.KeyCtrl.KeyIsDown(KeyCode.ShiftLeft))
this.m_FilletUtils.m_FilletRadius = 0; this.m_FilletUtils.FilletRadius = 0;
else else
this.m_FilletUtils.m_FilletRadius = this.m_FilletRadius; this.m_FilletUtils.FilletRadius = this.m_FilletRadius;
jigCallBack(enRes2); jigCallBack(enRes2);
} }
} }
let rm1 = end(app.m_Editor.m_KeyCtrl, app.m_Editor.m_KeyCtrl.OnKeyDown, keydownUpdateRadius); let rm1 = end(app.Editor.KeyCtrl, app.Editor.KeyCtrl.OnKeyDown, keydownUpdateRadius);
let rm2 = end(app.m_Editor.m_KeyCtrl, app.m_Editor.m_KeyCtrl.OnKeyUp, keydownUpdateRadius); let rm2 = end(app.Editor.KeyCtrl, app.Editor.KeyCtrl.OnKeyUp, keydownUpdateRadius);
while (true) while (true)
{ {
enRes2 = await app.m_Editor.GetEntity({ enRes2 = await app.Editor.GetEntity({
Msg: "选择第二个对象,或按住shift键选择对象以应用角点或输入半径:", Msg: "选择第二个对象,或按住shift键选择对象以应用角点或输入半径:",
Filter: { Filter: {
filterTypes: [Curve], filterTypes: [Curve],
@ -108,7 +108,7 @@ export class CommandFillet implements Command
else if (enRes2.Status !== PromptStatus.None) else if (enRes2.Status !== PromptStatus.None)
break; break;
} }
app.m_Editor.UCSMatrix = oldUcs; app.Editor.UCSMatrix = oldUcs;
rm1(); rm1();
rm2(); rm2();
@ -135,24 +135,24 @@ export class CommandFillet implements Command
enRes2.Entity.Erase(); enRes2.Entity.Erase();
if (res.arc) if (res.arc)
app.m_Database.ModelSpace.Append(res.arc); app.Database.ModelSpace.Append(res.arc);
} }
} }
UpdateFilletRadius(newRadius: number) UpdateFilletRadius(newRadius: number)
{ {
if (newRadius < 0 || isNaN(newRadius)) if (newRadius < 0 || isNaN(newRadius))
app.m_Editor.Prompt("半径不能为负!"); app.Editor.Prompt("半径不能为负!");
this.m_FilletRadius = Math.abs(newRadius); this.m_FilletRadius = Math.abs(newRadius);
window.localStorage.setItem(RADKEY, this.m_FilletRadius.toString()); window.localStorage.setItem(RADKEY, this.m_FilletRadius.toString());
this.m_FilletUtils.m_FilletRadius = this.m_FilletRadius; this.m_FilletUtils.FilletRadius = this.m_FilletRadius;
} }
async FilletBoard(enRes: PromptEntityResult) async FilletBoard(enRes: PromptEntityResult)
{ {
//------1.画辅助线 //------1.画辅助线
let ptRes = await app.m_Editor.GetPoint({ let ptRes = await app.Editor.GetPoint({
BasePoint: enRes.Point, BasePoint: enRes.Point,
AllowDrawRubberBand: true, AllowDrawRubberBand: true,
AllowNone: true, AllowNone: true,
@ -169,14 +169,14 @@ export class CommandFillet implements Command
br.ContourCurve = fres; br.ContourCurve = fres;
} }
else else
app.m_Editor.Prompt(fres); app.Editor.Prompt(fres);
} }
async SelectCurve(keyword: KeyWord[]): Promise<PromptEntityResult> async SelectCurve(keyword: KeyWord[]): Promise<PromptEntityResult>
{ {
while (true) while (true)
{ {
let enRes = await app.m_Editor.GetEntity({ let enRes = await app.Editor.GetEntity({
Msg: `选择第一个对象<R:${FixedNotZero(this.m_FilletRadius, 3)}>:`, Msg: `选择第一个对象<R:${FixedNotZero(this.m_FilletRadius, 3)}>:`,
KeyWordList: keyword, KeyWordList: keyword,
Filter: { filterTypes: [Curve, Board] }, Filter: { filterTypes: [Curve, Board] },
@ -184,7 +184,7 @@ export class CommandFillet implements Command
{ {
//将用户坐标系转换到实体坐标系 //将用户坐标系转换到实体坐标系
if (res.Entity) if (res.Entity)
app.m_Editor.UCSMatrix = res.Entity.OCS; app.Editor.UCSMatrix = res.Entity.OCS;
}, },
}); });
switch (enRes.Status) switch (enRes.Status)
@ -204,7 +204,7 @@ export class CommandFillet implements Command
case PromptStatus.Keyword: case PromptStatus.Keyword:
if (enRes.StringResult === "R") if (enRes.StringResult === "R")
{ {
let ret = await app.m_Editor.GetDistance({ Msg: "指定圆角半径:", Default: this.m_FilletRadius }); let ret = await app.Editor.GetDistance({ Msg: "指定圆角半径:", Default: this.m_FilletRadius });
if (ret.Status === PromptStatus.OK) if (ret.Status === PromptStatus.OK)
this.UpdateFilletRadius(ret.Distance); this.UpdateFilletRadius(ret.Distance);
else if (ret.Status === PromptStatus.Cancel) else if (ret.Status === PromptStatus.Cancel)
@ -218,7 +218,7 @@ export class CommandFillet implements Command
let enRes: PromptEntityResult; let enRes: PromptEntityResult;
while (this.m_FilletRadius === 0) while (this.m_FilletRadius === 0)
{ {
let ret = await app.m_Editor.GetDistance({ Msg: "当前半径为0请指定圆角半径:", Default: this.m_FilletRadius }); let ret = await app.Editor.GetDistance({ Msg: "当前半径为0请指定圆角半径:", Default: this.m_FilletRadius });
if (ret.Status === PromptStatus.OK) if (ret.Status === PromptStatus.OK)
this.UpdateFilletRadius(Math.abs(ret.Distance)); this.UpdateFilletRadius(Math.abs(ret.Distance));
else if (ret.Status === PromptStatus.Cancel) else if (ret.Status === PromptStatus.Cancel)
@ -226,7 +226,7 @@ export class CommandFillet implements Command
} }
while (true) while (true)
{ {
enRes = await app.m_Editor.GetEntity({ enRes = await app.Editor.GetEntity({
Msg: "请选择二维多段线或输入半径:", Msg: "请选择二维多段线或输入半径:",
Filter: { filterTypes: [Polyline] }, Filter: { filterTypes: [Polyline] },
Callback: (e) => Callback: (e) =>
@ -240,7 +240,7 @@ export class CommandFillet implements Command
if (!e || !e.Entity) if (!e || !e.Entity)
{ {
app.m_Editor.UpdateScreen(); app.Editor.UpdateScreen();
lastPl = undefined; lastPl = undefined;
return; return;
} }
@ -252,7 +252,7 @@ export class CommandFillet implements Command
lastPl = e.Entity as Polyline; lastPl = e.Entity as Polyline;
lastPl.UpdateJigMaterial(); lastPl.UpdateJigMaterial();
app.m_Editor.UpdateScreen(); app.Editor.UpdateScreen();
} }
}); });

@ -74,7 +74,7 @@ type CurveExtend = { Curve: Curve, ExtType: ExtendType };
export class FilletUtils export class FilletUtils
{ {
m_FilletRadius: number; FilletRadius: number;
Fillet(enRes1: PromptEntityResult, enRes2: PromptEntityResult): FilletRes Fillet(enRes1: PromptEntityResult, enRes2: PromptEntityResult): FilletRes
{ {
CircleEnResToArc(enRes1); CircleEnResToArc(enRes1);
@ -110,7 +110,7 @@ export class FilletUtils
let splitedCu1 = this.SplitCurve(enRes1, iPt, interPts); let splitedCu1 = this.SplitCurve(enRes1, iPt, interPts);
let splitedCu2 = this.SplitCurve(enRes2, iPt, interPts); let splitedCu2 = this.SplitCurve(enRes2, iPt, interPts);
let fRadius = this.m_FilletRadius; let fRadius = this.FilletRadius;
let res: FilletRes = { cu1: splitedCu1.Curve, cu2: splitedCu2.Curve, arc: undefined }; let res: FilletRes = { cu1: splitedCu1.Curve, cu2: splitedCu2.Curve, arc: undefined };
@ -172,7 +172,7 @@ export class FilletUtils
let v2 = arcP2.clone().sub(center).applyMatrix4(cu1RoOcsInv); let v2 = arcP2.clone().sub(center).applyMatrix4(cu1RoOcsInv);
//绘制圆弧 //绘制圆弧
let arc = new Arc(new Vector3(), this.m_FilletRadius, angle(v1), angle(v2), v1.cross(v2).z < 0); let arc = new Arc(new Vector3(), this.FilletRadius, angle(v1), angle(v2), v1.cross(v2).z < 0);
arc.ApplyMatrix(splitedCu1.Curve.OCS); arc.ApplyMatrix(splitedCu1.Curve.OCS);
arc.Center = center; arc.Center = center;
res.arc = arc; res.arc = arc;
@ -552,8 +552,8 @@ export class FilletUtils
let a1 = enRes1.Entity as Arc; let a1 = enRes1.Entity as Arc;
let a2 = enRes2.Entity as Arc; let a2 = enRes2.Entity as Arc;
let arcO1 = a1.GetOffsetCurves(this.m_FilletRadius * (a1.IsClockWise ? -1 : 1))[0]; let arcO1 = a1.GetOffsetCurves(this.FilletRadius * (a1.IsClockWise ? -1 : 1))[0];
let arcO2 = a2.GetOffsetCurves(this.m_FilletRadius * (a2.IsClockWise ? -1 : 1))[0]; let arcO2 = a2.GetOffsetCurves(this.FilletRadius * (a2.IsClockWise ? -1 : 1))[0];
// arcO1.ColorIndex = 6; // arcO1.ColorIndex = 6;
// arcO2.ColorIndex = 6; // arcO2.ColorIndex = 6;
@ -578,7 +578,7 @@ export class FilletUtils
let narcP1 = a1.GetClosestPointTo(narcCenter, true);//两圆弧和相切弧的交点 let narcP1 = a1.GetClosestPointTo(narcCenter, true);//两圆弧和相切弧的交点
let narcP2 = a2.GetClosestPointTo(narcCenter, true); let narcP2 = a2.GetClosestPointTo(narcCenter, true);
let tempCircle = new Circle(narcCenter, this.m_FilletRadius); let tempCircle = new Circle(narcCenter, this.FilletRadius);
let closestPt = a1.GetClosestPointTo(a2.Center, true);//两曲线距离对方圆心最近的点 let closestPt = a1.GetClosestPointTo(a2.Center, true);//两曲线距离对方圆心最近的点
let narcMP = tempCircle.GetClosestPointTo(closestPt, false);//相切圆距离closestPt最近的点 let narcMP = tempCircle.GetClosestPointTo(closestPt, false);//相切圆距离closestPt最近的点
@ -631,8 +631,8 @@ export class FilletUtils
let dir = GetPointAtCurveDir(line, arc.Center) ? 1 : -1; let dir = GetPointAtCurveDir(line, arc.Center) ? 1 : -1;
let lineO = line.GetOffsetCurves(this.m_FilletRadius * dir)[0]; let lineO = line.GetOffsetCurves(this.FilletRadius * dir)[0];
let arcO = arc.GetOffsetCurves(this.m_FilletRadius * (arc.IsClockWise ? -1 : 1))[0];// tip面积逆时针为正, 顺时针为负. let arcO = arc.GetOffsetCurves(this.FilletRadius * (arc.IsClockWise ? -1 : 1))[0];// tip面积逆时针为正, 顺时针为负.
// lineO.ColorIndex = 6; // lineO.ColorIndex = 6;
// arcO.ColorIndex = 6; // arcO.ColorIndex = 6;
@ -657,7 +657,7 @@ export class FilletUtils
let arcP1 = line.GetClosestPointTo(arcCenter, true);//直线与相切圆的交点 let arcP1 = line.GetClosestPointTo(arcCenter, true);//直线与相切圆的交点
let arcP2 = arc.GetClosestPointTo(arcCenter, true);//圆弧与相切圆的交点 let arcP2 = arc.GetClosestPointTo(arcCenter, true);//圆弧与相切圆的交点
let tempCircle = new Circle(arcCenter, this.m_FilletRadius); let tempCircle = new Circle(arcCenter, this.FilletRadius);
let { closestPt, param } = line.GetClosestAtPoint(arc.Center, true); let { closestPt, param } = line.GetClosestAtPoint(arc.Center, true);
let arcMP = tempCircle.GetClosestPointTo(closestPt, false); let arcMP = tempCircle.GetClosestPointTo(closestPt, false);

@ -17,12 +17,12 @@ export async function Gesture_DrawLayerBoard(dirs: GestureDir[], path: Vector2[]
if (isLayer || isLb) if (isLayer || isLb)
{ {
let vcs = AsVector3(path[0]); let vcs = AsVector3(path[0]);
let view = app.m_Viewer; let view = app.Viewer;
let ptSelect = new PointSelectBoards(vcs, view, view.Scene.children); let ptSelect = new PointSelectBoards(vcs, view, view.Scene.children);
if (ptSelect.SelectBoards.length === 0) if (ptSelect.SelectBoards.length === 0)
{ {
app.m_Editor.Prompt("请选择有效的板件,或者周围没有效板件"); app.Editor.Prompt("请选择有效的板件,或者周围没有效板件");
return; return;
} }
@ -51,8 +51,8 @@ export async function Gesture_DrawLayerBoard(dirs: GestureDir[], path: Vector2[]
commandMachine.CommandStart("gs") commandMachine.CommandStart("gs")
app.m_Database.ModelSpace.Append(br); app.Database.ModelSpace.Append(br);
app.m_Editor.UpdateScreen(); app.Editor.UpdateScreen();
commandMachine.CommandEnd(); commandMachine.CommandEnd();
return true; return true;

@ -6,14 +6,14 @@ export class Command_HideSelected implements Command
{ {
async exec() async exec()
{ {
let selects = app.m_Editor.m_SelectCtrl.SelectSet.SelectEntityList; let selects = app.Editor.SelectCtrl.SelectSet.SelectEntityList;
if (selects.length !== 0) if (selects.length !== 0)
for (let e of selects) for (let e of selects)
e.Visible = false; e.Visible = false;
else else
app.m_Editor.Prompt("没有选中实体,隐藏失败!"); app.Editor.Prompt("没有选中实体,隐藏失败!");
app.m_Viewer.m_OutlinePass.selectedObjects.length = 0; app.Viewer.OutlinePass.selectedObjects.length = 0;
} }
} }
@ -21,7 +21,7 @@ export class Command_ShowAll implements Command
{ {
async exec() async exec()
{ {
app.m_Database.ModelSpace.Entitys.forEach(o => app.Database.ModelSpace.Entitys.forEach(o =>
{ {
o.Visible = true; o.Visible = true;
}); });
@ -32,9 +32,9 @@ export class Command_HideUnselected implements Command
{ {
async exec() async exec()
{ {
let selects = app.m_Editor.m_SelectCtrl.SelectSet.SelectEntityList; let selects = app.Editor.SelectCtrl.SelectSet.SelectEntityList;
let count = 0; let count = 0;
app.m_Database.ModelSpace.Entitys.forEach(o => app.Database.ModelSpace.Entitys.forEach(o =>
{ {
if (!selects.includes(o) && !(o instanceof Light)) if (!selects.includes(o) && !(o instanceof Light))
{ {
@ -43,6 +43,6 @@ export class Command_HideUnselected implements Command
} }
}); });
if (count === 0) if (count === 0)
app.m_Editor.Prompt("没有未选中的实体,隐藏失败!"); app.Editor.Prompt("没有未选中的实体,隐藏失败!");
} }
} }

@ -25,9 +25,9 @@ export class Command_Insert implements Command
finfo = f; finfo = f;
} }
}; };
app.m_Editor.m_ModalManage.RenderModal(InsertModal, ModalPosition.Center, props); app.Editor.ModalManage.RenderModal(InsertModal, ModalPosition.Center, props);
let state = await app.m_Editor.m_ModalManage.Wait(); let state = await app.Editor.ModalManage.Wait();
if (state.Status !== ModalState.Ok || !finfo) if (state.Status !== ModalState.Ok || !finfo)
return; return;
@ -45,7 +45,7 @@ export class Command_Insert implements Command
{ {
let ensClone = db.ModelSpace.Entitys.map(e => JigUtils.Draw(e)); let ensClone = db.ModelSpace.Entitys.map(e => JigUtils.Draw(e));
let ptLast = new Vector3(); let ptLast = new Vector3();
let ptRes = await app.m_Editor.GetPoint( let ptRes = await app.Editor.GetPoint(
{ {
Msg: "请点击移动终点:", Msg: "请点击移动终点:",
Callback: (p: Vector3) => Callback: (p: Vector3) =>
@ -58,7 +58,7 @@ export class Command_Insert implements Command
if (ptRes.Status === PromptStatus.OK) if (ptRes.Status === PromptStatus.OK)
{ {
let ens = app.m_Database.DeepCloneObjects(db.ModelSpace.Entitys, app.m_Database.ModelSpace) as Entity[]; let ens = app.Database.DeepCloneObjects(db.ModelSpace.Entitys, app.Database.ModelSpace) as Entity[];
let moveM = MoveMatrix(ptRes.Point); let moveM = MoveMatrix(ptRes.Point);
ens.forEach(e => e.ApplyMatrix(moveM)); ens.forEach(e => e.ApplyMatrix(moveM));
} }

@ -18,7 +18,7 @@ export class Command_Join implements Command
{ {
async exec() async exec()
{ {
let exSsRes = await app.m_Editor.GetSelection({ Msg: "请选择对象<全部选择>:", UseSelect: true, Filter: { filterTypes: [Curve, Board] } }); let exSsRes = await app.Editor.GetSelection({ Msg: "请选择对象<全部选择>:", UseSelect: true, Filter: { filterTypes: [Curve, Board] } });
if (exSsRes.Status === PromptStatus.Cancel) if (exSsRes.Status === PromptStatus.Cancel)
return; return;
@ -84,7 +84,7 @@ export class Command_Join implements Command
} }
if (pl.Id === undefined) if (pl.Id === undefined)
app.m_Database.ModelSpace.Append(pl); app.Database.ModelSpace.Append(pl);
} }
} }
@ -138,7 +138,7 @@ export class Command_Join implements Command
{ {
if (isConverToCircle === undefined) if (isConverToCircle === undefined)
{ {
let keyRes = await app.m_Editor.GetKeyWords({ let keyRes = await app.Editor.GetKeyWords({
Msg: "合并的圆弧段组成了一个圆。要转换为圆吗?", Msg: "合并的圆弧段组成了一个圆。要转换为圆吗?",
KeyWordList: [ KeyWordList: [
{ msg: "是", key: "Y" }, { msg: "是", key: "Y" },
@ -152,7 +152,7 @@ export class Command_Join implements Command
arc.Erase(); arc.Erase();
arc2.Erase(); arc2.Erase();
let cir = new Circle(arc.Center, arc.Radius); let cir = new Circle(arc.Center, arc.Radius);
app.m_Database.ModelSpace.Append(cir); app.Database.ModelSpace.Append(cir);
} }
} }
else else

@ -11,9 +11,9 @@ export class DrawLattice implements Command
async exec() async exec()
{ {
const store = LatticeDrawerStore.GetInstance() as LatticeDrawerStore; const store = LatticeDrawerStore.GetInstance() as LatticeDrawerStore;
app.m_Editor.m_ModalManage.RenderModal(LatticeDrawer, ModalPosition.Center, { store }); app.Editor.ModalManage.RenderModal(LatticeDrawer, ModalPosition.Center, { store });
let res = await app.m_Editor.m_ModalManage.Wait(); let res = await app.Editor.ModalManage.Wait();
if (res.Status === ModalState.Cancel) if (res.Status === ModalState.Cancel)
return; return;

@ -70,7 +70,7 @@ export class DrawLatticeDrawerTool extends Singleton
pos.add(new Vector3(gripWidth * i + (i - 1) * config.thickness)); pos.add(new Vector3(gripWidth * i + (i - 1) * config.thickness));
br.Position = pos; br.Position = pos;
br.ApplyMatrix(space.m_SpaceOCS); br.ApplyMatrix(space.m_SpaceOCS);
app.m_Database.ModelSpace.Append(br); app.Database.ModelSpace.Append(br);
} }
let beBr = Board.CreateBoard(size.z, size.x, config.thickness, BoardType.Behind); let beBr = Board.CreateBoard(size.z, size.x, config.thickness, BoardType.Behind);
@ -86,7 +86,7 @@ export class DrawLatticeDrawerTool extends Singleton
pos.add(new Vector3(0, (gripDepth + config.thickness) * i)); pos.add(new Vector3(0, (gripDepth + config.thickness) * i));
br.Position = pos; br.Position = pos;
br.ApplyMatrix(space.m_SpaceOCS); br.ApplyMatrix(space.m_SpaceOCS);
app.m_Database.ModelSpace.Append(br); app.Database.ModelSpace.Append(br);
} }
this.End(); this.End();

@ -10,12 +10,12 @@ export class Command_Length implements Command
{ {
while (true) while (true)
{ {
let enRes = await app.m_Editor.GetEntity(); let enRes = await app.Editor.GetEntity();
if (enRes.Status === PromptStatus.OK) if (enRes.Status === PromptStatus.OK)
{ {
if (enRes.Entity instanceof Curve) if (enRes.Entity instanceof Curve)
{ {
app.m_Editor.Prompt(enRes.Entity.Length.toFixed(8)); app.Editor.Prompt(enRes.Entity.Length.toFixed(8));
} }
} }
else else

@ -8,7 +8,7 @@ export class Command_Lisp
{ {
async exec() async exec()
{ {
let ssRes = await app.m_Editor.GetEntity(); let ssRes = await app.Editor.GetEntity();
if (ssRes.Status != PromptStatus.OK) return; if (ssRes.Status != PromptStatus.OK) return;
let pl = ssRes.Entity as Polyline; let pl = ssRes.Entity as Polyline;

@ -18,14 +18,14 @@ export class MirrorCommand implements Command
{ {
async exec() async exec()
{ {
let enRes = await app.m_Editor.GetSelection({ let enRes = await app.Editor.GetSelection({
Msg: "选择对象", UseSelect: true Msg: "选择对象", UseSelect: true
}); });
if (enRes.Status === PromptStatus.Cancel) if (enRes.Status === PromptStatus.Cancel)
return; return;
let ens = enRes.SelectSet.SelectEntityList; let ens = enRes.SelectSet.SelectEntityList;
let ptRes = await app.m_Editor.GetPoint({ let ptRes = await app.Editor.GetPoint({
Msg: "选择镜像第一点" Msg: "选择镜像第一点"
}); });
if (ptRes.Status === PromptStatus.Cancel) if (ptRes.Status === PromptStatus.Cancel)
@ -33,7 +33,7 @@ export class MirrorCommand implements Command
let p1 = ptRes.Point; let p1 = ptRes.Point;
let cloneEns = ens.map(en => JigUtils.Draw(en)); let cloneEns = ens.map(en => JigUtils.Draw(en));
ptRes = await app.m_Editor.GetPoint({ ptRes = await app.Editor.GetPoint({
Msg: "选择镜像第二点", Msg: "选择镜像第二点",
BasePoint: p1, BasePoint: p1,
AllowDrawRubberBand: true, AllowDrawRubberBand: true,
@ -55,7 +55,7 @@ export class MirrorCommand implements Command
if (ptRes.Status === PromptStatus.Cancel) if (ptRes.Status === PromptStatus.Cancel)
return; return;
let kwRes = await app.m_Editor.GetKeyWords({ let kwRes = await app.Editor.GetKeyWords({
Msg: "是否保留源对象", Msg: "是否保留源对象",
KeyWordList: [{ msg: "是", key: "Y" }, { msg: "否", key: "N" }] KeyWordList: [{ msg: "是", key: "Y" }, { msg: "否", key: "N" }]
}); });
@ -69,6 +69,6 @@ export class MirrorCommand implements Command
} }
for (let e of cloneEns) for (let e of cloneEns)
app.m_Database.ModelSpace.Append(e); app.Database.ModelSpace.Append(e);
} }
} }

@ -8,10 +8,10 @@ export class Command_Move implements Command
{ {
async exec() async exec()
{ {
let ssRes = await app.m_Editor.GetSelection({ UseSelect: true }); let ssRes = await app.Editor.GetSelection({ UseSelect: true });
if (ssRes.Status != PromptStatus.OK) return; if (ssRes.Status != PromptStatus.OK) return;
let ptRes = await app.m_Editor.GetPoint({ Msg: "请点击移动基点:" }); let ptRes = await app.Editor.GetPoint({ Msg: "请点击移动基点:" });
if (ptRes.Status != PromptStatus.OK) if (ptRes.Status != PromptStatus.OK)
return; return;
@ -22,7 +22,7 @@ export class Command_Move implements Command
let ptBase = ptRes.Point; let ptBase = ptRes.Point;
let ptLast = ptBase.clone(); let ptLast = ptBase.clone();
let moveMatrix = new Matrix4(); let moveMatrix = new Matrix4();
ptRes = await app.m_Editor.GetPoint( ptRes = await app.Editor.GetPoint(
{ {
Msg: "请点击移动终点:", Msg: "请点击移动终点:",
Callback: (p: THREE.Vector3) => Callback: (p: THREE.Vector3) =>

@ -15,7 +15,7 @@ export class Command_Offset implements Command
offsetDis: number = 1; offsetDis: number = 1;
async exec() async exec()
{ {
let disRes = await app.m_Editor.GetDistance({ let disRes = await app.Editor.GetDistance({
Msg: "指定偏移距离:", Msg: "指定偏移距离:",
KeyWordList: [{ msg: "通过:", key: "T" }], KeyWordList: [{ msg: "通过:", key: "T" }],
Default: this.offsetDis Default: this.offsetDis
@ -29,15 +29,15 @@ export class Command_Offset implements Command
else else
return; return;
let oldUCS = app.m_Editor.UCSMatrix; let oldUCS = app.Editor.UCSMatrix;
while (true) while (true)
{ {
app.m_Database.hm.StartMark(); app.Database.hm.StartMark();
let enRes = await app.m_Editor.GetEntity({ Msg: "选择要偏移的对象:" }); let enRes = await app.Editor.GetEntity({ Msg: "选择要偏移的对象:" });
if (enRes.Status === PromptStatus.OK) if (enRes.Status === PromptStatus.OK)
{ {
app.m_Editor.UCSMatrix = enRes.Entity.OCS; app.Editor.UCSMatrix = enRes.Entity.OCS;
} }
else if (enRes.Status === PromptStatus.None) else if (enRes.Status === PromptStatus.None)
continue; continue;
@ -47,7 +47,7 @@ export class Command_Offset implements Command
let cu = enRes.Entity as Curve; let cu = enRes.Entity as Curve;
if (cu instanceof Curve) if (cu instanceof Curve)
{ {
app.m_Viewer.m_OutlinePass.selectedObjects = [cu.DrawObject]; app.Viewer.OutlinePass.selectedObjects = [cu.DrawObject];
let state: GetOffsetStatus; let state: GetOffsetStatus;
if (isDyn) if (isDyn)
state = await this.GetDynOffsetDist(cu); state = await this.GetDynOffsetDist(cu);
@ -64,7 +64,7 @@ export class Command_Offset implements Command
} }
} }
app.m_Editor.UCSMatrix = oldUCS; app.Editor.UCSMatrix = oldUCS;
}//end exec }//end exec
//绘制偏移的对象 //绘制偏移的对象
@ -72,7 +72,7 @@ export class Command_Offset implements Command
{ {
cu.GetOffsetCurves(offsetDist).forEach(c => cu.GetOffsetCurves(offsetDist).forEach(c =>
{ {
app.m_Database.ModelSpace.Append(c); app.Database.ModelSpace.Append(c);
}); });
} }
@ -81,9 +81,9 @@ export class Command_Offset implements Command
{ {
let oldDir = 0; let oldDir = 0;
let oldSnap = app.m_Editor.GetPointServices.snapServices.Disabled; let oldSnap = app.Editor.GetPointServices.snapServices.Disabled;
app.m_Editor.GetPointServices.snapServices.Disabled = true; app.Editor.GetPointServices.snapServices.Disabled = true;
let ptRes = await app.m_Editor.GetPoint({ let ptRes = await app.Editor.GetPoint({
Msg: "指定要偏移的那一侧的点", Msg: "指定要偏移的那一侧的点",
Callback: (p: Vector3) => Callback: (p: Vector3) =>
{ {
@ -97,7 +97,7 @@ export class Command_Offset implements Command
} }
} }
}); });
app.m_Editor.GetPointServices.snapServices.Disabled = oldSnap; app.Editor.GetPointServices.snapServices.Disabled = oldSnap;
let status = { Status: ptRes.Status, offsetDist: 0 }; let status = { Status: ptRes.Status, offsetDist: 0 };
if (ptRes.Status === PromptStatus.OK) if (ptRes.Status === PromptStatus.OK)
{ {
@ -116,7 +116,7 @@ export class Command_Offset implements Command
while (true) while (true)
{ {
let dir: number = 0; let dir: number = 0;
let distRes = await app.m_Editor.GetDistance( let distRes = await app.Editor.GetDistance(
{ {
Msg: "指定通过点或输入偏移距离:", Msg: "指定通过点或输入偏移距离:",
KeyWordList: [{ key: "D", msg: isMulti ? "单个" : "多个" }], KeyWordList: [{ key: "D", msg: isMulti ? "单个" : "多个" }],
@ -149,7 +149,7 @@ export class Command_Offset implements Command
else if (distRes.StringResult === "D") else if (distRes.StringResult === "D")
{ {
isMulti = !isMulti; isMulti = !isMulti;
app.m_Editor.Prompt(`切换成功,当前<${isMulti ? "多个" : "单个"}>`); app.Editor.Prompt(`切换成功,当前<${isMulti ? "多个" : "单个"}>`);
} }
else else
return { Status: distRes.Status, offsetDist: distRes.Distance }; return { Status: distRes.Status, offsetDist: distRes.Distance };

@ -10,7 +10,7 @@ export class OffsetX implements Command
offsetDis: number = 1; offsetDis: number = 1;
async exec() async exec()
{ {
let ssRes = await app.m_Editor.GetEntity(); let ssRes = await app.Editor.GetEntity();
if (ssRes.Status != PromptStatus.OK) return; if (ssRes.Status != PromptStatus.OK) return;
let pl = ssRes.Entity as Polyline; let pl = ssRes.Entity as Polyline;
if (!pl) return; if (!pl) return;
@ -25,7 +25,7 @@ export class OffsetX implements Command
} }
else else
{ {
let disRes = await app.m_Editor.GetDistance({ let disRes = await app.Editor.GetDistance({
Msg: "指定偏移距离:", Msg: "指定偏移距离:",
KeyWordList: [{ msg: "通过", key: "T" }], KeyWordList: [{ msg: "通过", key: "T" }],
Default: this.offsetDis Default: this.offsetDis
@ -36,7 +36,7 @@ export class OffsetX implements Command
dis = -this.offsetDis; dis = -this.offsetDis;
if (pl.IsClockWise) dis = -dis; if (pl.IsClockWise) dis = -dis;
let disRes1 = await app.m_Editor.GetDistance({ let disRes1 = await app.Editor.GetDistance({
Msg: "步长:", Msg: "步长:",
KeyWordList: [{ msg: "通过", key: "T" }], KeyWordList: [{ msg: "通过", key: "T" }],
Default: 1 Default: 1
@ -61,7 +61,7 @@ export class OffsetX implements Command
if (step === 0) if (step === 0)
{ {
app.m_Editor.Prompt("步长不能为0,已经帮你转换成" + dis / 10); app.Editor.Prompt("步长不能为0,已经帮你转换成" + dis / 10);
step = dis / 10; step = dis / 10;
} }
let count = dis / step; let count = dis / step;
@ -77,6 +77,6 @@ export class OffsetX implements Command
} }
} }
offRes.forEach(c => app.m_Database.ModelSpace.Append(c)); offRes.forEach(c => app.Database.ModelSpace.Append(c));
} }
} }

@ -19,9 +19,9 @@ export class Open implements Command
store.m_CurrentFileId = fid; store.m_CurrentFileId = fid;
let cadF = new CADFiler(); let cadF = new CADFiler();
cadF.database = app.m_Database; cadF.database = app.Database;
cadF.Data = file; cadF.Data = file;
app.m_Database.FileRead(cadF); app.Database.FileRead(cadF);
RightPanelStore.GetInstance().lightStore.InitScene(); RightPanelStore.GetInstance().lightStore.InitScene();
} }
} }

@ -29,14 +29,14 @@ export class PasteClip
} }
let oldBasePt = data.basePt || new Vector3(); let oldBasePt = data.basePt || new Vector3();
let oldPt = app.m_Editor.m_MouseCtrl.m_CurMousePointWCS; let oldPt = app.Editor.MouseCtrl.m_CurMousePointWCS;
for (let en of ens) for (let en of ens)
{ {
let vec = en.Position.sub(oldBasePt); let vec = en.Position.sub(oldBasePt);
en.Position = oldPt.clone().add(vec); en.Position = oldPt.clone().add(vec);
} }
let ptRes = await app.m_Editor.GetPoint({ let ptRes = await app.Editor.GetPoint({
BasePoint: oldPt, BasePoint: oldPt,
Callback: p => Callback: p =>
{ {
@ -52,12 +52,12 @@ export class PasteClip
if (ptRes.Status === PromptStatus.OK) if (ptRes.Status === PromptStatus.OK)
for (let e of ens) for (let e of ens)
app.m_Database.ModelSpace.Append(e); app.Database.ModelSpace.Append(e);
} }
} }
catch (error) catch (error)
{ {
app.m_Editor.Prompt("黏贴遇到错误:" + error); app.Editor.Prompt("黏贴遇到错误:" + error);
} }
} }
} }

@ -12,7 +12,7 @@ export class Pedit implements Command
{ {
async exec() async exec()
{ {
let exSsRes = await app.m_Editor.GetSelection({ let exSsRes = await app.Editor.GetSelection({
Msg: "请选择对象<全部选择>:", Msg: "请选择对象<全部选择>:",
Filter: { filterTypes: [Curve] }, Filter: { filterTypes: [Curve] },
UseSelect: true UseSelect: true
@ -33,7 +33,7 @@ export class Pedit implements Command
if (cirs.length !== 0) if (cirs.length !== 0)
{ {
let keyRes = await app.m_Editor.GetKeyWords({ let keyRes = await app.Editor.GetKeyWords({
Msg: "检测到了圆,要转换为多段线吗?", Msg: "检测到了圆,要转换为多段线吗?",
KeyWordList: [ KeyWordList: [
{ msg: "是", key: "Y" }, { msg: "是", key: "Y" },
@ -46,7 +46,7 @@ export class Pedit implements Command
{ {
c.Erase(); c.Erase();
let pl = ConverCircleToPolyline(c); let pl = ConverCircleToPolyline(c);
app.m_Database.ModelSpace.Append(pl); app.Database.ModelSpace.Append(pl);
} }
} }
} }
@ -65,7 +65,7 @@ export class Pedit implements Command
pl.Join(cu); pl.Join(cu);
cu.Erase(); cu.Erase();
} }
app.m_Database.ModelSpace.Append(pl); app.Database.ModelSpace.Append(pl);
} }
} }
} }

@ -6,15 +6,15 @@ export class Command_RevPl implements Command
{ {
async exec() async exec()
{ {
let ss = await app.m_Editor.GetSelection({ UseSelect: true, Filter: { filterTypes: [Curve] } }); let ss = await app.Editor.GetSelection({ UseSelect: true, Filter: { filterTypes: [Curve] } });
for (let en of ss.SelectSet.SelectEntityList) for (let en of ss.SelectSet.SelectEntityList)
{ {
if (en instanceof Curve) if (en instanceof Curve)
{ {
en.Reverse(); en.Reverse();
app.m_Editor.Prompt("成功翻转曲线"); app.Editor.Prompt("成功翻转曲线");
} }
} }
app.m_Editor.UpdateScreen(); app.Editor.UpdateScreen();
} }
} }

@ -10,11 +10,11 @@ export class Command_Rotate implements Command
{ {
async exec() async exec()
{ {
let ss = await app.m_Editor.GetSelection({ Msg: "请选择需要旋转的对象:", UseSelect: true }); let ss = await app.Editor.GetSelection({ Msg: "请选择需要旋转的对象:", UseSelect: true });
if (ss.Status != PromptStatus.OK) if (ss.Status != PromptStatus.OK)
return; return;
let ptRes = await app.m_Editor.GetPoint({ Msg: "请输入第一个点:" }); let ptRes = await app.Editor.GetPoint({ Msg: "请输入第一个点:" });
if (ptRes.Status != PromptStatus.OK) if (ptRes.Status != PromptStatus.OK)
return; return;
@ -32,7 +32,7 @@ export class Command_Rotate implements Command
let basePt = pt1; let basePt = pt1;
while (true) while (true)
{ {
let anRes = await app.m_Editor.GetAngle({ let anRes = await app.Editor.GetAngle({
Msg: msg, Msg: msg,
KeyWordList: keyword, KeyWordList: keyword,
Callback: (newan: number) => Callback: (newan: number) =>
@ -48,7 +48,7 @@ export class Command_Rotate implements Command
if (isCopy) if (isCopy)
{ {
this.Update(pt1, anRes.Distance - refAng, cloneEns); this.Update(pt1, anRes.Distance - refAng, cloneEns);
cloneEns.forEach(en => app.m_Database.ModelSpace.Append(en)); cloneEns.forEach(en => app.Database.ModelSpace.Append(en));
} }
else else
this.Update(pt1, anRes.Distance - refAng, ens); this.Update(pt1, anRes.Distance - refAng, ens);
@ -62,7 +62,7 @@ export class Command_Rotate implements Command
} }
else if (anRes.StringResult === "R") else if (anRes.StringResult === "R")
{ {
let newAnRes = await app.m_Editor.GetAngle({ Msg: "指定参照角" }); let newAnRes = await app.Editor.GetAngle({ Msg: "指定参照角" });
if (newAnRes.Status === PromptStatus.Cancel) if (newAnRes.Status === PromptStatus.Cancel)
break; break;
refAng = newAnRes.Distance; refAng = newAnRes.Distance;
@ -83,7 +83,7 @@ export class Command_Rotate implements Command
let moveMat = new Matrix4().setPosition(basePt); let moveMat = new Matrix4().setPosition(basePt);
let moveMatInv = new Matrix4().getInverse(moveMat); let moveMatInv = new Matrix4().getInverse(moveMat);
let roMat = new Matrix4() let roMat = new Matrix4()
.makeRotationAxis(ZAxis.clone().applyMatrix4(app.m_Editor.UCSMatrix), Math.degToRad(an)); .makeRotationAxis(ZAxis.clone().applyMatrix4(app.Editor.UCSMatrix), Math.degToRad(an));
let mat = moveMat.multiply(roMat).multiply(moveMatInv); let mat = moveMat.multiply(roMat).multiply(moveMatInv);
ens.forEach(en => en.ApplyMatrix(mat)); ens.forEach(en => en.ApplyMatrix(mat));
} }

@ -34,13 +34,13 @@ export class RotateLayerBoard implements Command
async exec() async exec()
{ {
let store = RotateLayerBoardStore.GetInstance() as RotateLayerBoardStore; let store = RotateLayerBoardStore.GetInstance() as RotateLayerBoardStore;
app.m_Editor.m_ModalManage.RenderModal(RotateLayerBoardModal, ModalPosition.Center, { store }); app.Editor.ModalManage.RenderModal(RotateLayerBoardModal, ModalPosition.Center, { store });
let res = await app.m_Editor.m_ModalManage.Wait(); let res = await app.Editor.ModalManage.Wait();
if (res.Status === ModalState.Ok) if (res.Status === ModalState.Ok)
{ {
let enRes = await app.m_Editor.GetSelection({ let enRes = await app.Editor.GetSelection({
Msg: "选择修改的层板", Msg: "选择修改的层板",
Filter: { Filter: {
filterTypes: [Board], filterTypes: [Board],

@ -35,11 +35,11 @@ export class Save implements Command
getBlob() getBlob()
{ {
//生成预览图 //生成预览图
app.m_Viewer.OnSize(100, 100); app.Viewer.OnSize(100, 100);
app.m_Viewer.Render(); app.Viewer.Render();
let url = app.m_Viewer.m_Render.domElement.toDataURL("image/jpeg"); let url = app.Viewer.Renderer.domElement.toDataURL("image/jpeg");
app.m_Viewer.OnSize(); app.Viewer.OnSize();
app.m_Viewer.Render(); app.Viewer.Render();
return dataURItoBlob(url); return dataURItoBlob(url);
} }

@ -11,12 +11,12 @@ export class Command_Scale implements Command
{ {
async exec() async exec()
{ {
let ssRes = await app.m_Editor.GetSelection({ UseSelect: true }); let ssRes = await app.Editor.GetSelection({ UseSelect: true });
if (ssRes.Status != PromptStatus.OK) if (ssRes.Status != PromptStatus.OK)
return; return;
let ptRes = await app.m_Editor.GetPoint({ Msg: "请点击拉伸基点:" }); let ptRes = await app.Editor.GetPoint({ Msg: "请点击拉伸基点:" });
if (ptRes.Status != PromptStatus.OK) if (ptRes.Status != PromptStatus.OK)
return; return;
@ -44,7 +44,7 @@ export class Command_Scale implements Command
while (true) while (true)
{ {
let scaleRes = await app.m_Editor.GetDistance({ let scaleRes = await app.Editor.GetDistance({
BasePoint: ptRes.Point, BasePoint: ptRes.Point,
Msg: "请输入缩放比例或:", Msg: "请输入缩放比例或:",
KeyWordList: [{ key: "C", msg: "复制" }, { key: "R", msg: "参照" }], KeyWordList: [{ key: "C", msg: "复制" }, { key: "R", msg: "参照" }],
@ -62,7 +62,7 @@ export class Command_Scale implements Command
{ {
JigUtils.Restore(); JigUtils.Restore();
let disRes = await app.m_Editor.GetDistance({ let disRes = await app.Editor.GetDistance({
Msg: "点取或输入参照长度", Msg: "点取或输入参照长度",
}); });
if (disRes.Status === PromptStatus.Cancel) if (disRes.Status === PromptStatus.Cancel)
@ -71,7 +71,7 @@ export class Command_Scale implements Command
//参照缩放长度 //参照缩放长度
let referLen = disRes.Distance; let referLen = disRes.Distance;
let scaleRes = await app.m_Editor.GetDistance({ let scaleRes = await app.Editor.GetDistance({
Msg: "指定新的长度或", Msg: "指定新的长度或",
BasePoint: ptRes.Point, BasePoint: ptRes.Point,
KeyWordList: [{ key: "P", msg: "点" }], KeyWordList: [{ key: "P", msg: "点" }],
@ -91,7 +91,7 @@ export class Command_Scale implements Command
{ {
JigUtils.End(); JigUtils.End();
let disRes = await app.m_Editor.GetDistance({ let disRes = await app.Editor.GetDistance({
Msg: "点取或输入参照长度", Msg: "点取或输入参照长度",
}); });
if (disRes.Status === PromptStatus.Cancel) if (disRes.Status === PromptStatus.Cancel)
@ -124,7 +124,7 @@ export class Command_Scale implements Command
if (isCopy) if (isCopy)
{ {
let br = en.Clone().ApplyMatrix(scMat); let br = en.Clone().ApplyMatrix(scMat);
app.m_Database.ModelSpace.Append(br); app.Database.ModelSpace.Append(br);
} }
else else
en.ApplyMatrix(scMat); en.ApplyMatrix(scMat);

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save