Skip to content

Commit c02f270

Browse files
RickBriceaothms
authored andcommitted
Adds support for 4x3 rc3 and rc4 for IfcParser library
1 parent a73178f commit c02f270

18 files changed

Lines changed: 196751 additions & 77 deletions

cmake/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,7 @@ function(files_for_ifc_version IFC_VERSION RESULT_NAME)
494494
)
495495
endfunction()
496496

497-
set(SCHEMA_VERSIONS "2x3" "4" "4x1" "4x2" "4x3_rc1" "4x3_rc2")
497+
set(SCHEMA_VERSIONS "2x3" "4" "4x1" "4x2" "4x3_rc1" "4x3_rc2" "4x3_rc3" "4x3_rc4")
498498

499499
foreach(s ${SCHEMA_VERSIONS})
500500
add_definitions(-DHAS_SCHEMA_${s})

src/examples/IfcAdvancedHouse.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,7 @@ int main() {
103103
building->setRepresentation(building_shape);
104104

105105
// A pale white colour is assigned to the building.
106-
file.setSurfaceColour(
107-
building_shape, 0.75, 0.73, 0.68);
106+
setSurfaceColour(file, building_shape, 0.75, 0.73, 0.68);
108107

109108
// For the ground mesh of the IfcSite we will use a Nurbs surface created in Open Cascade. Only
110109
// in IFC4 the surface can be directly serialized. In IFC2X3 the it will have to be tesselated.
@@ -122,7 +121,7 @@ int main() {
122121
(*it)->setContextOfItems(file.getRepresentationContext("Model"));
123122
}
124123
file.addEntity(ground_representation);
125-
file.setSurfaceColour(ground_representation, 0.15, 0.25, 0.05);
124+
setSurfaceColour(file, ground_representation, 0.15, 0.25, 0.05);
126125

127126
/*
128127
// Note that IFC lacks elementary surfaces that STEP does have, such as spherical_surface.

src/examples/IfcOpenHouse.cpp

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,7 @@ int main() {
107107
south_wall->setObjectPlacement(file.addLocalPlacement(storey_placement));
108108

109109
// A pale white colour is assigned to the wall.
110-
IfcSchema::IfcPresentationStyleAssignment* wall_colour = file.setSurfaceColour(
111-
south_wall_shape, 0.75, 0.73, 0.68);
110+
IfcSchema::IfcPresentationStyleAssignment* wall_colour = setSurfaceColour(file, south_wall_shape, 0.75, 0.73, 0.68);
112111

113112
// Now create a footing for the wall to rest on.
114113
IfcSchema::IfcFooting* footing = new IfcSchema::IfcFooting(guid(), file.getSingle<IfcSchema::IfcOwnerHistory>(),
@@ -122,7 +121,7 @@ int main() {
122121
footing->setRepresentation(file.addBox(10100, 5460, 2000));
123122
footing->setObjectPlacement(file.addLocalPlacement(storey_placement, 0, 2500, -2000));
124123
// The footing will have a dark gray colour
125-
IfcSchema::IfcPresentationStyleAssignment* footing_colour = file.setSurfaceColour(footing->Representation(), 0.26, 0.22, 0.18);
124+
IfcSchema::IfcPresentationStyleAssignment* footing_colour = setSurfaceColour(file,footing->Representation(), 0.26, 0.22, 0.18);
126125

127126
// IFC has two ways to apply boolean operations to geometry. IfcBooleanResults are commonly used
128127
// to clip geometry to a surface, for example to a slanted roof. For openings that are filled
@@ -192,7 +191,7 @@ int main() {
192191
file.addBuildingProduct(north_roof_part);
193192
file.addBuildingProduct(roof);
194193

195-
file.setSurfaceColour(roof_rep, 0.24, 0.08, 0.04);
194+
setSurfaceColour(file, roof_rep, 0.24, 0.08, 0.04);
196195

197196
// Copy the south wall to the north
198197
IfcSchema::IfcWallStandardCase* north_wall = new IfcSchema::IfcWallStandardCase(guid(), file.getSingle<IfcSchema::IfcOwnerHistory>(), S("North wall"),
@@ -202,7 +201,7 @@ int main() {
202201
#endif
203202
);
204203
file.addBuildingProduct(north_wall);
205-
file.setSurfaceColour(north_wall->Representation(), wall_colour);
204+
setSurfaceColour(file,north_wall->Representation(), wall_colour);
206205

207206
// Two identical representations are created for the two remaining walls. Mapped items
208207
// are not used, because it is not allowed by the standard for wall body representations.
@@ -215,7 +214,7 @@ int main() {
215214
// 'axis 3d placement' that specifies the plane against which the geometry is clipped.
216215
file.clipRepresentation(body, file.addPlacement3d(-2500, 0, 3000, -1, 0, 1), false);
217216
file.clipRepresentation(body, file.addPlacement3d(2500, 0, 3000, 1, 0, 1), false);
218-
file.setSurfaceColour(body, wall_colour);
217+
setSurfaceColour(file, body, wall_colour);
219218

220219
IfcSchema::IfcShapeRepresentation* axis = file.addEmptyRepresentation("Axis", "Curve2D");
221220
file.addAxis(axis, 5000);
@@ -291,7 +290,7 @@ int main() {
291290
(*it)->setContextOfItems(file.getRepresentationContext("Model"));
292291
}
293292
file.addEntity(ground_representation);
294-
file.setSurfaceColour(ground_representation, 0.15, 0.25, 0.05);
293+
setSurfaceColour(file,ground_representation, 0.15, 0.25, 0.05);
295294

296295
// According to the Ifc2x3 schema an IfcWallStandardCase needs to have an IfcMaterialLayerSet
297296
// assigned. Note that this material definition is independent of the surface styles we have
@@ -371,7 +370,7 @@ int main() {
371370
);
372371

373372
file.addBuildingProduct(stair);
374-
file.setSurfaceColour(stair->Representation(), footing_colour);
373+
setSurfaceColour(file, stair->Representation(), footing_colour);
375374

376375
IfcSchema::IfcOpeningElement* door_opening = new IfcSchema::IfcOpeningElement(guid(), file.getSingle<IfcSchema::IfcOwnerHistory>(),
377376
null, null, null, file.addLocalPlacement(storey_placement, 5000-180, 2500-900, 0), file.addBox(1000, 1000, 2200), null
@@ -406,7 +405,7 @@ int main() {
406405
file.addBox(door_body, 1000, 80, 80, 0, file.addPlacement3d( 0, 0, 2120));
407406
file.addBox(door_body, 860, 30, 2120);
408407
file.addBuildingProduct(door);
409-
file.setSurfaceColour(door->Representation(), 0.9, 0.9, 0.9);
408+
setSurfaceColour(file, door->Representation(), 0.9, 0.9, 0.9);
410409
file.addEntity(new IfcSchema::IfcRelFillsElement(guid(), file.getSingle<IfcSchema::IfcOwnerHistory>(), null, null, door_opening, door));
411410

412411
IfcSchema::IfcDoorStyle* door_style = new IfcSchema::IfcDoorStyle(guid(), file.getSingle<IfcSchema::IfcOwnerHistory>(), S("Door type"), null, null, null, null, null,
@@ -440,9 +439,9 @@ int main() {
440439
IfcSchema::IfcPresentationStyleAssignment* frame_style = 0;
441440
for (IfcSchema::IfcShapeRepresentation::list::it i = frame_representations->begin(); i != frame_representations->end(); i += 2) {
442441
if (frame_style) {
443-
file.setSurfaceColour(*i, frame_style);
442+
setSurfaceColour(file,*i, frame_style);
444443
} else {
445-
frame_style = file.setSurfaceColour(*i, 0.5, 0.4, 0.3);
444+
frame_style = setSurfaceColour(file,*i, 0.5, 0.4, 0.3);
446445
}
447446
// Because of the duplication the iterator is incremented twice
448447
}
@@ -509,7 +508,7 @@ int main() {
509508
file.addEntity(glass_part);
510509
window_parts->push(glass_part);
511510
file.relatePlacements(window, glass_part);
512-
file.setSurfaceColour(glass_part->Representation(), 0.6, 0.7, 0.75, 0.1);
511+
setSurfaceColour(file,glass_part->Representation(), 0.6, 0.7, 0.75, 0.1);
513512

514513
// Now create a decomposition relation between the window and the parts. Most viewers and authoring
515514
// tools will consider the window a single entity that can be selected as a whole.

src/ifcgeom/IfcGeom.h

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -469,23 +469,30 @@ class IFC_GEOM_API MAKE_TYPE_NAME(Kernel) : public IfcGeom::Kernel {
469469
IfcSchema::IfcPresentationStyleAssignment* style_assignment = (IfcSchema::IfcPresentationStyleAssignment*) *kt;
470470

471471
Logger::Warning("Deprecated usage of", style_assignment);
472-
#else
472+
473+
// Only in case of 2x3 or old style IfcPresentationStyleAssignment
474+
auto styles = style_assignment->Styles();
475+
476+
#elif defined SCHEMA_HAS_IfcPresentationStyleAssignment
473477
IfcSchema::IfcPresentationStyleAssignment::list::ptr style_assignments = si->Styles();
474478
for (IfcSchema::IfcPresentationStyleAssignment::list::it kt = style_assignments->begin(); kt != style_assignments->end(); ++kt) {
475479
IfcSchema::IfcPresentationStyleAssignment* style_assignment = *kt;
476-
#endif
477480

478481
// Only in case of 2x3 or old style IfcPresentationStyleAssignment
482+
auto styles = style_assignment->Styles();
483+
#else
484+
auto styles = si->Styles();
485+
#endif
479486

480-
IfcEntityList::ptr styles = style_assignment->Styles();
481-
482-
for (IfcEntityList::it lt = styles->begin(); lt != styles->end(); ++lt) {
487+
for (auto lt = styles->begin(); lt != styles->end(); ++lt) {
483488
auto style_l = (*lt)->as<IfcSchema::IfcPresentationStyle>();
484489
if (style_l) {
485490
prs_styles.push_back(style_l);
486491
}
487492
}
488-
}
493+
#if defined SCHEMA_HAS_IfcStyleAssignmentSelect or defined SCHEMA_HAS_IfcPresentationStyleAssignment
494+
}
495+
#endif
489496

490497
for (auto& style : prs_styles) {
491498
if (style->declaration().is(IfcSchema::IfcSurfaceStyle::Class())) {

src/ifcgeom_schema_agnostic/Kernel.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@
2323
#ifdef HAS_SCHEMA_4x3_rc2
2424
#include "../ifcparse/Ifc4x3_rc2.h"
2525
#endif
26+
#ifdef HAS_SCHEMA_4x3_rc3
27+
#include "../ifcparse/Ifc4x3_rc3.h"
28+
#endif
29+
#ifdef HAS_SCHEMA_4x3_rc4
30+
#include "../ifcparse/Ifc4x3_rc4.h"
31+
#endif
2632

2733
#include <boost/function.hpp>
2834

0 commit comments

Comments
 (0)