|
|
|
@ -248,7 +248,7 @@ export class TemplateDrawHingeTool
|
|
|
|
|
RelativeMetalsToBoard(allEntitys: Entity[], isLROpen: boolean, door: Board | HardwareCompositeEntity)
|
|
|
|
|
{
|
|
|
|
|
let brs: Board[] = [];
|
|
|
|
|
let comEntitys: HardwareCompositeEntity[] = [];
|
|
|
|
|
let ironwareEnts: HardwareCompositeEntity[] = [];
|
|
|
|
|
let doors: Entity[] = [];
|
|
|
|
|
let layers: Entity[] = [];
|
|
|
|
|
let verticals: Entity[] = [];
|
|
|
|
@ -268,7 +268,7 @@ export class TemplateDrawHingeTool
|
|
|
|
|
if (IsHinge(en) || IsHandle(en))
|
|
|
|
|
{
|
|
|
|
|
if (this.hingeSet.has(en.Id))
|
|
|
|
|
comEntitys.push(en);
|
|
|
|
|
ironwareEnts.push(en);
|
|
|
|
|
}
|
|
|
|
|
else if (!IsDoor(en))
|
|
|
|
|
{
|
|
|
|
@ -301,15 +301,15 @@ export class TemplateDrawHingeTool
|
|
|
|
|
|
|
|
|
|
const allOtherEntitys = HCEBoard.concat(brs);//除了拉手和铰链以外的层板和复合实体
|
|
|
|
|
|
|
|
|
|
for (let en of comEntitys)
|
|
|
|
|
for (let ironware of ironwareEnts)
|
|
|
|
|
{
|
|
|
|
|
let enBox = en.GetBoundingBoxInMtx(ocs);
|
|
|
|
|
let hingeSpace = (en.Template.Object as TemplateRecord).Parent.Object as TemplateRecord;
|
|
|
|
|
for (let board of allOtherEntitys)
|
|
|
|
|
let enBox = ironware.GetBoundingBoxInMtx(ocs);
|
|
|
|
|
let hingeSpace = (ironware.Template.Object as TemplateRecord).Parent.Object as TemplateRecord;
|
|
|
|
|
for (let otherEnt of allOtherEntitys)
|
|
|
|
|
{
|
|
|
|
|
if (board instanceof Board)
|
|
|
|
|
if (otherEnt instanceof Board)
|
|
|
|
|
{
|
|
|
|
|
let br = board as Board;
|
|
|
|
|
let br = otherEnt as Board;
|
|
|
|
|
let brBox = brBoxCache.get(br);
|
|
|
|
|
if (!brBox)
|
|
|
|
|
{
|
|
|
|
@ -333,21 +333,21 @@ export class TemplateDrawHingeTool
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
//铰链避让
|
|
|
|
|
if (this.hingeSet.has(en.Id))
|
|
|
|
|
if (this.hingeSet.has(ironware.Id))
|
|
|
|
|
{
|
|
|
|
|
let x = new Vector3().setFromMatrixColumn(en.OCS, 0);
|
|
|
|
|
let x = new Vector3().setFromMatrixColumn(ironware.OCS, 0);
|
|
|
|
|
if (isParallelTo(x, br.Normal))
|
|
|
|
|
{
|
|
|
|
|
if (!usedHinge.has(en.Id))
|
|
|
|
|
if (!usedHinge.has(ironware.Id))
|
|
|
|
|
{
|
|
|
|
|
usedHinge.add(en.Id);
|
|
|
|
|
this.SetHingeType(br, en);
|
|
|
|
|
usedHinge.add(ironware.Id);
|
|
|
|
|
this.SetHingeType(br, ironware);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (isParallelTo(en.Normal, br.Normal))
|
|
|
|
|
else if (isParallelTo(ironware.Normal, br.Normal))
|
|
|
|
|
{
|
|
|
|
|
let number = 1;
|
|
|
|
|
number = this.GetHingeMoveNum(door, en, layers, verticals, number, isLROpen);
|
|
|
|
|
number = this.GetHingeMoveNum(door, ironware, layers, verticals, number, isLROpen);
|
|
|
|
|
if (number === 0)
|
|
|
|
|
{
|
|
|
|
|
moveFail = true;
|
|
|
|
@ -361,19 +361,27 @@ export class TemplateDrawHingeTool
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
br.RelativeHardware.push(en.Id);
|
|
|
|
|
en.RelevanceBoards.push(br.Id);
|
|
|
|
|
br.RelativeHardware.push(ironware.Id);
|
|
|
|
|
ironware.RelevanceBoards.push(br.Id);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (board instanceof HardwareCompositeEntity) //复合实体 铰链偏移
|
|
|
|
|
else if (otherEnt instanceof HardwareCompositeEntity) //复合实体 铰链偏移
|
|
|
|
|
{
|
|
|
|
|
if (!IsHinge(en)) continue;
|
|
|
|
|
if (!IsHinge(ironware)) continue;
|
|
|
|
|
|
|
|
|
|
let brBox = board.BoundingBox;
|
|
|
|
|
let brBox = otherEnt.GetBoundingBoxInMtx(ocs);
|
|
|
|
|
if (!brBox.intersectsBox(enBox)) continue;
|
|
|
|
|
|
|
|
|
|
if (IsDoor(otherEnt))
|
|
|
|
|
{
|
|
|
|
|
//铰链归属复合门板
|
|
|
|
|
ironware.RelevanceBoards.push(otherEnt.Id);
|
|
|
|
|
otherEnt.RelevanceHardware.push(ironware.Id);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
let number = 1;
|
|
|
|
|
number = this.GetHingeMoveNum(door, en, layers, verticals, number, isLROpen);
|
|
|
|
|
board.RelevanceHardware.push(en.Id);
|
|
|
|
|
number = this.GetHingeMoveNum(door, ironware, layers, verticals, number, isLROpen);
|
|
|
|
|
|
|
|
|
|
if (number === 0)
|
|
|
|
|
{
|
|
|
|
|
moveFail = true;
|
|
|
|
|