!1115 优化:复合门板开门方向和门板封边

pull/1115/MERGE
ZoeLeeFZ 4 years ago committed by ChenX
parent 6e3b3271eb
commit cbe45c3d86

@ -6,7 +6,7 @@ import { GetOnlineTemplate } from "../../../DatabaseServices/Template/TempateUti
import { TemplateRecord } from "../../../DatabaseServices/Template/TemplateRecord";
import { ISpaceParse } from "../../../Geometry/SpaceParse/ISpaceParse";
import { BoardProcessOption, DrillType, BoardOpenDir, BoardType } from "../../../UI/Store/BoardInterface";
import { IDoorConfigOption, IDoorInfo, HandleHorPos, HandleVePos, DoorOpenDir } from "../../../UI/Store/DoorInterface";
import { IDoorConfigOption, IDoorInfo, HandleHorPos, HandleVePos, DoorOpenDir, DisableChangeParName } from "../../../UI/Store/DoorInterface";
import { DuplicateRecordCloning } from "../../../Common/Status";
import { Box3Ext } from "../../../Geometry/Box";
import { HardwareCompositeEntity } from "../../../DatabaseServices/Hardware/HardwareCompositeEntity";
@ -15,6 +15,8 @@ import { Entity } from './../../../DatabaseServices/Entity/Entity';
import { TemplateVisualSpace } from "../../../DatabaseServices/Template/ProgramTempate/TemplateVisualSpace";
import { Vector3 } from "three";
import { isParallelTo } from "../../../Geometry/GeUtils";
import { TemplateSizeBoard } from "../../../DatabaseServices/Template/ProgramTempate/TemplateSizeBoard";
import { openDirTitle } from "../../../UI/Store/DoorDrawerStore/DoorStore";
export class DrawDoorTool
{
@ -479,20 +481,106 @@ export class DrawDoorTool
}
return [...spaceBoardSet];
}
protected GetBoardOpenDir(dir: DoorOpenDir)
protected GetDoorTemp(info: IDoorInfo)
{
let doorTemp: TemplateRecord;
if (info.tempInfo.temp.id === "" || !this._idTempMap.has(info.tempInfo.temp.id))
{
doorTemp = new TemplateSizeBoard().InitBaseParams();
doorTemp.Name = "门板";
app.Database.TemplateTable.Append(doorTemp);
let br = Board.CreateBoard(info.height, info.width, 18, BoardType.Behind);
br.BoardProcessOption.drillType = DrillType.None;
br.ColorIndex = 6;
br.BoardProcessOption[EBoardKeyList.UpSealed] = this.option.topDoorSeal.toString();
br.BoardProcessOption[EBoardKeyList.DownSealed] = this.option.bottomDoorSeal.toString();
br.BoardProcessOption[EBoardKeyList.LeftSealed] = this.option.leftDoorSeal.toString();
br.BoardProcessOption[EBoardKeyList.RightSealed] = this.option.rightDoorSeal.toString();
if (this.surroundOption)
{
br.BoardProcessOption[EBoardKeyList.RoomName] = this.surroundOption[EBoardKeyList.RoomName];
br.BoardProcessOption[EBoardKeyList.CabinetName] = this.surroundOption[EBoardKeyList.CabinetName];
}
br.Name =
info.openDir === DoorOpenDir.None ? "门板" :
openDirTitle[info.openDir] + "开门板";
app.Database.ModelSpace.Append(br);
doorTemp.Objects.push(br.Id);
}
else
{
let drawId = info.tempInfo.temp.id;
let temp = this._idTempMap.get(drawId);
doorTemp = app.Database.WblockCloneObejcts([temp], app.Database.TemplateTable, new Map(), DuplicateRecordCloning.Ignore)[0] as TemplateRecord;
//修改的参数应用给模板
for (let par of info.tempInfo.temp.props)
{
if (DisableChangeParName.includes(par.name)) continue;
let p = doorTemp.GetParam(par.name);
if (p)
p.expr = par.expr;
}
}
doorTemp.LParam.expr = "_L+_ZG+_YG";
doorTemp.WParam.expr = "_W";
doorTemp.HParam.expr = "_H+_SG+_XG";
doorTemp.PXParam.expr = "-_ZG";
doorTemp.PZParam.expr = "-_XG";
return doorTemp;
}
protected SetOpenDir(doorsTemp: TemplateRecord, info: IDoorInfo)
{
for (let id of doorsTemp.Objects)
{
if (!id.IsErase)
{
let en = id.Object;
if (en instanceof Board)
{
en.OpenDir = this.GetBoardOpenDir(info.openDir) as BoardOpenDir;
}
else if (en instanceof HardwareCompositeEntity)
{
en.HardwareOption.model = this.GetBoardOpenDir(info.openDir, true) as string;
}
}
}
}
private GetBoardOpenDir(dir: DoorOpenDir, getModel = false): string | BoardOpenDir
{
switch (dir)
{
case DoorOpenDir.Left:
return BoardOpenDir.Left;
if (getModel)
return "左开门板";
else
return BoardOpenDir.Left;
case DoorOpenDir.Right:
return BoardOpenDir.Right;
if (getModel)
return "右开门板";
else
return BoardOpenDir.Right;
case DoorOpenDir.Top:
return BoardOpenDir.Up;
if (getModel)
return "上开门板";
else
return BoardOpenDir.Up;
case DoorOpenDir.Bottom:
return BoardOpenDir.Down;
if (getModel)
return "下开门板";
else
return BoardOpenDir.Down;
default:
return BoardOpenDir.None;
if (getModel)
return "门板";
else
return BoardOpenDir.None;
}
}
}

@ -1,14 +1,12 @@
import { app } from "../../../ApplicationServices/Application";
import { EBoardKeyList } from "../../../Common/BoardKeyList";
import { DuplicateRecordCloning } from "../../../Common/Status";
import { Board } from "../../../DatabaseServices/Entity/Board";
import { ObjectId } from "../../../DatabaseServices/ObjectId";
import { TemplateSizeBoard } from "../../../DatabaseServices/Template/ProgramTempate/TemplateSizeBoard";
import { TemplateRecord } from "../../../DatabaseServices/Template/TemplateRecord";
import { TemplateSplitType } from "../../../DatabaseServices/Template/TemplateType";
import { DrillType, BoardType } from "../../../UI/Store/BoardInterface";
import { openDirTitle } from "../../../UI/Store/DoorDrawerStore/DoorStore";
import { DisableChangeParName, DoorOpenDir, IDoorInfo } from "../../../UI/Store/DoorInterface";
import { BoardType } from "../../../UI/Store/BoardInterface";
import { DoorOpenDir, IDoorInfo } from "../../../UI/Store/DoorInterface";
import { DrawDoorTool } from "./DrawDoorDrawerTool";
import { SetTemplatePositionAndSetParent } from "../../../DatabaseServices/Template/TempateUtils";
@ -167,21 +165,7 @@ export class DrawLeftRightOpenDoor extends DrawDoorTool
let doorTemplate = this.GetDoorTemp(info);
this.GetHandleTemp(info, doorTemplate);
for (let id of doorTemplate.Objects)
{
if (!id.IsErase)
{
let en = id.Object;
if (en instanceof Board)
{
en.BoardProcessOption[EBoardKeyList.UpSealed] = this.option.topDoorSeal.toString();
en.BoardProcessOption[EBoardKeyList.DownSealed] = this.option.bottomDoorSeal.toString();
en.BoardProcessOption[EBoardKeyList.LeftSealed] = this.option.leftDoorSeal.toString();
en.BoardProcessOption[EBoardKeyList.RightSealed] = this.option.rightDoorSeal.toString();
en.OpenDir = this.GetBoardOpenDir(info.openDir);
}
}
}
this.SetOpenDir(doorTemplate, info);
rowTemplate.Children.push(doorTemplate.Id);
@ -302,52 +286,7 @@ export class DrawLeftRightOpenDoor extends DrawDoorTool
return rowTemplate;
}
private GetDoorTemp(info: IDoorInfo)
{
let doorTemp: TemplateRecord;
if (info.tempInfo.temp.id === "" || !this._idTempMap.has(info.tempInfo.temp.id))
{
doorTemp = new TemplateSizeBoard().InitBaseParams();
doorTemp.Name = "门板";
app.Database.TemplateTable.Append(doorTemp);
let br = Board.CreateBoard(info.height, info.width, 18, BoardType.Behind);
br.BoardProcessOption.drillType = DrillType.None;
if (this.surroundOption)
{
br.BoardProcessOption[EBoardKeyList.RoomName] = this.surroundOption[EBoardKeyList.RoomName];
br.BoardProcessOption[EBoardKeyList.CabinetName] = this.surroundOption[EBoardKeyList.CabinetName];
}
br.Name =
info.openDir === DoorOpenDir.None ? "门板" :
openDirTitle[info.openDir] + "开门板";
app.Database.ModelSpace.Append(br);
doorTemp.Objects.push(br.Id);
}
else
{
let drawId = info.tempInfo.temp.id;
let temp = this._idTempMap.get(drawId);
doorTemp = app.Database.WblockCloneObejcts([temp], app.Database.TemplateTable, new Map(), DuplicateRecordCloning.Ignore)[0] as TemplateRecord;
//修改的参数应用给模板
for (let par of info.tempInfo.temp.props)
{
if (DisableChangeParName.includes(par.name)) continue;
let p = doorTemp.GetParam(par.name);
if (p)
p.expr = par.expr;
}
}
doorTemp.LParam.expr = "_L+_ZG+_YG";
doorTemp.WParam.expr = "_W";
doorTemp.HParam.expr = "_H+_SG+_XG";
doorTemp.PXParam.expr = "-_ZG";
doorTemp.PZParam.expr = "-_XG";
return doorTemp;
}
private GetVerticalTemp(width: number, height: number, thickness: number, isEmpty: boolean, isAuto: boolean)
{
let verTemp: TemplateRecord;

@ -1,15 +1,13 @@
import { app } from "../../../ApplicationServices/Application";
import { EBoardKeyList } from "../../../Common/BoardKeyList";
import { DuplicateRecordCloning } from "../../../Common/Status";
import { Board } from "../../../DatabaseServices/Entity/Board";
import { ObjectId } from "../../../DatabaseServices/ObjectId";
import { TemplateSizeBoard } from "../../../DatabaseServices/Template/ProgramTempate/TemplateSizeBoard";
import { SetTemplatePositionAndSetParent } from "../../../DatabaseServices/Template/TempateUtils";
import { TemplateRecord } from "../../../DatabaseServices/Template/TemplateRecord";
import { TemplateSplitType } from "../../../DatabaseServices/Template/TemplateType";
import { DrillType, BoardType } from "../../../UI/Store/BoardInterface";
import { openDirTitle } from "../../../UI/Store/DoorDrawerStore/DoorStore";
import { DisableChangeParName, DoorOpenDir, IDoorInfo } from "../../../UI/Store/DoorInterface";
import { BoardType } from "../../../UI/Store/BoardInterface";
import { DoorOpenDir, IDoorInfo } from "../../../UI/Store/DoorInterface";
import { DrawDoorTool } from "./DrawDoorDrawerTool";
export class DrawUpDownOpenDoor extends DrawDoorTool
@ -167,22 +165,7 @@ export class DrawUpDownOpenDoor extends DrawDoorTool
let colTemplate = this.GetDoorSpaceTemplate(info, colWidth, hasVerLeft, hasVerRight);
let doorTemplate = this.GetDoorTemp(info);
this.GetHandleTemp(info, doorTemplate);
for (let id of doorTemplate.Objects)
{
if (!id.IsErase)
{
let en = id.Object;
if (en instanceof Board)
{
en.BoardProcessOption[EBoardKeyList.UpSealed] = this.option.topDoorSeal.toString();
en.BoardProcessOption[EBoardKeyList.DownSealed] = this.option.bottomDoorSeal.toString();
en.BoardProcessOption[EBoardKeyList.LeftSealed] = this.option.leftDoorSeal.toString();
en.BoardProcessOption[EBoardKeyList.RightSealed] = this.option.rightDoorSeal.toString();
en.OpenDir = this.GetBoardOpenDir(info.openDir);
}
}
}
this.SetOpenDir(doorTemplate, info);
colTemplate.Children.push(doorTemplate.Id);
return colTemplate;
@ -305,52 +288,6 @@ export class DrawUpDownOpenDoor extends DrawDoorTool
colTemplate.PXParam.expr = "_POS";
return colTemplate;
}
private GetDoorTemp(info: IDoorInfo)
{
let doorTemp: TemplateRecord;
if (info.tempInfo.temp.id === "" || !this._idTempMap.has(info.tempInfo.temp.id))
{
doorTemp = new TemplateSizeBoard().InitBaseParams();
doorTemp.Name = "门板";
app.Database.TemplateTable.Append(doorTemp);
let br = Board.CreateBoard(info.height, info.width, 18, BoardType.Behind);
br.BoardProcessOption.drillType = DrillType.None;
if (this.surroundOption)
{
br.BoardProcessOption[EBoardKeyList.RoomName] = this.surroundOption[EBoardKeyList.RoomName];
br.BoardProcessOption[EBoardKeyList.CabinetName] = this.surroundOption[EBoardKeyList.CabinetName];
}
br.Name =
info.openDir === DoorOpenDir.None ? "门板" :
openDirTitle[info.openDir] + "开门板";
app.Database.ModelSpace.Append(br);
doorTemp.Objects.push(br.Id);
}
else
{
let drawId = info.tempInfo.temp.id;
let temp = this._idTempMap.get(drawId);
doorTemp = app.Database.WblockCloneObejcts([temp], app.Database.TemplateTable, new Map(), DuplicateRecordCloning.Ignore)[0] as TemplateRecord;
//修改的参数应用给模板
for (let par of info.tempInfo.temp.props)
{
if (DisableChangeParName.includes(par.name)) continue;
let p = doorTemp.GetParam(par.name);
if (p)
p.expr = par.expr;
}
}
doorTemp.LParam.expr = "_L+_ZG+_YG";
doorTemp.WParam.expr = "_W";
doorTemp.HParam.expr = "_H+_SG+_XG";
doorTemp.PXParam.expr = "-_ZG";
doorTemp.PZParam.expr = "-_XG";
return doorTemp;
}
private GetLayerTemp(width: number, height: number, thickness: number, isEmpty: boolean, isAuto: boolean)
{
let layerTemp: TemplateRecord;

Loading…
Cancel
Save