mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-24 16:29:57 +00:00
Don't use IfcMappedItems for IfcOpenHouse walls, as suggested by Ian Clévy in https://sourceforge.net/p/ifcopenshell/discussion/1782716/thread/f9b586ca/?limit=25#ab87
This commit is contained in:
@@ -195,43 +195,46 @@ int main(int argc, char** argv) {
|
|||||||
file.addBuildingProduct(north_wall);
|
file.addBuildingProduct(north_wall);
|
||||||
file.setSurfaceColour(north_wall->Representation(), wall_colour);
|
file.setSurfaceColour(north_wall->Representation(), wall_colour);
|
||||||
|
|
||||||
IfcSchema::IfcShapeRepresentation* clipped_wall_body_rep = file.addEmptyRepresentation();
|
// Two identical representations are created for the two remaining walls. Mapped items
|
||||||
file.addBox(clipped_wall_body_rep, 5000, 360, 6000);
|
// are not used, because it is not allowed by the standard for wall body representations.
|
||||||
// The east wall geometry is clipped using two IfcHalfSpaceSolids, created from an
|
// MappedItems are not allowed for Axis representations as per CV-2x3-161
|
||||||
// 'axis 3d placement' that specifies the plane against which the geometry is clipped.
|
IfcSchema::IfcProductDefinitionShape* clipped_wall_body_reps[2];
|
||||||
file.clipRepresentation(clipped_wall_body_rep, file.addPlacement3d(-2500, 0, 3000, -1, 0, 1), false);
|
for (int i = 0; i < 2; ++i) {
|
||||||
file.clipRepresentation(clipped_wall_body_rep, file.addPlacement3d(2500, 0, 3000, 1, 0, 1), false);
|
IfcSchema::IfcShapeRepresentation* body = file.addEmptyRepresentation();
|
||||||
|
file.addBox(body, 5000, 360, 6000);
|
||||||
|
// The wall geometry is clipped using two IfcHalfSpaceSolids, created from an
|
||||||
|
// 'axis 3d placement' that specifies the plane against which the geometry is clipped.
|
||||||
|
file.clipRepresentation(body, file.addPlacement3d(-2500, 0, 3000, -1, 0, 1), false);
|
||||||
|
file.clipRepresentation(body, file.addPlacement3d(2500, 0, 3000, 1, 0, 1), false);
|
||||||
|
file.setSurfaceColour(body, wall_colour);
|
||||||
|
|
||||||
|
IfcSchema::IfcShapeRepresentation* axis = file.addEmptyRepresentation("Axis", "Curve2D");
|
||||||
|
file.addAxis(axis, 5000);
|
||||||
|
|
||||||
|
IfcSchema::IfcRepresentation::list::ptr reps(new IfcSchema::IfcRepresentation::list);
|
||||||
|
reps->push(body);
|
||||||
|
reps->push(axis);
|
||||||
|
clipped_wall_body_reps[i] = new IfcSchema::IfcProductDefinitionShape(null, null, reps);
|
||||||
|
}
|
||||||
|
|
||||||
// Now create a wall on the east of the building, again starting with just a box shape
|
// Now create a wall on the east of the building, again starting with just a box shape
|
||||||
IfcSchema::IfcWallStandardCase* east_wall = new IfcSchema::IfcWallStandardCase(guid(), file.getSingle<IfcSchema::IfcOwnerHistory>(),
|
IfcSchema::IfcWallStandardCase* east_wall = new IfcSchema::IfcWallStandardCase(guid(), file.getSingle<IfcSchema::IfcOwnerHistory>(),
|
||||||
S("East wall"), null, null, file.addLocalPlacement(storey_placement, 4820, 2500, 0, 0, 0, 1, 0, 1, 0), file.addMappedItem(clipped_wall_body_rep), null
|
S("East wall"), null, null, file.addLocalPlacement(storey_placement, 4820, 2500, 0, 0, 0, 1, 0, 1, 0), clipped_wall_body_reps[0], null
|
||||||
#ifdef USE_IFC4
|
#ifdef USE_IFC4
|
||||||
, IfcSchema::IfcWallTypeEnum::IfcWallType_STANDARD
|
, IfcSchema::IfcWallTypeEnum::IfcWallType_STANDARD
|
||||||
#endif
|
#endif
|
||||||
);
|
);
|
||||||
file.addBuildingProduct(east_wall);
|
file.addBuildingProduct(east_wall);
|
||||||
|
|
||||||
file.setSurfaceColour(clipped_wall_body_rep, wall_colour);
|
|
||||||
|
|
||||||
// The east wall is copied to the west location of the house
|
// The east wall is copied to the west location of the house
|
||||||
IfcSchema::IfcWallStandardCase* west_wall = new IfcSchema::IfcWallStandardCase(guid(), file.getSingle<IfcSchema::IfcOwnerHistory>(),
|
IfcSchema::IfcWallStandardCase* west_wall = new IfcSchema::IfcWallStandardCase(guid(), file.getSingle<IfcSchema::IfcOwnerHistory>(),
|
||||||
S("West wall"), null, null, file.addLocalPlacement(storey_placement, -4820, 2500, 0, 0, 0, 1, 0, -1, 0), file.addMappedItem(clipped_wall_body_rep), null
|
S("West wall"), null, null, file.addLocalPlacement(storey_placement, -4820, 2500, 0, 0, 0, 1, 0, -1, 0), clipped_wall_body_reps[1], null
|
||||||
#ifdef USE_IFC4
|
#ifdef USE_IFC4
|
||||||
, IfcSchema::IfcWallTypeEnum::IfcWallType_STANDARD
|
, IfcSchema::IfcWallTypeEnum::IfcWallType_STANDARD
|
||||||
#endif
|
#endif
|
||||||
);
|
);
|
||||||
file.addBuildingProduct(west_wall);
|
file.addBuildingProduct(west_wall);
|
||||||
|
|
||||||
for (int i = 0; i < 2; ++i) {
|
|
||||||
// CV-2x3-161: MappedItems are not allowed for Axis representations
|
|
||||||
IfcSchema::IfcWallStandardCase* wall = i == 0 ? east_wall : west_wall;
|
|
||||||
IfcSchema::IfcShapeRepresentation* wall_axis_rep = file.addEmptyRepresentation("Axis", "Curve2D");
|
|
||||||
file.addAxis(wall_axis_rep, 5000);
|
|
||||||
IfcSchema::IfcRepresentation::list::ptr reps = wall->Representation()->Representations();
|
|
||||||
reps->push(wall_axis_rep);
|
|
||||||
wall->Representation()->setRepresentations(reps);
|
|
||||||
}
|
|
||||||
|
|
||||||
// The west wall is assigned an opening element we created for the south wall, opening elements are
|
// The west wall is assigned an opening element we created for the south wall, opening elements are
|
||||||
// not shared accross building elements, even if they share the same representation. Hence, the east
|
// not shared accross building elements, even if they share the same representation. Hence, the east
|
||||||
// wall will not feature this opening.
|
// wall will not feature this opening.
|
||||||
|
|||||||
Reference in New Issue
Block a user