Skip to content

Commit

Permalink
bring back constant
Browse files Browse the repository at this point in the history
  • Loading branch information
anthonie-kramer committed Nov 28, 2023
1 parent a89488a commit c1399d9
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public GeometricElement ConvertToElement(IfcProduct ifcProduct, RepresentationDa
//var wall = GetWallFromDoor(ifcDoor, allWalls);
var doorWidth = (IfcLengthMeasure)ifcDoor.OverallWidth;
var doorHeight = (IfcLengthMeasure)ifcDoor.OverallHeight;
var doorThickness = 2 * 0.0254;
var doorThickness = Door.DEFAULT_DOOR_THICKNESS;

var result = new Door(doorWidth,
doorHeight,
Expand Down
4 changes: 2 additions & 2 deletions Elements.Serialization.IFC/test/IFCTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,8 @@ public void Doors()
var wall1 = new StandardWall(wallLine1, 0.2, 3, name: "Wall1");
var wall2 = new StandardWall(wallLine2, 0.2, 2, name: "Wall2");

var door1 = new Door(wallLine1, 0.5, 1.5, 2.0, 2 * 0.0254, DoorOpeningSide.LeftHand, DoorOpeningType.DoubleSwing);
var door2 = new Door(wallLine2, 0.5, 1.5, 1.8, 2 * 0.0254, DoorOpeningSide.LeftHand, DoorOpeningType.DoubleSwing);
var door1 = new Door(wallLine1, 0.5, 1.5, 2.0, Door.DEFAULT_DOOR_THICKNESS, DoorOpeningSide.LeftHand, DoorOpeningType.DoubleSwing);
var door2 = new Door(wallLine2, 0.5, 1.5, 1.8, Door.DEFAULT_DOOR_THICKNESS, DoorOpeningSide.LeftHand, DoorOpeningType.DoubleSwing);

wall1.AddDoorOpening(door1);
wall2.AddDoorOpening(door2);
Expand Down
10 changes: 6 additions & 4 deletions Elements/src/BIM/Door/Door.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@ public class Door : GeometricElement
public double DoorWidth { get; set; }
/// <summary>Height of a door without a frame.</summary>
public double DoorHeight { get; set; }
/// <summary>Default door thickness.</summary>
public static double DEFAULT_DOOR_THICKNESS = 2 * 0.0254;
/// <summary>Door thickness.</summary>
public double DoorThickness { get; set; }
public double DoorThickness { get; set; } = DEFAULT_DOOR_THICKNESS;
/// <summary>Default thickness of a door frame.</summary>
public double FrameDepth { get; set; } = 4 * 0.0254;
/// <summary>Default width of a door frame.</summary>
Expand Down Expand Up @@ -84,7 +86,7 @@ public Door(double clearWidth,
DoorHeight = clearHeight;
DoorWidth = clearWidth;
DoorThickness = thickness;
Material = material;
Material = material ?? BuiltInMaterials.Default;
}

/// <summary>
Expand Down Expand Up @@ -126,7 +128,7 @@ public Door(Line line,
DoorWidth = clearWidth;
DoorHeight = clearHeight;
DoorThickness = thickness;
Material = material;
Material = material ?? BuiltInMaterials.Default;
Transform = GetDoorTransform(line.PointAtNormalized(tPos), line);
}

Expand Down Expand Up @@ -175,7 +177,7 @@ public override void UpdateRepresentations()
/// </summary>
public string GetRepresentationHash()
{
return $"{this.GetType().Name}-{this.DoorWidth}-{this.DoorHeight}-{this.DoorThickness}-{this.FrameDepth}-{this.FrameWidth}{this.FrameMaterial}-{this.OpeningType}-{this.OpeningSide}-{this.Material.Name}";
return $"{this.GetType().Name}-{this.DoorWidth}-{this.DoorHeight}-{this.DoorThickness}-{this.FrameDepth}-{this.FrameWidth}{this.FrameMaterial.Name}-{this.OpeningType}-{this.OpeningSide}-{this.Material.Name}";
}

public List<RepresentationInstance> GetInstances()

Check warning on line 183 in Elements/src/BIM/Door/Door.cs

View workflow job for this annotation

GitHub Actions / build-and-test

Missing XML comment for publicly visible type or member 'Door.GetInstances()'
Expand Down
2 changes: 1 addition & 1 deletion Elements/test/DoorTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public void MakeDoorElement()

var line = new Line(new Vector3(0, 0, 0), new Vector3(10, 10, 0));
var wall = new StandardWall(line, 0.1, 3.0);
var door = new Door(wall.CenterLine, 0.5, 2.0, 2.0, 2 * 0.0254, DoorOpeningSide.LeftHand, DoorOpeningType.SingleSwing);
var door = new Door(wall.CenterLine, 0.5, 2.0, 2.0, Door.DEFAULT_DOOR_THICKNESS, DoorOpeningSide.LeftHand, DoorOpeningType.SingleSwing);
wall.AddDoorOpening(door);

Assert.Single(wall.Openings);
Expand Down

0 comments on commit c1399d9

Please sign in to comment.