|
|
|
@ -1,9 +1,10 @@
|
|
|
|
|
import { MathUtils, Matrix4, Vector3 } from "three";
|
|
|
|
|
import { Box3, MathUtils, Matrix4, Vector3 } from "three";
|
|
|
|
|
import { app } from "../ApplicationServices/Application";
|
|
|
|
|
import { CylinderHole } from "../DatabaseServices/3DSolid/CylinderHole";
|
|
|
|
|
import { Board } from "../DatabaseServices/Entity/Board";
|
|
|
|
|
import { Command } from "../Editor/CommandMachine";
|
|
|
|
|
import { PromptStatus } from "../Editor/PromptResult";
|
|
|
|
|
import { IntersectBox2 } from "../Geometry/Box";
|
|
|
|
|
import { equalv3, isParallelTo, MoveMatrix } from "../Geometry/GeUtils";
|
|
|
|
|
import { ModalState } from "../UI/Components/Modal/ModalInterface";
|
|
|
|
|
import { ERotateType, RotateLayerBoardModal, RotateLayerBoardStore } from "../UI/Components/RotateLayerBoard";
|
|
|
|
@ -72,6 +73,29 @@ export class RotateLayerBoard implements Command
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private CurtailNails = () =>
|
|
|
|
|
{
|
|
|
|
|
let sizeBox = this.currentBoard.BoundingBox;
|
|
|
|
|
let size = sizeBox.getSize(new Vector3);
|
|
|
|
|
let v = new Vector3(1, 1, 1);
|
|
|
|
|
|
|
|
|
|
let frontBox = new Box3(sizeBox.min.clone().sub(v), sizeBox.max.clone().sub(new Vector3(-1, size.y / 2, -1)));
|
|
|
|
|
let backBox = new Box3(sizeBox.min.clone().add(new Vector3(-1, size.y / 2, -1)), sizeBox.max.clone().add(v));
|
|
|
|
|
|
|
|
|
|
for (let i = 0; i < this.currentBoard.LayerNails.length; i++)
|
|
|
|
|
{
|
|
|
|
|
let nail = this.currentBoard.LayerNails[i].Object as CylinderHole;
|
|
|
|
|
if (IntersectBox2(nail.BoundingBox, frontBox))
|
|
|
|
|
{
|
|
|
|
|
nail.Position = nail.Position.add(new Vector3(0, this.data.frontDist, 0));
|
|
|
|
|
}
|
|
|
|
|
else if (IntersectBox2(nail.BoundingBox, backBox))
|
|
|
|
|
{
|
|
|
|
|
nail.Position = nail.Position.add(new Vector3(0, -this.data.backDist, 0));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
private RotateLayerBrByAngle()
|
|
|
|
|
{
|
|
|
|
|
let deg = this.data.angle;
|
|
|
|
@ -102,7 +126,8 @@ export class RotateLayerBoard implements Command
|
|
|
|
|
|
|
|
|
|
this.HandleLayerBoard(newTotalWidth - frontDist - backDist, oldBrData);
|
|
|
|
|
//修正层板钉
|
|
|
|
|
this.RotateNails(angle, newTotalWidth, oldBrData);
|
|
|
|
|
if (angle !== 0)
|
|
|
|
|
this.RotateNails(angle, newTotalWidth, oldBrData);
|
|
|
|
|
}
|
|
|
|
|
private RotateLayerBrByLength()
|
|
|
|
|
{
|
|
|
|
@ -131,8 +156,10 @@ export class RotateLayerBoard implements Command
|
|
|
|
|
/**获得斜层板 */
|
|
|
|
|
private HandleLayerBoard(newWidth: number, oldBrData: IOldBrData)
|
|
|
|
|
{
|
|
|
|
|
this.CurtailNails();
|
|
|
|
|
this.currentBoard.Width = newWidth;
|
|
|
|
|
this.currentBoard.ApplyMatrix(oldBrData.diffMat);
|
|
|
|
|
oldBrData.OCS.copyPosition(this.currentBoard.OCS);
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* 重新计算层板钉
|
|
|
|
|