功能:户型门支持镜像,修改方向

pull/2321/MERGE
ChenX 1 year ago
parent 339f2af8ef
commit db194c9f56

@ -25,6 +25,8 @@ export class TemplateRoomDoorRecord extends TemplateRecord
@AutoRecord HoleObjectId: ObjectId<RoomHolePolyline>; @AutoRecord HoleObjectId: ObjectId<RoomHolePolyline>;
@AutoRecord DoorLogo: string; @AutoRecord DoorLogo: string;
@AutoRecord IsMirror = false;
constructor() constructor()
{ {
super(); super();
@ -51,13 +53,26 @@ export class TemplateRoomDoorRecord extends TemplateRecord
let pos = new PositioningFixed; let pos = new PositioningFixed;
pos.SpaceCS = hole.FakerWalls[0].OCS; pos.SpaceCS = hole.FakerWalls[0].OCS;
let wall = hole.FakerWalls[0];
let length = wall.Length;
if (this.IsMirror)
{
pos.SpaceCS.elements[0] *= -1;
pos.SpaceCS.elements[1] *= -1;
pos.SpaceCS.elements[2] *= -1;
pos.SpaceCS.elements[12] -= pos.SpaceCS.elements[0] * length;
pos.SpaceCS.elements[13] -= pos.SpaceCS.elements[1] * length;
pos.SpaceCS.elements[14] -= pos.SpaceCS.elements[2] * length;
}
let yDir = new Vector3().setFromMatrixColumn(pos.SpaceCS, 1); let yDir = new Vector3().setFromMatrixColumn(pos.SpaceCS, 1);
pos.SpaceCS.elements[12] -= yDir.x * hole.FakerWalls[0].Thickness * 0.5; pos.SpaceCS.elements[12] -= yDir.x * hole.FakerWalls[0].Thickness * 0.5;
pos.SpaceCS.elements[13] -= yDir.y * hole.FakerWalls[0].Thickness * 0.5; pos.SpaceCS.elements[13] -= yDir.y * hole.FakerWalls[0].Thickness * 0.5;
pos.SpaceCS.elements[14] -= yDir.z * hole.FakerWalls[0].Thickness * 0.5; pos.SpaceCS.elements[14] -= yDir.z * hole.FakerWalls[0].Thickness * 0.5;
let wall = hole.FakerWalls[0]; pos.SpaceSize = new Vector3(length, wall.Thickness, wall.Height);
pos.SpaceSize = new Vector3(wall.Length, wall.Thickness, wall.Height);
tr.Positioning = pos; tr.Positioning = pos;
} }
@ -71,18 +86,23 @@ export class TemplateRoomDoorRecord extends TemplateRecord
this.HoleObjectId = file.ReadObjectId() as any; this.HoleObjectId = file.ReadObjectId() as any;
if (ver > 1) if (ver > 1)
{
this.DoorLogo = file.Read(); this.DoorLogo = file.Read();
}
if (ver > 2)
this.IsMirror = file.Read();
else
this.IsMirror = false;
} }
//对象将自身数据写入到文件. //对象将自身数据写入到文件.
override WriteFile(file: CADFiler) override WriteFile(file: CADFiler)
{ {
file.Write(2); file.Write(3);
super.WriteFile(file); super.WriteFile(file);
file.WriteObjectId(this.HoleObjectId); file.WriteObjectId(this.HoleObjectId);
file.Write(this.DoorLogo); file.Write(this.DoorLogo);
file.Write(this.IsMirror);
} }
//局部撤销 //局部撤销

Loading…
Cancel
Save