From 5a067158431deeabbb24a53c969092c72392e635 Mon Sep 17 00:00:00 2001 From: Thomas Krijnen Date: Wed, 27 Aug 2025 10:21:45 +0200 Subject: [PATCH] Update examples --- src/examples/IfcAdvancedHouse.cpp | 2 +- src/examples/IfcOpenHouse.cpp | 2 +- src/examples/IfcParseExamples.cpp | 6 +++--- src/ifcparse/IfcHierarchyHelper.cpp | 22 ++++++++++++++++++++++ src/ifcparse/IfcHierarchyHelper.h | 8 ++++++++ 5 files changed, 35 insertions(+), 5 deletions(-) diff --git a/src/examples/IfcAdvancedHouse.cpp b/src/examples/IfcAdvancedHouse.cpp index cb1f64975f..ad238a22fd 100644 --- a/src/examples/IfcAdvancedHouse.cpp +++ b/src/examples/IfcAdvancedHouse.cpp @@ -60,7 +60,7 @@ int main() { // The IfcHierarchyHelper is a subclass of the regular IfcFile that provides several // convenience functions for working with geometry in IFC files. IfcHierarchyHelper file; - file.header().file_name().name("IfcAdvancedHouse.ifc"); + file.header().file_name()->setname("IfcAdvancedHouse.ifc"); IfcSchema::IfcBuilding* building = file.addBuilding(); // By adding a building, a hierarchy has been automatically created that consists of the following diff --git a/src/examples/IfcOpenHouse.cpp b/src/examples/IfcOpenHouse.cpp index 3f6d56236d..accac737fb 100644 --- a/src/examples/IfcOpenHouse.cpp +++ b/src/examples/IfcOpenHouse.cpp @@ -62,7 +62,7 @@ int main() { // The IfcHierarchyHelper is a subclass of the regular IfcFile that provides several // convenience functions for working with geometry in IFC files. IfcHierarchyHelper file; - file.header().file_name().name("IfcOpenHouse.ifc"); + file.header().file_name()->setname("IfcOpenHouse.ifc"); // Start by adding a wall to the file, initially leaving most attributes blank. IfcSchema::IfcWallStandardCase* south_wall = new IfcSchema::IfcWallStandardCase( diff --git a/src/examples/IfcParseExamples.cpp b/src/examples/IfcParseExamples.cpp index 961c4749db..dcd3654d83 100644 --- a/src/examples/IfcParseExamples.cpp +++ b/src/examples/IfcParseExamples.cpp @@ -137,7 +137,7 @@ void process_pset(element_properties& props, const T* inst) { if (!singleval->NominalValue()) { propvalue = "-"; } else { - props[*pset->Name()][propname] = format_string(singleval->NominalValue()->template as()->data().get_attribute_value(0)); + props[*pset->Name()][propname] = format_string(singleval->NominalValue()->template as()->get_attribute_value(0)); } } } @@ -149,8 +149,8 @@ void process_pset(element_properties& props, const T* inst) { auto qs = qset->Quantities(); for (auto it = qs->begin(); it != qs->end(); ++it) { auto& q = *it; - if (q->template as() && q->data().get_attribute_value(3).type() == IfcUtil::Argument_DOUBLE) { - double v = q->data().get_attribute_value(3); + if (q->template as() && q->get_attribute_value(3).type() == IfcUtil::Argument_DOUBLE) { + double v = q->get_attribute_value(3); props[*qset->Name()][q->Name()] = std::to_string(v); } } diff --git a/src/ifcparse/IfcHierarchyHelper.cpp b/src/ifcparse/IfcHierarchyHelper.cpp index 377131b71c..ff42b120f2 100644 --- a/src/ifcparse/IfcHierarchyHelper.cpp +++ b/src/ifcparse/IfcHierarchyHelper.cpp @@ -915,6 +915,28 @@ void setSurfaceColour(IfcHierarchyHelper& file, Ifc4x3_add1::IfcRep } #endif +#ifdef HAS_SCHEMA_4x3_add2 +Ifc4x3_add2::IfcPresentationStyle* addStyleAssignment(IfcHierarchyHelper& file, double r, double g, double b, double a) { + return addStyleAssignment_4x3(file, r, g, b, a); +} + +Ifc4x3_add2::IfcPresentationStyle* setSurfaceColour(IfcHierarchyHelper& file, Ifc4x3_add2::IfcProductRepresentation* shape, double r, double g, double b, double a) { + return setSurfaceColour_4x3(file, shape, r, g, b, a); +} + +Ifc4x3_add2::IfcPresentationStyle* setSurfaceColour(IfcHierarchyHelper& file, Ifc4x3_add2::IfcRepresentation* shape, double r, double g, double b, double a) { + return setSurfaceColour_4x3(file, shape, r, g, b, a); +} + +void setSurfaceColour(IfcHierarchyHelper& file, Ifc4x3_add2::IfcProductRepresentation* shape, Ifc4x3_add2::IfcPresentationStyle* style) { + setSurfaceColour_4x3(file, shape, style); +} + +void setSurfaceColour(IfcHierarchyHelper& file, Ifc4x3_add2::IfcRepresentation* shape, Ifc4x3_add2::IfcPresentationStyle* style) { + setSurfaceColour_4x3(file, shape, style); +} +#endif + template typename Schema::IfcProductDefinitionShape* IfcHierarchyHelper::addMappedItem( typename Schema::IfcShapeRepresentation* rep, diff --git a/src/ifcparse/IfcHierarchyHelper.h b/src/ifcparse/IfcHierarchyHelper.h index 65b35717d2..019cbf69c1 100644 --- a/src/ifcparse/IfcHierarchyHelper.h +++ b/src/ifcparse/IfcHierarchyHelper.h @@ -623,4 +623,12 @@ IFC_PARSE_API void setSurfaceColour(IfcHierarchyHelper& file, Ifc4x IFC_PARSE_API void setSurfaceColour(IfcHierarchyHelper& file, Ifc4x3_add1::IfcRepresentation* shape, Ifc4x3_add1::IfcPresentationStyle* style); #endif +#ifdef HAS_SCHEMA_4x3_add2 +IFC_PARSE_API Ifc4x3_add2::IfcPresentationStyle* addStyleAssignment(IfcHierarchyHelper& file, double r, double g, double b, double a = 1.0); +IFC_PARSE_API Ifc4x3_add2::IfcPresentationStyle* setSurfaceColour(IfcHierarchyHelper& file, Ifc4x3_add2::IfcProductRepresentation* shape, double r, double g, double b, double a = 1.0); +IFC_PARSE_API Ifc4x3_add2::IfcPresentationStyle* setSurfaceColour(IfcHierarchyHelper& file, Ifc4x3_add2::IfcRepresentation* shape, double r, double g, double b, double a = 1.0); +IFC_PARSE_API void setSurfaceColour(IfcHierarchyHelper& file, Ifc4x3_add2::IfcProductRepresentation* shape, Ifc4x3_add2::IfcPresentationStyle* style); +IFC_PARSE_API void setSurfaceColour(IfcHierarchyHelper& file, Ifc4x3_add2::IfcRepresentation* shape, Ifc4x3_add2::IfcPresentationStyle* style); +#endif + #endif