修复:单独绘制铰链无法写入位置信息

pull/2015/head
ChenX 2 years ago
parent c5c1e2f6c9
commit f8190adf94

@ -634,7 +634,7 @@ export class DrawDoorTool
{
if (!IsHinge(ironware)) continue;
if (!this.IsIntersects(realityBox, [otherEnt])) continue;
if (!IsBoxAndEntitysIntersect(realityBox, [otherEnt])) continue;
if (IsDoor(otherEnt))
{
@ -885,7 +885,7 @@ export class DrawDoorTool
if (box1Info + (isUpDownDoor ? 10 : 100) < doorSpecs)
{
if (!this.IsIntersects(realityBox1, checkEnts))
if (!IsBoxAndEntitysIntersect(realityBox1, checkEnts))
return number;
else
return this.MoveAgain(doorSpecs, inventedBox, realityBox, checkEnts, distance, number, isUpDownDoor);
@ -915,7 +915,7 @@ export class DrawDoorTool
}
if (box2Info - (isUpDownDoor ? 10 : 100) > 0)
{
if (!this.IsIntersects(realityBox2, checkEnts))
if (!IsBoxAndEntitysIntersect(realityBox2, checkEnts))
return -number;
else
{
@ -941,26 +941,32 @@ export class DrawDoorTool
}
}
private IsIntersects(enBox: Box3, checkEnts: Entity[], parentOCS?: Matrix4): boolean
}
/**
* @param enBox
* @param checkEnts
* @param parentOCS
*/
export function IsBoxAndEntitysIntersect(enBox: Box3, checkEnts: Entity[], parentOCS?: Matrix4): boolean
{
for (let checkEnt of checkEnts)
{
for (let checkEnt of checkEnts)
if (checkEnt instanceof HardwareCompositeEntity)
{
if (checkEnt instanceof HardwareCompositeEntity)
{
let ocs = checkEnt.OCSNoClone;
if (parentOCS) ocs = new Matrix4().multiplyMatrices(parentOCS, ocs);
let ocs = checkEnt.OCSNoClone;
if (parentOCS) ocs = new Matrix4().multiplyMatrices(parentOCS, ocs);
if (this.IsIntersects(enBox, checkEnt.Entitys, ocs))
return true;
}
else
{
let box = checkEnt.BoundingBox as Box3Ext;
if (parentOCS) box.applyMatrix4(parentOCS);
if (box.intersectsBox(enBox, 10))
return true;
}
if (IsBoxAndEntitysIntersect(enBox, checkEnt.Entitys, ocs))
return true;
}
else
{
let box = checkEnt.BoundingBox as Box3Ext;
if (parentOCS) box.applyMatrix4(parentOCS);
if (box.intersectsBox(enBox, 10))
return true;
}
return false;
}
return false;
}

@ -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;
}
}

Loading…
Cancel
Save