Skip to content

Commit b628fcb

Browse files
authored
Merge pull request #1102 from hypar-io/delete-door-class
delete door class and all references
2 parents 5ec3391 + 3761fa9 commit b628fcb

File tree

13 files changed

+12
-782
lines changed

13 files changed

+12
-782
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,10 @@
7878
- `GeometricElement.Intersects` method now supports multiple representations.
7979
- `GltfExtensions.ToGlTF` creates parent node for element and child nodes for representation instances.
8080

81+
82+
### Removed
83+
- `Elements.Doors` class
84+
8185
## 2.0.0
8286

8387
### Added

Elements.Serialization.IFC/src/IFCElementExtensions.cs

Lines changed: 0 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -264,57 +264,6 @@ private static IfcOpeningElement ToIfc(this Opening opening, Guid id, IfcLocalPl
264264
return ifcOpening;
265265
}
266266

267-
private static IfcDoor ToIfc(this Door door, Guid id, IfcLocalPlacement localPlacement, IfcProductDefinitionShape shape)
268-
{
269-
var ifcDoor = new IfcDoor(IfcGuid.ToIfcGuid(id),
270-
null,
271-
CreateIfcSafeLabelString(door.Name),
272-
null,
273-
null,
274-
localPlacement,
275-
shape,
276-
null,
277-
new IfcPositiveLengthMeasure(new IfcLengthMeasure(door.DoorHeight)),
278-
new IfcPositiveLengthMeasure(new IfcLengthMeasure(door.DoorWidth)),
279-
IfcDoorTypeEnum.DOOR,
280-
door.GetIfcDoorTypeOperation(),
281-
null
282-
);
283-
284-
return ifcDoor;
285-
}
286-
287-
private static IfcDoorTypeOperationEnum GetIfcDoorTypeOperation(this Door door)
288-
{
289-
if (door.OpeningType == DoorOpeningType.SingleSwing)
290-
{
291-
switch (door.OpeningSide)
292-
{
293-
case DoorOpeningSide.LeftHand:
294-
return IfcDoorTypeOperationEnum.SINGLE_SWING_LEFT;
295-
case DoorOpeningSide.RightHand:
296-
return IfcDoorTypeOperationEnum.SINGLE_SWING_RIGHT;
297-
case DoorOpeningSide.DoubleDoor:
298-
return IfcDoorTypeOperationEnum.DOUBLE_DOOR_SINGLE_SWING;
299-
}
300-
}
301-
else if (door.OpeningType == DoorOpeningType.DoubleSwing)
302-
{
303-
switch (door.OpeningSide)
304-
{
305-
case DoorOpeningSide.LeftHand:
306-
return IfcDoorTypeOperationEnum.DOUBLE_SWING_LEFT;
307-
case DoorOpeningSide.RightHand:
308-
return IfcDoorTypeOperationEnum.DOUBLE_SWING_RIGHT;
309-
case DoorOpeningSide.DoubleDoor:
310-
return IfcDoorTypeOperationEnum.DOUBLE_DOOR_DOUBLE_SWING;
311-
}
312-
}
313-
314-
315-
return IfcDoorTypeOperationEnum.NOTDEFINED;
316-
}
317-
318267
internal static IfcLocalPlacement ToIfcLocalPlacement(this Transform transform, Document doc, IfcObjectPlacement parent = null)
319268
{
320269
var placement = transform.ToIfcAxis2Placement3D(doc);
@@ -404,10 +353,6 @@ private static IfcProduct ConvertElementToIfcProduct(Guid id, GeometricElement e
404353
{
405354
e = floor.ToIfc(id, localPlacement, shape);
406355
}
407-
else if (element is Door door)
408-
{
409-
e = door.ToIfc(id, localPlacement, shape);
410-
}
411356
else if (element is Space space)
412357
{
413358
e = space.ToIfc(id, localPlacement, shape);

Elements.Serialization.IFC/src/IFCToHypar/Converters/CompositeFromIfcProductConverter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public CompositeFromIfcProductConverter(List<IFromIfcProductConverter> converter
3838
public GeometricElement ConvertToElement(IfcProduct ifcProduct, RepresentationData representationData, List<string> constructionErrors)
3939
{
4040
GeometricElement result;
41-
41+
4242
foreach (var converter in _converters)
4343
{
4444
if (!converter.CanConvert(ifcProduct))

Elements.Serialization.IFC/src/IFCToHypar/Converters/FromIfcDoorConverter.cs

Lines changed: 0 additions & 78 deletions
This file was deleted.

Elements.Serialization.IFC/src/IFCToHypar/FromIfcModelProvider.cs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ internal class FromIfcModelProvider
3636
/// </summary>
3737
/// <param name="path">A path to IFC file.</param>
3838
/// <param name="idsToConvert">Only IfcProducts with these ids will be converted.</param>
39-
/// <param name="fromIfcConverter">An object that converts IfcProducts to GeometricElements.
39+
/// <param name="fromIfcConverter">An object that converts IfcProducts to GeometricElements.
4040
/// If null, a fallback default converter will be created.</param>
4141
/// <param name="representationExtractor">An object that extracts RepresentationData from IfcRepresentations
4242
/// of IfcProduct. If null, a fallback default extractor will be created.</param>
@@ -160,7 +160,7 @@ private Element ConvertIfcProductToElement(IfcProduct product)
160160
//definition.SkipCSGUnion = true;
161161
}
162162

163-
// The cartesian transform needs to be applied
163+
// The cartesian transform needs to be applied
164164
// before the element transformation because it
165165
// may contain scale and rotation.
166166
var instanceTransform = new Transform(repData.MappingInfo.MappingTransform);
@@ -192,13 +192,13 @@ private void HandleRelationships(List<Element> elements)
192192
.Select(v => v.RelatedOpeningElement).Cast<IfcOpeningElement>()
193193
.SelectMany(io => io.ToOpenings());
194194

195-
var openingsOwner = (IHasOpenings) elementWithOpenings;
195+
var openingsOwner = (IHasOpenings)elementWithOpenings;
196196
openingsOwner.Openings.AddRange(openings);
197197
}
198198
}
199199

200200
/// <summary>
201-
/// Create the default IFromIfcProductConverter. It will be used, if
201+
/// Create the default IFromIfcProductConverter. It will be used, if
202202
/// IFromIfcProductConverter is not specified in the constructor.
203203
/// </summary>
204204
private static IFromIfcProductConverter GetDefaultFromIfcConverter()
@@ -208,7 +208,6 @@ private static IFromIfcProductConverter GetDefaultFromIfcConverter()
208208
new FromIfcFloorConverter(),
209209
new FromIfcSpaceConverter(),
210210
new FromIfcWallConverter(),
211-
new FromIfcDoorConverter(),
212211
new FromIfcBeamConverter(),
213212
new FromIfcColumnConverter()
214213
};
@@ -219,7 +218,7 @@ private static IFromIfcProductConverter GetDefaultFromIfcConverter()
219218
}
220219

221220
/// <summary>
222-
/// Create the default IfcRepresentationDataExtractor. It will be used, if
221+
/// Create the default IfcRepresentationDataExtractor. It will be used, if
223222
/// IfcRepresentationDataExtractor is not specified in the constructor.
224223
/// </summary>
225224
private static IfcRepresentationDataExtractor GetDefaultRepresentationDataExtractor(MaterialExtractor materialExtractor)

Elements.Serialization.IFC/src/IFCToHypar/IFCExtensions.cs

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -14,39 +14,6 @@ namespace Elements.Serialization.IFC.IFCToHypar
1414
/// </summary>
1515
internal static class IFCExtensions
1616
{
17-
internal static DoorOpeningSide GetDoorOpeningSide(this IfcDoor ifcDoor)
18-
{
19-
switch (ifcDoor.OperationType)
20-
{
21-
case IfcDoorTypeOperationEnum.SINGLE_SWING_LEFT:
22-
case IfcDoorTypeOperationEnum.DOUBLE_SWING_LEFT:
23-
return DoorOpeningSide.LeftHand;
24-
case IfcDoorTypeOperationEnum.SINGLE_SWING_RIGHT:
25-
case IfcDoorTypeOperationEnum.DOUBLE_SWING_RIGHT:
26-
return DoorOpeningSide.RightHand;
27-
case IfcDoorTypeOperationEnum.DOUBLE_DOOR_SINGLE_SWING:
28-
case IfcDoorTypeOperationEnum.DOUBLE_DOOR_DOUBLE_SWING:
29-
return DoorOpeningSide.DoubleDoor;
30-
}
31-
return DoorOpeningSide.Undefined;
32-
}
33-
34-
internal static DoorOpeningType GetDoorOpeningType(this IfcDoor ifcDoor)
35-
{
36-
switch (ifcDoor.OperationType)
37-
{
38-
case IfcDoorTypeOperationEnum.SINGLE_SWING_LEFT:
39-
case IfcDoorTypeOperationEnum.SINGLE_SWING_RIGHT:
40-
case IfcDoorTypeOperationEnum.DOUBLE_DOOR_SINGLE_SWING:
41-
return DoorOpeningType.SingleSwing;
42-
case IfcDoorTypeOperationEnum.DOUBLE_SWING_LEFT:
43-
case IfcDoorTypeOperationEnum.DOUBLE_SWING_RIGHT:
44-
case IfcDoorTypeOperationEnum.DOUBLE_DOOR_DOUBLE_SWING:
45-
return DoorOpeningType.DoubleSwing;
46-
}
47-
return DoorOpeningType.Undefined;
48-
}
49-
5017
// TODO: In IFC an IfcOpeningElement may have several extrudes.
5118
// Now they are extracted as separate Openings. As the result
5219
// initial Guid of IfcOpeningElement is not saved.

Elements.Serialization.IFC/test/IFCTests.cs

Lines changed: 2 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public IfcTests(ITestOutputHelper output)
2929
// [InlineData("rac_sample", "../../../models/IFC4/rac_advanced_sample_project.ifc")]
3030
// [InlineData("rme_sample", "../../../models/IFC4/rme_advanced_sample_project.ifc")]
3131
// [InlineData("rst_sample", "../../../models/IFC4/rst_advanced_sample_project.ifc")]
32-
[InlineData("AC-20-Smiley-West-10-Bldg", "../../../models/IFC4/AC-20-Smiley-West-10-Bldg.ifc", 1972, 120, 530, 270, 9, 140, 10, 2)]
32+
[InlineData("AC-20-Smiley-West-10-Bldg", "../../../models/IFC4/AC-20-Smiley-West-10-Bldg.ifc", 1963, 120, 530, 270, 9, 140, 10, 2)]
3333
// TODO: Some walls are extracted incorrectly and intersecting the roof. It happens because
3434
// IfcBooleanClippingResultParser doesn't handle the boolean clipping operation.
3535
// In order to fix it surface support is required.
@@ -39,7 +39,7 @@ public IfcTests(ITestOutputHelper output)
3939
// TODO: The entrance door has an incorrect representation. It happens because during
4040
// the UpdateRepresentation the default representation of a door is created instead of
4141
// the extracted one.
42-
[InlineData("AC20-Institute-Var-2", "../../../models/IFC4/AC20-Institute-Var-2.ifc", 1513, 5, 570, 121, 7, 82, 0, 21)]
42+
[InlineData("AC20-Institute-Var-2", "../../../models/IFC4/AC20-Institute-Var-2.ifc", 1506, 5, 570, 121, 7, 82, 0, 21)]
4343
// [InlineData("20160125WestRiverSide Hospital - IFC4-Autodesk_Hospital_Sprinkle", "../../../models/IFC4/20160125WestRiverSide Hospital - IFC4-Autodesk_Hospital_Sprinkle.ifc")]
4444
public void FromIFC4(string name,
4545
string ifcPath,
@@ -58,7 +58,6 @@ int expectedCountOfErrors
5858
int countOfFloors = model.AllElementsOfType<Floor>().Count();
5959
int countOfOpenings = model.AllElementsOfType<Opening>().Count();
6060
int countOfWalls = model.AllElementsOfType<Wall>().Count();
61-
int countOfDoors = model.AllElementsOfType<Door>().Count();
6261
int countOfSpaces = model.AllElementsOfType<Space>().Count();
6362
int countOfBeams = model.AllElementsOfType<Beam>().Count();
6463

@@ -67,7 +66,6 @@ int expectedCountOfErrors
6766
Assert.Equal(expectedCountOfFloors, countOfFloors);
6867
Assert.Equal(expectedCountOfOpenings, countOfOpenings);
6968
Assert.Equal(expectedCountOfWalls, countOfWalls);
70-
Assert.Equal(expectedCountOfDoors, countOfDoors);
7169
Assert.Equal(expectedCountOfSpaces, countOfSpaces);
7270
Assert.Equal(expectedCountOfBeams, countOfBeams);
7371

@@ -127,32 +125,6 @@ public void SpaceTemplate()
127125
hyparModel.ToIFC(path);
128126
}
129127

130-
[Fact]
131-
public void Doors()
132-
{
133-
var model = new Model();
134-
135-
// Add 2 walls.
136-
var wallLine1 = new Line(Vector3.Origin, new Vector3(10, 10, 0));
137-
var wallLine2 = new Line(new Vector3(10, 10, 0), new Vector3(10, 15, 0));
138-
var wall1 = new StandardWall(wallLine1, 0.2, 3, name: "Wall1");
139-
var wall2 = new StandardWall(wallLine2, 0.2, 2, name: "Wall2");
140-
141-
var door1 = new Door(wallLine1, 0.5, 1.5, 2.0, Door.DEFAULT_DOOR_THICKNESS, DoorOpeningSide.LeftHand, DoorOpeningType.DoubleSwing);
142-
var door2 = new Door(wallLine2, 0.5, 1.5, 1.8, Door.DEFAULT_DOOR_THICKNESS, DoorOpeningSide.LeftHand, DoorOpeningType.DoubleSwing);
143-
144-
wall1.AddDoorOpening(door1);
145-
wall2.AddDoorOpening(door2);
146-
147-
model.AddElement(wall1);
148-
model.AddElement(wall2);
149-
model.AddElement(door1);
150-
model.AddElement(door2);
151-
152-
model.ToJson(ConstructJsonPath("IfcDoor"));
153-
model.ToIFC(ConstructIfcPath("IfcDoor"));
154-
}
155-
156128
[Fact]
157129
public void Wall()
158130
{

0 commit comments

Comments
 (0)