|
|
|
@ -1,4 +1,5 @@
|
|
|
|
|
import { Box3, Vector3 } from "three";
|
|
|
|
|
import { IsBoxAndEntitysIntersect } from "../../../Add-on/DrawBoard/DrawDoorDrawer/DrawDoorTool";
|
|
|
|
|
import { IsDoor, IsHandle, IsHinge } from "../../../Add-on/HideSelect/HideSelectUtils";
|
|
|
|
|
import { app } from "../../../ApplicationServices/Application";
|
|
|
|
|
import { EBoardKeyList } from "../../../Common/BoardKeyList";
|
|
|
|
@ -419,7 +420,7 @@ export class TemplateDrawHingeTool
|
|
|
|
|
{
|
|
|
|
|
if (!IsHinge(ironware)) continue;
|
|
|
|
|
|
|
|
|
|
if (!this.IsIntersects(realityBox, otherEnt.Entitys)) continue;
|
|
|
|
|
if (!IsBoxAndEntitysIntersect(realityBox, [otherEnt])) continue;
|
|
|
|
|
|
|
|
|
|
if (IsDoor(otherEnt))
|
|
|
|
|
{
|
|
|
|
@ -503,7 +504,7 @@ export class TemplateDrawHingeTool
|
|
|
|
|
realityBox1.translate(new Vector3(0, 0, distance * number));
|
|
|
|
|
|
|
|
|
|
let box1Z = inventedBox1.getCenter(new Vector3).z;
|
|
|
|
|
if (box1Z + 100 < doorHight && !this.IsIntersects(realityBox1, layers))
|
|
|
|
|
if (box1Z + 100 < doorHight && !IsBoxAndEntitysIntersect(realityBox1, layers))
|
|
|
|
|
return number * distance;
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
@ -514,7 +515,7 @@ export class TemplateDrawHingeTool
|
|
|
|
|
let realityBox2 = realityBox.clone();
|
|
|
|
|
realityBox2.translate(new Vector3(0, 0, distance * -number));
|
|
|
|
|
|
|
|
|
|
if (box2Z - 100 > 0 && !this.IsIntersects(realityBox2, layers))
|
|
|
|
|
if (box2Z - 100 > 0 && !IsBoxAndEntitysIntersect(realityBox2, layers))
|
|
|
|
|
return -number * distance;
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
@ -537,7 +538,7 @@ export class TemplateDrawHingeTool
|
|
|
|
|
|
|
|
|
|
realityBox1.translate(new Vector3(distance * number, 0, 0));
|
|
|
|
|
|
|
|
|
|
if (box1Z + 100 < doorHight && !this.IsIntersects(realityBox1, verticals))
|
|
|
|
|
if (box1Z + 100 < doorHight && !IsBoxAndEntitysIntersect(realityBox1, verticals))
|
|
|
|
|
return number * distance;
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
@ -548,7 +549,7 @@ export class TemplateDrawHingeTool
|
|
|
|
|
let realityBox2 = realityBox.clone();
|
|
|
|
|
realityBox2.translate(new Vector3(distance * -number, 0, 0));
|
|
|
|
|
|
|
|
|
|
if (box2Z - 100 > 0 && !this.IsIntersects(realityBox2, verticals))
|
|
|
|
|
if (box2Z - 100 > 0 && !IsBoxAndEntitysIntersect(realityBox2, verticals))
|
|
|
|
|
return -number * distance;
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
@ -563,20 +564,4 @@ export class TemplateDrawHingeTool
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private IsIntersects(enBox: Box3, checkEnts: Entity[]): boolean
|
|
|
|
|
{
|
|
|
|
|
for (let checkEnt of checkEnts)
|
|
|
|
|
{
|
|
|
|
|
if (checkEnt instanceof HardwareCompositeEntity)
|
|
|
|
|
if (this.IsIntersects(enBox, checkEnt.Entitys))
|
|
|
|
|
return true;
|
|
|
|
|
else continue;
|
|
|
|
|
|
|
|
|
|
let box = checkEnt.BoundingBox as Box3Ext;
|
|
|
|
|
if (box.intersectsBox(enBox, 10))
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|