|
|
|
@ -27,6 +27,12 @@ import { ITemplateParam } from "../../../UI/Store/RightPanelStore/ITemplateParam
|
|
|
|
|
import { DrillType } from "../../DrawDrilling/DrillType";
|
|
|
|
|
import { IsDoor, IsHandle, IsHinge } from "../../HideSelect/HideSelectUtils";
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 铰链碰撞后尝试两个方向(上、下)的
|
|
|
|
|
* store.option.deviation偏移量进行最多MoveNum次
|
|
|
|
|
* 偏移找到合适位置
|
|
|
|
|
* @type {*}
|
|
|
|
|
* */
|
|
|
|
|
const MoveNum = 8;
|
|
|
|
|
|
|
|
|
|
export class DrawDoorTool
|
|
|
|
@ -509,7 +515,6 @@ export class DrawDoorTool
|
|
|
|
|
{
|
|
|
|
|
let boards: Board[] = [];
|
|
|
|
|
let doors: Entity[] = [];
|
|
|
|
|
let layers: Entity[] = [];
|
|
|
|
|
let ironwareEnts: HardwareCompositeEntity[] = []; //五金
|
|
|
|
|
let hardwareCompositeEnts: Entity[] = [];//除铰链和把手以外的复合实体
|
|
|
|
|
let layerBoards: Entity[] = []; //层板 左右门板判断铰链碰撞
|
|
|
|
@ -523,6 +528,17 @@ export class DrawDoorTool
|
|
|
|
|
layerBoards.push(en);
|
|
|
|
|
else if (en.BoardType === BoardType.Vertical)
|
|
|
|
|
verticalBoards.push(en);
|
|
|
|
|
else if (en.BoardType === BoardType.Behind)
|
|
|
|
|
{
|
|
|
|
|
if (IsDoor(en))
|
|
|
|
|
doors.push(en);
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
layerBoards.push(en);
|
|
|
|
|
verticalBoards.push(en);
|
|
|
|
|
}
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (en instanceof HardwareCompositeEntity)
|
|
|
|
|
{
|
|
|
|
@ -530,9 +546,9 @@ export class DrawDoorTool
|
|
|
|
|
ironwareEnts.push(en);
|
|
|
|
|
else if (!IsDoor(en))
|
|
|
|
|
{
|
|
|
|
|
layers.push(en);
|
|
|
|
|
hardwareCompositeEnts.push(en);
|
|
|
|
|
layerBoards.push(en);
|
|
|
|
|
verticalBoards.push(en);
|
|
|
|
|
}
|
|
|
|
|
else //只剩下复合门板 加入HCEBoard 用于判断铰链归属
|
|
|
|
|
hardwareCompositeEnts.push(en);
|
|
|
|
@ -609,7 +625,7 @@ export class DrawDoorTool
|
|
|
|
|
SetHingeType(br, ironware);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (isParallelTo(ironware.Normal, br.Normal))
|
|
|
|
|
else if (isParallelTo(ironware.Normal, br.Normal) || !IsDoor(br)) //不是门板也判断碰撞
|
|
|
|
|
{
|
|
|
|
|
let hingeTr = ironware.Template.Object as TemplateRecord;
|
|
|
|
|
let hingeSpaceTr = hingeTr.Parent.Object as TemplateRecord;
|
|
|
|
@ -620,12 +636,12 @@ export class DrawDoorTool
|
|
|
|
|
if (isUpDownDoor)
|
|
|
|
|
{
|
|
|
|
|
if (RecordHingeTrSizeX(hingeTr2Size_Map, hingeTr, size.x)) continue;
|
|
|
|
|
number = this.GetHingeMoveNum(doorWidth, ironBoxInDoorSpace, ironBox, verticalBoards, size.x / 3, number, isUpDownDoor);
|
|
|
|
|
number = this.GetHingeMoveNum(doorWidth, ironBoxInDoorSpace, ironBox, verticalBoards, this.option.deviation, number, isUpDownDoor);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (RecordHingeTrSizeX(hingeTr2Size_Map, hingeTr, size.z)) continue;
|
|
|
|
|
number = this.GetHingeMoveNum(doorHight, ironBoxInDoorSpace, ironBox, layerBoards, size.z / 3, number, isUpDownDoor);
|
|
|
|
|
number = this.GetHingeMoveNum(doorHight, ironBoxInDoorSpace, ironBox, layerBoards, this.option.deviation, number, isUpDownDoor);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (number === 0)
|
|
|
|
@ -634,7 +650,7 @@ export class DrawDoorTool
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
hingeSpaceTr.GetParam("SY").value = (isUpDownDoor ? size.x : size.z) * number / 3; //超出情况往下偏移
|
|
|
|
|
hingeSpaceTr.GetParam("SY").value = this.option.deviation * number; //超出情况往下偏移
|
|
|
|
|
needUpdate = true;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
@ -665,20 +681,20 @@ export class DrawDoorTool
|
|
|
|
|
{
|
|
|
|
|
let doorWidth = doorBox.getSize(new Vector3).x;
|
|
|
|
|
if (RecordHingeTrSizeX(hingeTr2Size_Map, hingeTr, ironSize.x)) continue;
|
|
|
|
|
number = this.GetHingeMoveNum(doorWidth, ironBoxInDoorSpace, ironBox, verticalBoards, ironSize.x / 3, number, isUpDownDoor);
|
|
|
|
|
number = this.GetHingeMoveNum(doorWidth, ironBoxInDoorSpace, ironBox, verticalBoards, this.option.deviation, number, isUpDownDoor);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
let doorHight = doorBox.getSize(new Vector3).z;
|
|
|
|
|
if (RecordHingeTrSizeX(hingeTr2Size_Map, hingeTr, ironSize.z)) continue;
|
|
|
|
|
number = this.GetHingeMoveNum(doorHight, ironBoxInDoorSpace, ironBox, layerBoards, ironSize.z / 3, number, isUpDownDoor);
|
|
|
|
|
number = this.GetHingeMoveNum(doorHight, ironBoxInDoorSpace, ironBox, layerBoards, this.option.deviation, number, isUpDownDoor);
|
|
|
|
|
}
|
|
|
|
|
if (number === 0)
|
|
|
|
|
{
|
|
|
|
|
moveFail = true;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
hingeSpaceTr.GetParam("SY").value = (isUpDownDoor ? ironSize.x : ironSize.z) * number / 3; //超出情况往下偏移
|
|
|
|
|
hingeSpaceTr.GetParam("SY").value = this.option.deviation * number; //超出情况往下偏移
|
|
|
|
|
needUpdate = true;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|