pull/275/MERGE
ChenX 6 years ago
commit 00b4ce83c8

@ -79,3 +79,14 @@ test("异型板件,非常规坐标系", () =>
sealingSize = [10, 5, 5, 5, 10, 5];
testBrSealing(br, sealingSize);
})
test("异型板件,非相切圆弧", () =>
{
let data =
[1, "Board", 3, 2, 102, false, 1, 2, 0, [0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 112.87179487179475, -263.53276353276357, 0, 1], 2, 1200, 600.0000000000001, 18, false, "Polyline", 3, 2, 0, false, 0, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 5, [0, 0], 0, [600, 0], 0, [600, 1200], 0, [300, 1200], -0.563703247863248, [0, 900], 0, true, 0, 3, 0, 0, 0, 2, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 112.87179487179475, -263.53276353276357, 0, 1], 1, "右侧板", "{\"roomName\":\"\",\"cabinetName\":\"\",\"boardName\":\"\",\"material\":\"\",\"color\":\"\",\"lines\":0,\"bigHoleDir\":0,\"drillType\":\"three\",\"composingFace\":2,\"highSealed\":[{\"size\":1},{\"size\":2},{\"size\":3},{\"size\":4},{\"size\":5}],\"sealedUp\":\"1\",\"sealedDown\":\"1\",\"sealedLeft\":\"1\",\"sealedRight\":\"1\",\"spliteHeight\":\"\",\"spliteWidth\":\"\",\"spliteThickness\":\"\"}", 0, 0]
//第3段为圆弧
let br = LoadBoardsFromFileData(data)[0];
let sealingSize = [1, 1, 1, 1, 1];
testBrSealing(br, sealingSize);
sealingSize = [3, 5, 3, 3, 3];
testBrSealing(br, sealingSize);
})

@ -18,6 +18,10 @@ exports[`异型板件,常规坐标系 5`] = `2603082.551922608`;
exports[`异型板件,非常规坐标系 1`] = `75939516.39226122`;
exports[`异型板件,非常规坐标系 2`] = `75852693.84266448`;
exports[`异型板件,非常规坐标系 2`] = `75863286.03232267`;
exports[`异型板件,非常规坐标系 3`] = `75675829.72975093`;
exports[`异型板件,非常规坐标系 3`] = `75694680.60847881`;
exports[`异型板件,非相切圆弧 1`] = `635612.2751433643`;
exports[`异型板件,非相切圆弧 2`] = `626242.2196800548`;

@ -12,7 +12,9 @@ export class CopyClip
let f = new CADFiler();
f.Write(ss.SelectEntityList.length);
ss.SelectEntityList.forEach(e => f.WriteObject(e));
copyTextToClipboard(JSON.stringify(f.Data));
copyTextToClipboard(JSON.stringify({
file: f.Data,
basePt: app.m_Editor.m_MouseCtrl.m_CurMousePointWCS,
}));
}
}

@ -68,25 +68,6 @@ export abstract class DrawBoardTool implements Command
if (this.store.UseBoardProcessOption && this.space.m_Boards.length > 0)
this.store.GetBoardProcessOption(this.space.m_Boards[0]);
if (this.drawType === BoardType.Behind)
{
let backBrs = this.space.m_BoardMap.get(BoardType.Behind);
if (backBrs && backBrs.length > 0)
{
let keyRes = await app.m_Editor.GetKeyWords({
Msg: "当前选择空间已经存在背板,是否继续绘制?",
KeyWordList: [{ key: "1", msg: "是" }, { key: "2", msg: "否" },]
});
if (keyRes.Status === PromptStatus.Keyword)
{
if (keyRes.StringResult !== "1")
continue;
}
else
return;
}
}
this.buildBoard();
app.m_Editor.UpdateScreen();

@ -14,7 +14,7 @@ export class DrawSpecialShapedBoard implements Command
ext = new ExtureSolid();
async exec()
{
let { contour } = await SelectExtrudeContour(false);
let { contour, useCurves } = await SelectExtrudeContour(true);
if (contour)
{
@ -62,6 +62,11 @@ export class DrawSpecialShapedBoard implements Command
br.ApplyMatrix(toCurve);
ExtrudeApplyContour(br, contour);
app.m_Database.ModelSpace.Append(br);
//删除被应用的轮廓
if (useCurves)
for (let c of useCurves)
c.Erase();
}
}
else

@ -55,14 +55,14 @@ export class MirrorCommand implements Command
return;
let kwRes = await app.m_Editor.GetKeyWords({
Msg: "是否删除源对象",
Msg: "是否保留源对象",
KeyWordList: [{ msg: "是", key: "Y" }, { msg: "否", key: "N" }]
});
if (kwRes.Status === PromptStatus.Cancel)
return;
JigUtils.End();
if (kwRes.StringResult === "Y")
if (kwRes.StringResult === "N")
ens.forEach(en => en.Erase());
cloneEns.forEach(en => app.m_Database.ModelSpace.Append(en));
}

@ -13,9 +13,10 @@ export class PasteClip
try
{
let str = await readClipboardText();
let obj = JSON.parse(str);
if (obj)
let data = JSON.parse(str);
if (data)
{
let obj = data.file;
let f = new CADFiler();
f.Data = obj;
let count = f.Read();
@ -28,7 +29,13 @@ export class PasteClip
JigUtils.Draw(en);
}
let oldBasePt = data.basePt;
let oldPt = app.m_Editor.m_MouseCtrl.m_CurMousePointWCS;
ens.forEach(en =>
{
let vec = en.Position.sub(oldBasePt);
en.Position = oldPt.clone().add(vec);
});
let ptRes = await app.m_Editor.GetPoint({
BasePoint: oldPt, Callback: p =>

@ -1,4 +1,4 @@
import { Vector3 } from 'three';
import { Vector3, Matrix4 } from 'three';
import * as xaop from 'xaop';
import { end } from 'xaop';
import { KeyCode, MouseKey } from '../Common/KeyEnum';
@ -59,7 +59,6 @@ export class ApplicationService
this.gui = new DatGUI();
this.m_Editor = new Editor(this);
new ContextMenu(this.m_Editor);
let gt = new Gesture(this.m_Editor);
RegisterGesture(gt);
@ -172,7 +171,8 @@ export class ApplicationService
//创建一张新图纸.
CreateDocument()
{
this.m_Viewer.m_CameraCtrl.LookAt(new Vector3(0, 0, -1));
this.m_Viewer.m_CameraCtrl.LookAt(new Vector3(1, 1, -1));
this.m_Editor.UCSMatrix = new Matrix4();
this.m_Viewer.m_CameraCtrl.ViewHeight = 1000;
this.m_Viewer.m_CameraCtrl.Update();

@ -31,7 +31,18 @@ export class SurroundSpaceParse extends ISpaceParse
//必须平行
if (isParallelTo(this.m_LeftBoard.Normal, this.m_RightBoard.Normal))
{
let clampSpace = new ClampSpaceParseKey([this.m_LeftBoard, this.m_RightBoard], this.m_SpaceOCS);
let brs = [this.m_LeftBoard, this.m_RightBoard];
let beBrs = this.m_BoardMap.get(BoardType.Behind);
if (beBrs && beBrs.length > 0)
{
beBrs.sort((br1, br2) =>
{
return br2.Position.applyMatrix4(this.m_SpaceOCSInv).y - br1.Position.applyMatrix4(this.m_SpaceOCSInv).y;
});
brs.push(beBrs[0]);
}
let clampSpace = new ClampSpaceParseKey(brs, this.m_SpaceOCS);
await clampSpace.Parse();
if (clampSpace.m_ParseOK)
@ -39,8 +50,8 @@ export class SurroundSpaceParse extends ISpaceParse
this.m_SpaceBox = clampSpace.m_SpaceBox;
this.m_ParseOK = true;
await this.ParseStandBoard();
if (brs.length <= 2)
await this.ParseStandBoard();
}
}
}

@ -4,6 +4,7 @@ import { Polyline } from "../DatabaseServices/Polyline";
import { IntersectOption } from "./IntersectWith";
import { PolyOffsetUtil } from "./OffsetPolyline";
import { Line } from "../DatabaseServices/Line";
import { isParallelTo } from "../Geometry/GeUtils";
/**
*线
@ -17,9 +18,20 @@ export function paragraphCulist(cus: Curve[])
//归类曲线,返回归类是否成功
const paragraph = (cu: Curve, originCu: Curve, cus: Curve[]) =>
{
if (usedCu.has(cu) || (cu instanceof Line && originCu instanceof Line))
const cuIsLine = cu instanceof Line;
const originCuIsLine = originCu instanceof Line;
if (usedCu.has(cu) || (cuIsLine && originCuIsLine))
return false;
if (originCuIsLine !== cuIsLine)
{
if (originCuIsLine && !isParallelTo(originCu.GetFistDeriv(0), cu.GetFistDeriv(0)))
return false;
if (cuIsLine && !isParallelTo(originCu.GetFistDeriv(1), cu.GetFistDeriv(0)))
return false;
}
cus.push(cu);
usedCu.add(cu);
return true;

@ -68,6 +68,9 @@ export class Viewer
this.InitRender(canvasContainer);
this.StartRender();
//默认西南等轴视图
this.ViewToSwiso();
let self = this;
end(new Entity().Update, function ()
{

@ -111,7 +111,7 @@ export class TopBottomBoardStore extends BoardStore
isDraw: true,
thickness: 18,
frontDist: 0,
behindDistance: -18,
behindDistance: 0,
isWrapSide: false,
useLFData: true,
leftExt: 0,
@ -125,7 +125,7 @@ export class TopBottomBoardStore extends BoardStore
isDraw: true,
thickness: 18,
frontDist: 0,
behindDistance: -18,
behindDistance: 0,
isWrapSide: false,
useLFData: true,
leftExt: 0,

Loading…
Cancel
Save