|
|
|
@ -146,7 +146,7 @@ export class TemplateDrawHingeTool
|
|
|
|
|
|
|
|
|
|
const DrawHinge = (dist?: number, rule?: IHingeRule) =>
|
|
|
|
|
{
|
|
|
|
|
let hingeType = this.GetHingeType(door, openDir, allSpaceEnts, isLROpen);
|
|
|
|
|
let hingeType = GetHingeType(door, openDir, allSpaceEnts, isLROpen);
|
|
|
|
|
for (let i = 0; i < count; i++)
|
|
|
|
|
{
|
|
|
|
|
if (hingestore.m_Option.useRule && !ParseRules(i, count, dist, rule)) continue;
|
|
|
|
@ -311,166 +311,6 @@ export class TemplateDrawHingeTool
|
|
|
|
|
return [isLROpen, isWarn];
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
private GetHingeType(door: Entity, openDir: BoardOpenDir, allSpaceEnts: Entity[], isLROpen: boolean): HingeType
|
|
|
|
|
{
|
|
|
|
|
const Positioning = (door.Template.Object as TemplateRecord).Positioning;
|
|
|
|
|
if (!Positioning)
|
|
|
|
|
{
|
|
|
|
|
Log("存在无效门板!");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
const DoorSpaceBox = new Box3(new Vector3, Positioning.SpaceSize);
|
|
|
|
|
const DoorBox = DoorSpaceBox.clone().applyMatrix4(Positioning.SpaceCS);
|
|
|
|
|
|
|
|
|
|
let isParallelToXYEnts = allSpaceEnts.filter(ent =>
|
|
|
|
|
ent instanceof Board &&
|
|
|
|
|
isParallelTo(ent.Normal, new Vector3().setFromMatrixColumn(Positioning.SpaceCS, isLROpen ? 0 : 2)) &&
|
|
|
|
|
ent.BoundingBox.intersectsBox(DoorBox, 10)
|
|
|
|
|
) as Board[];
|
|
|
|
|
|
|
|
|
|
let ocsInv = new Matrix4().getInverse(Positioning.SpaceCS);
|
|
|
|
|
|
|
|
|
|
const hingeLidRule = userConfig.hingeLidRule;
|
|
|
|
|
|
|
|
|
|
if (openDir === BoardOpenDir.Left)
|
|
|
|
|
{
|
|
|
|
|
let minX = DoorSpaceBox.min.x;
|
|
|
|
|
for (let ent of isParallelToXYEnts)
|
|
|
|
|
{
|
|
|
|
|
let entBox = ent.GetBoundingBoxInMtx(ocsInv);
|
|
|
|
|
|
|
|
|
|
//防止关联无关侧板
|
|
|
|
|
if (DoorSpaceBox.min.z - entBox.max.z > -100 || entBox.min.z - DoorSpaceBox.max.z > -100) continue;
|
|
|
|
|
|
|
|
|
|
//盖过立板长度
|
|
|
|
|
let passDoorExtend = entBox.min.x - minX;
|
|
|
|
|
//无盖距离值
|
|
|
|
|
let noLid = safeEval(hingeLidRule.noLid, { BH: ent.Thickness });
|
|
|
|
|
|
|
|
|
|
//先判断半盖
|
|
|
|
|
if (minX - entBox.min.x > FUZZ && entBox.max.x - minX - noLid > FUZZ)
|
|
|
|
|
{
|
|
|
|
|
let doorExtend = entBox.max.x - minX;
|
|
|
|
|
//全盖距离值
|
|
|
|
|
let allLid = safeEval(hingeLidRule.allLid, { BH: ent.Thickness });
|
|
|
|
|
|
|
|
|
|
if (doorExtend - allLid < -FUZZ)
|
|
|
|
|
return "半盖铰链";
|
|
|
|
|
else
|
|
|
|
|
return "全盖铰链";
|
|
|
|
|
}
|
|
|
|
|
else if (passDoorExtend >= 0 && passDoorExtend < 30)
|
|
|
|
|
{
|
|
|
|
|
//盖过立板小于30的 认定为左侧板
|
|
|
|
|
return "全盖铰链";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return "无盖铰链";
|
|
|
|
|
}
|
|
|
|
|
else if (openDir === BoardOpenDir.Right)
|
|
|
|
|
{
|
|
|
|
|
let maxX = DoorSpaceBox.max.x;
|
|
|
|
|
for (let ent of isParallelToXYEnts)
|
|
|
|
|
{
|
|
|
|
|
let entBox = ent.GetBoundingBoxInMtx(ocsInv);
|
|
|
|
|
|
|
|
|
|
//防止关联无关侧板
|
|
|
|
|
if (DoorSpaceBox.min.z - entBox.max.z > -100 || entBox.min.z - DoorSpaceBox.max.z > -100) continue;
|
|
|
|
|
|
|
|
|
|
//盖过立板长度
|
|
|
|
|
let passDoorExtend = maxX - entBox.max.x;
|
|
|
|
|
//无盖距离值
|
|
|
|
|
let noLid = safeEval(hingeLidRule.noLid, { BH: ent.Thickness });
|
|
|
|
|
|
|
|
|
|
//先判断半盖
|
|
|
|
|
if (maxX - entBox.min.x - noLid > FUZZ && entBox.max.x - maxX > FUZZ)
|
|
|
|
|
{
|
|
|
|
|
let doorExtend = maxX - entBox.min.x;
|
|
|
|
|
//全盖距离值
|
|
|
|
|
let allLid = safeEval(hingeLidRule.allLid, { BH: ent.Thickness });
|
|
|
|
|
if (doorExtend - allLid < -FUZZ)
|
|
|
|
|
return "半盖铰链";
|
|
|
|
|
else
|
|
|
|
|
return "全盖铰链";
|
|
|
|
|
}
|
|
|
|
|
else if (passDoorExtend >= 0 && passDoorExtend < 30)
|
|
|
|
|
{
|
|
|
|
|
//盖过立板小于30的 认定为右侧板
|
|
|
|
|
return "全盖铰链";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return "无盖铰链";
|
|
|
|
|
}
|
|
|
|
|
else if (openDir === BoardOpenDir.Up)
|
|
|
|
|
{
|
|
|
|
|
let maxZ = DoorSpaceBox.max.z;
|
|
|
|
|
for (let ent of isParallelToXYEnts)
|
|
|
|
|
{
|
|
|
|
|
let entBox = ent.GetBoundingBoxInMtx(ocsInv);
|
|
|
|
|
|
|
|
|
|
//防止关联无关层板
|
|
|
|
|
if (DoorSpaceBox.min.x - entBox.max.x > -100 || entBox.min.x - DoorSpaceBox.max.x > -100) continue;
|
|
|
|
|
|
|
|
|
|
//盖过立板长度
|
|
|
|
|
let passDoorExtend = maxZ - entBox.max.z;
|
|
|
|
|
//无盖距离值
|
|
|
|
|
let noLid = safeEval(hingeLidRule.noLid, { BH: ent.Thickness });
|
|
|
|
|
|
|
|
|
|
//先判断半盖
|
|
|
|
|
if (maxZ - entBox.min.z - noLid > FUZZ && entBox.max.z - maxZ > FUZZ)
|
|
|
|
|
{
|
|
|
|
|
let doorExtend = maxZ - entBox.min.z;
|
|
|
|
|
//全盖距离值
|
|
|
|
|
let allLid = safeEval(hingeLidRule.allLid, { BH: ent.Thickness });
|
|
|
|
|
if (doorExtend - allLid < -FUZZ)
|
|
|
|
|
return "半盖铰链";
|
|
|
|
|
else
|
|
|
|
|
return "全盖铰链";
|
|
|
|
|
}
|
|
|
|
|
else if (passDoorExtend >= 0 && passDoorExtend < 30)
|
|
|
|
|
{
|
|
|
|
|
//盖过立板小于30的 认定为上层板
|
|
|
|
|
return "全盖铰链";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return "无盖铰链";
|
|
|
|
|
}
|
|
|
|
|
else if (openDir === BoardOpenDir.Down)
|
|
|
|
|
{
|
|
|
|
|
let minZ = DoorSpaceBox.min.z;
|
|
|
|
|
for (let ent of isParallelToXYEnts)
|
|
|
|
|
{
|
|
|
|
|
let entBox = ent.GetBoundingBoxInMtx(ocsInv);
|
|
|
|
|
|
|
|
|
|
//防止关联无关层板
|
|
|
|
|
if (DoorSpaceBox.min.x - entBox.max.x > -100 || entBox.min.x - DoorSpaceBox.max.x > -100) continue;
|
|
|
|
|
|
|
|
|
|
//盖过立板长度
|
|
|
|
|
let passDoorExtend = entBox.min.z - minZ;
|
|
|
|
|
//无盖距离值
|
|
|
|
|
let noLid = safeEval(hingeLidRule.noLid, { BH: ent.Thickness });
|
|
|
|
|
|
|
|
|
|
//先判断半盖
|
|
|
|
|
if (minZ - entBox.min.z > -FUZZ && entBox.max.z - minZ - noLid > FUZZ)
|
|
|
|
|
{
|
|
|
|
|
let doorExtend = entBox.max.z - minZ;
|
|
|
|
|
//全盖距离值
|
|
|
|
|
let allLid = safeEval(hingeLidRule.allLid, { BH: ent.Thickness });
|
|
|
|
|
if (doorExtend - allLid < -FUZZ)
|
|
|
|
|
return "半盖铰链";
|
|
|
|
|
else
|
|
|
|
|
return "全盖铰链";
|
|
|
|
|
}
|
|
|
|
|
else if (passDoorExtend >= 0 && passDoorExtend < 30)
|
|
|
|
|
{
|
|
|
|
|
//盖过立板小于30的 认定为下层板
|
|
|
|
|
return "全盖铰链";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return "无盖铰链";
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
//设置五金(拉手 铰链)和板的关联切割
|
|
|
|
|
RelativeMetalsToBoard(allEntitys: Entity[], isLROpen: boolean, door: Board | HardwareCompositeEntity)
|
|
|
|
|
{
|
|
|
|
@ -566,7 +406,7 @@ export class TemplateDrawHingeTool
|
|
|
|
|
const isParallelToX = isParallelTo(xNormal, br.Normal);
|
|
|
|
|
|
|
|
|
|
//门板/背板 不增加误差,防止误关联
|
|
|
|
|
if (IsBoxAndEntitysIntersect([otherEnt], [ironware], ZNormal))
|
|
|
|
|
if (IsBoxAndEntitysIntersect([otherEnt], [ironware], ZNormal, isDoor))
|
|
|
|
|
{
|
|
|
|
|
const center = inventedBox.getCenter(new Vector3).applyMatrix4(br.OCSInv).setZ(0);
|
|
|
|
|
if (grooveOutlines.some(c => c.PtInCurve(center)))
|
|
|
|
@ -611,7 +451,7 @@ export class TemplateDrawHingeTool
|
|
|
|
|
{
|
|
|
|
|
if (!IsHinge(ironware)) continue;
|
|
|
|
|
|
|
|
|
|
if (!IsBoxAndEntitysIntersect([otherEnt], [ironware], ZNormal)) continue;
|
|
|
|
|
if (!IsBoxAndEntitysIntersect([otherEnt], [ironware], ZNormal, isDoor)) continue;
|
|
|
|
|
|
|
|
|
|
if (isDoor)
|
|
|
|
|
{
|
|
|
|
@ -677,7 +517,7 @@ export class TemplateDrawHingeTool
|
|
|
|
|
let intersect = false;
|
|
|
|
|
if (box1Z + 100 < doorHight)
|
|
|
|
|
{
|
|
|
|
|
if (IsBoxAndEntitysIntersect(layers, [ironware], ZNormal, translate))
|
|
|
|
|
if (IsBoxAndEntitysIntersect(layers, [ironware], ZNormal, false, translate))
|
|
|
|
|
{
|
|
|
|
|
intersect = true;
|
|
|
|
|
}
|
|
|
|
@ -696,7 +536,7 @@ export class TemplateDrawHingeTool
|
|
|
|
|
let intersect = false;
|
|
|
|
|
if (box2Z - 100 > 0)
|
|
|
|
|
{
|
|
|
|
|
if (IsBoxAndEntitysIntersect(layers, [ironware], ZNormal, translate))
|
|
|
|
|
if (IsBoxAndEntitysIntersect(layers, [ironware], ZNormal, false, translate))
|
|
|
|
|
intersect = true;
|
|
|
|
|
}
|
|
|
|
|
else intersect = true;
|
|
|
|
@ -725,7 +565,7 @@ export class TemplateDrawHingeTool
|
|
|
|
|
let intersect = false;
|
|
|
|
|
if (box1Z + 100 < doorHight)
|
|
|
|
|
{
|
|
|
|
|
if (IsBoxAndEntitysIntersect(verticals, [ironware], ZNormal, translate))
|
|
|
|
|
if (IsBoxAndEntitysIntersect(verticals, [ironware], ZNormal, false, translate))
|
|
|
|
|
intersect = true;
|
|
|
|
|
}
|
|
|
|
|
else intersect = true;
|
|
|
|
@ -742,7 +582,7 @@ export class TemplateDrawHingeTool
|
|
|
|
|
let intersect = false;
|
|
|
|
|
if (box2Z - 100 > 0)
|
|
|
|
|
{
|
|
|
|
|
if (IsBoxAndEntitysIntersect(verticals, [ironware], ZNormal, translate))
|
|
|
|
|
if (IsBoxAndEntitysIntersect(verticals, [ironware], ZNormal, false, translate))
|
|
|
|
|
intersect = true;
|
|
|
|
|
}
|
|
|
|
|
else intersect = true;
|
|
|
|
@ -763,3 +603,254 @@ export class TemplateDrawHingeTool
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function GetHingeType(door: Entity, openDir: BoardOpenDir, allSpaceEnts: Entity[], isLROpen: boolean): HingeType
|
|
|
|
|
{
|
|
|
|
|
const Positioning = (door.Template?.Object as TemplateRecord)?.Positioning;
|
|
|
|
|
if (!Positioning)
|
|
|
|
|
{
|
|
|
|
|
Log("存在无效门板!");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
const DoorSpaceBox = new Box3(new Vector3, Positioning.SpaceSize);
|
|
|
|
|
const DoorBox = DoorSpaceBox.clone().applyMatrix4(Positioning.SpaceCS);
|
|
|
|
|
|
|
|
|
|
let isParallelToXYEnts = allSpaceEnts.filter(ent =>
|
|
|
|
|
ent instanceof Board &&
|
|
|
|
|
isParallelTo(ent.Normal, new Vector3().setFromMatrixColumn(Positioning.SpaceCS, isLROpen ? 0 : 2)) &&
|
|
|
|
|
ent.BoundingBox.intersectsBox(DoorBox, 10)
|
|
|
|
|
) as Board[];
|
|
|
|
|
|
|
|
|
|
let ocsInv = new Matrix4().getInverse(Positioning.SpaceCS);
|
|
|
|
|
|
|
|
|
|
const hingeLidRule = userConfig.hingeLidRule;
|
|
|
|
|
|
|
|
|
|
//门板
|
|
|
|
|
let minDist = Infinity;
|
|
|
|
|
let minDistType: HingeType = "无盖铰链";
|
|
|
|
|
|
|
|
|
|
if (openDir === BoardOpenDir.Left)
|
|
|
|
|
{
|
|
|
|
|
let minX = DoorSpaceBox.min.x;
|
|
|
|
|
for (let ent of isParallelToXYEnts)
|
|
|
|
|
{
|
|
|
|
|
let entBox = ent.GetBoundingBoxInMtx(ocsInv);
|
|
|
|
|
|
|
|
|
|
//防止关联无关侧板
|
|
|
|
|
if (entBox.getSize(new Vector3).z < DoorSpaceBox.max.z / 2) continue; //过滤掉小于门板高度一半(抽测板)
|
|
|
|
|
if (DoorSpaceBox.min.z - entBox.max.z > -100 || entBox.min.z - DoorSpaceBox.max.z > -100) continue;
|
|
|
|
|
|
|
|
|
|
//无盖距离值
|
|
|
|
|
let noLid = safeEval(hingeLidRule.noLid, { BH: ent.Thickness });
|
|
|
|
|
|
|
|
|
|
//先判断半盖
|
|
|
|
|
if (minX - entBox.min.x > FUZZ && entBox.max.x - minX - noLid > FUZZ)
|
|
|
|
|
{
|
|
|
|
|
let doorExtend = entBox.max.x - minX;
|
|
|
|
|
//全盖距离值
|
|
|
|
|
let allLid = safeEval(hingeLidRule.allLid, { BH: ent.Thickness });
|
|
|
|
|
|
|
|
|
|
if (doorExtend - allLid < -FUZZ)
|
|
|
|
|
return "半盖铰链";
|
|
|
|
|
else
|
|
|
|
|
return "全盖铰链";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
//盖过立板长度
|
|
|
|
|
let passDoorExtend = entBox.min.x - minX;
|
|
|
|
|
let noPassDoorExtend = minX - entBox.max.x;
|
|
|
|
|
|
|
|
|
|
if (passDoorExtend > -FUZZ)
|
|
|
|
|
{
|
|
|
|
|
if (minDist > passDoorExtend)
|
|
|
|
|
{
|
|
|
|
|
minDist = passDoorExtend;
|
|
|
|
|
minDistType = "全盖铰链";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (minDist > noPassDoorExtend)
|
|
|
|
|
{
|
|
|
|
|
minDist = passDoorExtend;
|
|
|
|
|
minDistType = "无盖铰链";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (minDist >= -FUZZ && minDist < 30)
|
|
|
|
|
return minDistType;
|
|
|
|
|
else
|
|
|
|
|
return "无盖铰链";
|
|
|
|
|
}
|
|
|
|
|
else if (openDir === BoardOpenDir.Right)
|
|
|
|
|
{
|
|
|
|
|
let maxX = DoorSpaceBox.max.x;
|
|
|
|
|
for (let ent of isParallelToXYEnts)
|
|
|
|
|
{
|
|
|
|
|
let entBox = ent.GetBoundingBoxInMtx(ocsInv);
|
|
|
|
|
|
|
|
|
|
//防止关联无关侧板
|
|
|
|
|
if (entBox.getSize(new Vector3).z < DoorSpaceBox.max.z / 2) continue; //过滤掉小于门板高度一半(抽测板)
|
|
|
|
|
if (DoorSpaceBox.min.z - entBox.max.z > -100 || entBox.min.z - DoorSpaceBox.max.z > -100) continue;
|
|
|
|
|
|
|
|
|
|
//无盖距离值
|
|
|
|
|
let noLid = safeEval(hingeLidRule.noLid, { BH: ent.Thickness });
|
|
|
|
|
|
|
|
|
|
//先判断半盖
|
|
|
|
|
if (maxX - entBox.min.x - noLid > FUZZ && entBox.max.x - maxX > FUZZ)
|
|
|
|
|
{
|
|
|
|
|
let doorExtend = maxX - entBox.min.x;
|
|
|
|
|
//全盖距离值
|
|
|
|
|
let allLid = safeEval(hingeLidRule.allLid, { BH: ent.Thickness });
|
|
|
|
|
if (doorExtend - allLid < -FUZZ)
|
|
|
|
|
return "半盖铰链";
|
|
|
|
|
else
|
|
|
|
|
return "全盖铰链";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
//盖过立板长度
|
|
|
|
|
let passDoorExtend = maxX - entBox.max.x;
|
|
|
|
|
//没有盖过立板长度
|
|
|
|
|
let noPassDoorExtend = entBox.min.x - maxX;
|
|
|
|
|
|
|
|
|
|
if (passDoorExtend > -FUZZ)
|
|
|
|
|
{
|
|
|
|
|
if (minDist > passDoorExtend)
|
|
|
|
|
{
|
|
|
|
|
minDist = passDoorExtend;
|
|
|
|
|
minDistType = "全盖铰链";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (minDist > noPassDoorExtend)
|
|
|
|
|
{
|
|
|
|
|
minDist = passDoorExtend;
|
|
|
|
|
minDistType = "无盖铰链";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (minDist >= -FUZZ && minDist < 30)
|
|
|
|
|
return minDistType;
|
|
|
|
|
else
|
|
|
|
|
return "无盖铰链";
|
|
|
|
|
}
|
|
|
|
|
else if (openDir === BoardOpenDir.Up)
|
|
|
|
|
{
|
|
|
|
|
let maxZ = DoorSpaceBox.max.z;
|
|
|
|
|
for (let ent of isParallelToXYEnts)
|
|
|
|
|
{
|
|
|
|
|
let entBox = ent.GetBoundingBoxInMtx(ocsInv);
|
|
|
|
|
|
|
|
|
|
//防止关联无关层板
|
|
|
|
|
if (entBox.getSize(new Vector3).x < DoorSpaceBox.max.x / 2) continue; //过滤掉小于门板高度一半(抽测板)
|
|
|
|
|
if (DoorSpaceBox.min.x - entBox.max.x > -100 || entBox.min.x - DoorSpaceBox.max.x > -100) continue;
|
|
|
|
|
|
|
|
|
|
//无盖距离值
|
|
|
|
|
let noLid = safeEval(hingeLidRule.noLid, { BH: ent.Thickness });
|
|
|
|
|
|
|
|
|
|
//先判断半盖
|
|
|
|
|
if (maxZ - entBox.min.z - noLid > FUZZ && entBox.max.z - maxZ > FUZZ)
|
|
|
|
|
{
|
|
|
|
|
let doorExtend = maxZ - entBox.min.z;
|
|
|
|
|
//全盖距离值
|
|
|
|
|
let allLid = safeEval(hingeLidRule.allLid, { BH: ent.Thickness });
|
|
|
|
|
if (doorExtend - allLid < -FUZZ)
|
|
|
|
|
return "半盖铰链";
|
|
|
|
|
else
|
|
|
|
|
return "全盖铰链";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
//盖过立板长度
|
|
|
|
|
let passDoorExtend = maxZ - entBox.max.z;
|
|
|
|
|
//没有盖过立板长度
|
|
|
|
|
let noPassDoorExtend = entBox.min.z - maxZ;
|
|
|
|
|
|
|
|
|
|
if (passDoorExtend > -FUZZ)
|
|
|
|
|
{
|
|
|
|
|
if (minDist > passDoorExtend)
|
|
|
|
|
{
|
|
|
|
|
minDist = passDoorExtend;
|
|
|
|
|
minDistType = "全盖铰链";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (minDist > noPassDoorExtend)
|
|
|
|
|
{
|
|
|
|
|
minDist = passDoorExtend;
|
|
|
|
|
minDistType = "无盖铰链";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (minDist >= -FUZZ && minDist < 30)
|
|
|
|
|
return minDistType;
|
|
|
|
|
else
|
|
|
|
|
return "无盖铰链";
|
|
|
|
|
}
|
|
|
|
|
else if (openDir === BoardOpenDir.Down)
|
|
|
|
|
{
|
|
|
|
|
let minZ = DoorSpaceBox.min.z;
|
|
|
|
|
for (let ent of isParallelToXYEnts)
|
|
|
|
|
{
|
|
|
|
|
let entBox = ent.GetBoundingBoxInMtx(ocsInv);
|
|
|
|
|
|
|
|
|
|
//防止关联无关层板
|
|
|
|
|
if (entBox.getSize(new Vector3).x < DoorSpaceBox.max.x / 2) continue; //过滤掉小于门板高度一半(抽测板)
|
|
|
|
|
if (DoorSpaceBox.min.x - entBox.max.x > -100 || entBox.min.x - DoorSpaceBox.max.x > -100) continue;
|
|
|
|
|
|
|
|
|
|
//无盖距离值
|
|
|
|
|
let noLid = safeEval(hingeLidRule.noLid, { BH: ent.Thickness });
|
|
|
|
|
|
|
|
|
|
//先判断半盖
|
|
|
|
|
if (minZ - entBox.min.z > -FUZZ && entBox.max.z - minZ - noLid > FUZZ)
|
|
|
|
|
{
|
|
|
|
|
let doorExtend = entBox.max.z - minZ;
|
|
|
|
|
//全盖距离值
|
|
|
|
|
let allLid = safeEval(hingeLidRule.allLid, { BH: ent.Thickness });
|
|
|
|
|
if (doorExtend - allLid < -FUZZ)
|
|
|
|
|
return "半盖铰链";
|
|
|
|
|
else
|
|
|
|
|
return "全盖铰链";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
//盖过立板长度
|
|
|
|
|
let passDoorExtend = entBox.min.x - minZ;
|
|
|
|
|
//没有盖过立板长度
|
|
|
|
|
let noPassDoorExtend = minZ - entBox.max.x;
|
|
|
|
|
|
|
|
|
|
if (passDoorExtend > -FUZZ)
|
|
|
|
|
{
|
|
|
|
|
if (minDist > passDoorExtend)
|
|
|
|
|
{
|
|
|
|
|
minDist = passDoorExtend;
|
|
|
|
|
minDistType = "全盖铰链";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (minDist > noPassDoorExtend)
|
|
|
|
|
{
|
|
|
|
|
minDist = passDoorExtend;
|
|
|
|
|
minDistType = "无盖铰链";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (minDist >= -FUZZ && minDist < 30)
|
|
|
|
|
return minDistType;
|
|
|
|
|
else
|
|
|
|
|
return "无盖铰链";
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|