Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@
- `GeometricElement.Intersects` method now supports multiple representations.
- `GltfExtensions.ToGlTF` creates parent node for element and child nodes for representation instances.


### Removed
- `Elements.Doors` class

## 2.0.0

### Added
Expand Down
55 changes: 0 additions & 55 deletions Elements.Serialization.IFC/src/IFCElementExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -264,57 +264,6 @@ private static IfcOpeningElement ToIfc(this Opening opening, Guid id, IfcLocalPl
return ifcOpening;
}

private static IfcDoor ToIfc(this Door door, Guid id, IfcLocalPlacement localPlacement, IfcProductDefinitionShape shape)
{
var ifcDoor = new IfcDoor(IfcGuid.ToIfcGuid(id),
null,
CreateIfcSafeLabelString(door.Name),
null,
null,
localPlacement,
shape,
null,
new IfcPositiveLengthMeasure(new IfcLengthMeasure(door.DoorHeight)),
new IfcPositiveLengthMeasure(new IfcLengthMeasure(door.DoorWidth)),
IfcDoorTypeEnum.DOOR,
door.GetIfcDoorTypeOperation(),
null
);

return ifcDoor;
}

private static IfcDoorTypeOperationEnum GetIfcDoorTypeOperation(this Door door)
{
if (door.OpeningType == DoorOpeningType.SingleSwing)
{
switch (door.OpeningSide)
{
case DoorOpeningSide.LeftHand:
return IfcDoorTypeOperationEnum.SINGLE_SWING_LEFT;
case DoorOpeningSide.RightHand:
return IfcDoorTypeOperationEnum.SINGLE_SWING_RIGHT;
case DoorOpeningSide.DoubleDoor:
return IfcDoorTypeOperationEnum.DOUBLE_DOOR_SINGLE_SWING;
}
}
else if (door.OpeningType == DoorOpeningType.DoubleSwing)
{
switch (door.OpeningSide)
{
case DoorOpeningSide.LeftHand:
return IfcDoorTypeOperationEnum.DOUBLE_SWING_LEFT;
case DoorOpeningSide.RightHand:
return IfcDoorTypeOperationEnum.DOUBLE_SWING_RIGHT;
case DoorOpeningSide.DoubleDoor:
return IfcDoorTypeOperationEnum.DOUBLE_DOOR_DOUBLE_SWING;
}
}


return IfcDoorTypeOperationEnum.NOTDEFINED;
}

internal static IfcLocalPlacement ToIfcLocalPlacement(this Transform transform, Document doc, IfcObjectPlacement parent = null)
{
var placement = transform.ToIfcAxis2Placement3D(doc);
Expand Down Expand Up @@ -404,10 +353,6 @@ private static IfcProduct ConvertElementToIfcProduct(Guid id, GeometricElement e
{
e = floor.ToIfc(id, localPlacement, shape);
}
else if (element is Door door)
{
e = door.ToIfc(id, localPlacement, shape);
}
else if (element is Space space)
{
e = space.ToIfc(id, localPlacement, shape);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public CompositeFromIfcProductConverter(List<IFromIfcProductConverter> converter
public GeometricElement ConvertToElement(IfcProduct ifcProduct, RepresentationData representationData, List<string> constructionErrors)
{
GeometricElement result;

foreach (var converter in _converters)
{
if (!converter.CanConvert(ifcProduct))
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ internal class FromIfcModelProvider
/// </summary>
/// <param name="path">A path to IFC file.</param>
/// <param name="idsToConvert">Only IfcProducts with these ids will be converted.</param>
/// <param name="fromIfcConverter">An object that converts IfcProducts to GeometricElements.
/// <param name="fromIfcConverter">An object that converts IfcProducts to GeometricElements.
/// If null, a fallback default converter will be created.</param>
/// <param name="representationExtractor">An object that extracts RepresentationData from IfcRepresentations
/// of IfcProduct. If null, a fallback default extractor will be created.</param>
Expand Down Expand Up @@ -160,7 +160,7 @@ private Element ConvertIfcProductToElement(IfcProduct product)
//definition.SkipCSGUnion = true;
}

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

var openingsOwner = (IHasOpenings) elementWithOpenings;
var openingsOwner = (IHasOpenings)elementWithOpenings;
openingsOwner.Openings.AddRange(openings);
}
}

/// <summary>
/// Create the default IFromIfcProductConverter. It will be used, if
/// Create the default IFromIfcProductConverter. It will be used, if
/// IFromIfcProductConverter is not specified in the constructor.
/// </summary>
private static IFromIfcProductConverter GetDefaultFromIfcConverter()
Expand All @@ -208,7 +208,6 @@ private static IFromIfcProductConverter GetDefaultFromIfcConverter()
new FromIfcFloorConverter(),
new FromIfcSpaceConverter(),
new FromIfcWallConverter(),
new FromIfcDoorConverter(),
new FromIfcBeamConverter(),
new FromIfcColumnConverter()
};
Expand All @@ -219,7 +218,7 @@ private static IFromIfcProductConverter GetDefaultFromIfcConverter()
}

/// <summary>
/// Create the default IfcRepresentationDataExtractor. It will be used, if
/// Create the default IfcRepresentationDataExtractor. It will be used, if
/// IfcRepresentationDataExtractor is not specified in the constructor.
/// </summary>
private static IfcRepresentationDataExtractor GetDefaultRepresentationDataExtractor(MaterialExtractor materialExtractor)
Expand Down
33 changes: 0 additions & 33 deletions Elements.Serialization.IFC/src/IFCToHypar/IFCExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,39 +14,6 @@ namespace Elements.Serialization.IFC.IFCToHypar
/// </summary>
internal static class IFCExtensions
{
internal static DoorOpeningSide GetDoorOpeningSide(this IfcDoor ifcDoor)
{
switch (ifcDoor.OperationType)
{
case IfcDoorTypeOperationEnum.SINGLE_SWING_LEFT:
case IfcDoorTypeOperationEnum.DOUBLE_SWING_LEFT:
return DoorOpeningSide.LeftHand;
case IfcDoorTypeOperationEnum.SINGLE_SWING_RIGHT:
case IfcDoorTypeOperationEnum.DOUBLE_SWING_RIGHT:
return DoorOpeningSide.RightHand;
case IfcDoorTypeOperationEnum.DOUBLE_DOOR_SINGLE_SWING:
case IfcDoorTypeOperationEnum.DOUBLE_DOOR_DOUBLE_SWING:
return DoorOpeningSide.DoubleDoor;
}
return DoorOpeningSide.Undefined;
}

internal static DoorOpeningType GetDoorOpeningType(this IfcDoor ifcDoor)
{
switch (ifcDoor.OperationType)
{
case IfcDoorTypeOperationEnum.SINGLE_SWING_LEFT:
case IfcDoorTypeOperationEnum.SINGLE_SWING_RIGHT:
case IfcDoorTypeOperationEnum.DOUBLE_DOOR_SINGLE_SWING:
return DoorOpeningType.SingleSwing;
case IfcDoorTypeOperationEnum.DOUBLE_SWING_LEFT:
case IfcDoorTypeOperationEnum.DOUBLE_SWING_RIGHT:
case IfcDoorTypeOperationEnum.DOUBLE_DOOR_DOUBLE_SWING:
return DoorOpeningType.DoubleSwing;
}
return DoorOpeningType.Undefined;
}

// TODO: In IFC an IfcOpeningElement may have several extrudes.
// Now they are extracted as separate Openings. As the result
// initial Guid of IfcOpeningElement is not saved.
Expand Down
32 changes: 2 additions & 30 deletions Elements.Serialization.IFC/test/IFCTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public IfcTests(ITestOutputHelper output)
// [InlineData("rac_sample", "../../../models/IFC4/rac_advanced_sample_project.ifc")]
// [InlineData("rme_sample", "../../../models/IFC4/rme_advanced_sample_project.ifc")]
// [InlineData("rst_sample", "../../../models/IFC4/rst_advanced_sample_project.ifc")]
[InlineData("AC-20-Smiley-West-10-Bldg", "../../../models/IFC4/AC-20-Smiley-West-10-Bldg.ifc", 1972, 120, 530, 270, 9, 140, 10, 2)]
[InlineData("AC-20-Smiley-West-10-Bldg", "../../../models/IFC4/AC-20-Smiley-West-10-Bldg.ifc", 1963, 120, 530, 270, 9, 140, 10, 2)]
// TODO: Some walls are extracted incorrectly and intersecting the roof. It happens because
// IfcBooleanClippingResultParser doesn't handle the boolean clipping operation.
// In order to fix it surface support is required.
Expand All @@ -39,7 +39,7 @@ public IfcTests(ITestOutputHelper output)
// TODO: The entrance door has an incorrect representation. It happens because during
// the UpdateRepresentation the default representation of a door is created instead of
// the extracted one.
[InlineData("AC20-Institute-Var-2", "../../../models/IFC4/AC20-Institute-Var-2.ifc", 1513, 5, 570, 121, 7, 82, 0, 21)]
[InlineData("AC20-Institute-Var-2", "../../../models/IFC4/AC20-Institute-Var-2.ifc", 1506, 5, 570, 121, 7, 82, 0, 21)]
// [InlineData("20160125WestRiverSide Hospital - IFC4-Autodesk_Hospital_Sprinkle", "../../../models/IFC4/20160125WestRiverSide Hospital - IFC4-Autodesk_Hospital_Sprinkle.ifc")]
public void FromIFC4(string name,
string ifcPath,
Expand All @@ -58,7 +58,6 @@ int expectedCountOfErrors
int countOfFloors = model.AllElementsOfType<Floor>().Count();
int countOfOpenings = model.AllElementsOfType<Opening>().Count();
int countOfWalls = model.AllElementsOfType<Wall>().Count();
int countOfDoors = model.AllElementsOfType<Door>().Count();
int countOfSpaces = model.AllElementsOfType<Space>().Count();
int countOfBeams = model.AllElementsOfType<Beam>().Count();

Expand All @@ -67,7 +66,6 @@ int expectedCountOfErrors
Assert.Equal(expectedCountOfFloors, countOfFloors);
Assert.Equal(expectedCountOfOpenings, countOfOpenings);
Assert.Equal(expectedCountOfWalls, countOfWalls);
Assert.Equal(expectedCountOfDoors, countOfDoors);
Assert.Equal(expectedCountOfSpaces, countOfSpaces);
Assert.Equal(expectedCountOfBeams, countOfBeams);

Expand Down Expand Up @@ -127,32 +125,6 @@ public void SpaceTemplate()
hyparModel.ToIFC(path);
}

[Fact]
public void Doors()
{
var model = new Model();

// Add 2 walls.
var wallLine1 = new Line(Vector3.Origin, new Vector3(10, 10, 0));
var wallLine2 = new Line(new Vector3(10, 10, 0), new Vector3(10, 15, 0));
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, 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);

model.AddElement(wall1);
model.AddElement(wall2);
model.AddElement(door1);
model.AddElement(door2);

model.ToJson(ConstructJsonPath("IfcDoor"));
model.ToIFC(ConstructIfcPath("IfcDoor"));
}

[Fact]
public void Wall()
{
Expand Down
Loading
Loading