|
|
|
@ -5,13 +5,14 @@ import { Singleton } from "../../Common/Singleton";
|
|
|
|
|
import { operationExpReg } from "../../Common/Utils";
|
|
|
|
|
import { GangDrill } from "../../DatabaseServices/3DSolid/GangDrill";
|
|
|
|
|
import { Board } from "../../DatabaseServices/Board";
|
|
|
|
|
import { Circle } from "../../DatabaseServices/Circle";
|
|
|
|
|
import { ObjectId } from "../../DatabaseServices/ObjectId";
|
|
|
|
|
import { CollisionDetection } from "../../Geometry/DrillParse/CollisionDetection";
|
|
|
|
|
import { Face } from "../../Geometry/DrillParse/Face";
|
|
|
|
|
import { cZAxis, equaln, MoveMatrix } from "../../Geometry/GeUtils";
|
|
|
|
|
import { FaceDirection } from "../../UI/Store/BoardInterface";
|
|
|
|
|
import { DrillingOption, SpacingType } from "../../UI/Store/drillInterface";
|
|
|
|
|
import { DrillStore } from "../../UI/Store/DrillStore";
|
|
|
|
|
import { FaceDirection } from "../../UI/Store/BoardInterface";
|
|
|
|
|
|
|
|
|
|
export class DrawDrillingTool extends Singleton
|
|
|
|
|
{
|
|
|
|
@ -209,12 +210,12 @@ export class DrawDrillingTool extends Singleton
|
|
|
|
|
|
|
|
|
|
for (let dist of this.m_MoveDistList)
|
|
|
|
|
{
|
|
|
|
|
if (this.CheckModelingCollision(this.m_Face.m_InterBoard, this.drillEnts[0], dist))
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
if (this.drillEnts.length === 3)
|
|
|
|
|
{
|
|
|
|
|
let pos = this.drillEnts[2].Position
|
|
|
|
|
.applyMatrix4(MoveMatrix(new Vector3(dist)))
|
|
|
|
|
.applyMatrix4(this.m_Face.OCS);
|
|
|
|
|
if (this.CheckModelingCollision(pos))
|
|
|
|
|
if (this.CheckModelingCollision(this.m_Face.m_LocalBoard, this.drillEnts[2], dist))
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
//新的排钻列表
|
|
|
|
@ -233,22 +234,20 @@ export class DrawDrillingTool extends Singleton
|
|
|
|
|
this.ParseDrillList(newDrillentList);
|
|
|
|
|
}
|
|
|
|
|
//排钻避开造型
|
|
|
|
|
private CheckModelingCollision(pos: Vector3)
|
|
|
|
|
private CheckModelingCollision(br: Board, en: GangDrill, dist: number)
|
|
|
|
|
{
|
|
|
|
|
let br = this.m_Face.m_LocalBoard;
|
|
|
|
|
let mat = br.OCSInv.multiply(this.m_Face.OCS).multiply(MoveMatrix(new Vector3(dist)));
|
|
|
|
|
let modelings = br.BoardModeling;
|
|
|
|
|
pos.applyMatrix4(br.OCSInv);
|
|
|
|
|
let pos = en.Position.applyMatrix4(mat);
|
|
|
|
|
|
|
|
|
|
for (let m of modelings)
|
|
|
|
|
{
|
|
|
|
|
if (m.thickness === br.Thickness)
|
|
|
|
|
let cu = m.shape.Outline.Curve;
|
|
|
|
|
pos.setZ(cu.Position.z);
|
|
|
|
|
//排钻在造型内或者和造型碰撞
|
|
|
|
|
if (cu.PtInCurve(pos) || cu.IntersectWith(new Circle(pos, en.Radian), 0).length > 0)
|
|
|
|
|
{
|
|
|
|
|
//TODO:暂先处理挖空的造型
|
|
|
|
|
let cu = m.shape.Outline.Curve;
|
|
|
|
|
pos.setZ(cu.Position.z);
|
|
|
|
|
if (cu.PtInCurve(pos))
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
return m.thickness === br.Thickness || en.Height > br.Thickness - m.thickness;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|