Update examples

This commit is contained in:
Thomas Krijnen
2025-08-27 10:21:45 +02:00
parent 0cd5c673c3
commit 5a06715843
5 changed files with 35 additions and 5 deletions
+1 -1
View File
@@ -60,7 +60,7 @@ int main() {
// The IfcHierarchyHelper is a subclass of the regular IfcFile that provides several // The IfcHierarchyHelper is a subclass of the regular IfcFile that provides several
// convenience functions for working with geometry in IFC files. // convenience functions for working with geometry in IFC files.
IfcHierarchyHelper<IfcSchema> file; IfcHierarchyHelper<IfcSchema> file;
file.header().file_name().name("IfcAdvancedHouse.ifc"); file.header().file_name()->setname("IfcAdvancedHouse.ifc");
IfcSchema::IfcBuilding* building = file.addBuilding(); IfcSchema::IfcBuilding* building = file.addBuilding();
// By adding a building, a hierarchy has been automatically created that consists of the following // By adding a building, a hierarchy has been automatically created that consists of the following
+1 -1
View File
@@ -62,7 +62,7 @@ int main() {
// The IfcHierarchyHelper is a subclass of the regular IfcFile that provides several // The IfcHierarchyHelper is a subclass of the regular IfcFile that provides several
// convenience functions for working with geometry in IFC files. // convenience functions for working with geometry in IFC files.
IfcHierarchyHelper<IfcSchema> file; IfcHierarchyHelper<IfcSchema> 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. // Start by adding a wall to the file, initially leaving most attributes blank.
IfcSchema::IfcWallStandardCase* south_wall = new IfcSchema::IfcWallStandardCase( IfcSchema::IfcWallStandardCase* south_wall = new IfcSchema::IfcWallStandardCase(
+3 -3
View File
@@ -137,7 +137,7 @@ void process_pset(element_properties& props, const T* inst) {
if (!singleval->NominalValue()) { if (!singleval->NominalValue()) {
propvalue = "-"; propvalue = "-";
} else { } else {
props[*pset->Name()][propname] = format_string(singleval->NominalValue()->template as<IfcUtil::IfcBaseClass>()->data().get_attribute_value(0)); props[*pset->Name()][propname] = format_string(singleval->NominalValue()->template as<IfcUtil::IfcBaseClass>()->get_attribute_value(0));
} }
} }
} }
@@ -149,8 +149,8 @@ void process_pset(element_properties& props, const T* inst) {
auto qs = qset->Quantities(); auto qs = qset->Quantities();
for (auto it = qs->begin(); it != qs->end(); ++it) { for (auto it = qs->begin(); it != qs->end(); ++it) {
auto& q = *it; auto& q = *it;
if (q->template as<typename Schema::IfcPhysicalSimpleQuantity>() && q->data().get_attribute_value(3).type() == IfcUtil::Argument_DOUBLE) { if (q->template as<typename Schema::IfcPhysicalSimpleQuantity>() && q->get_attribute_value(3).type() == IfcUtil::Argument_DOUBLE) {
double v = q->data().get_attribute_value(3); double v = q->get_attribute_value(3);
props[*qset->Name()][q->Name()] = std::to_string(v); props[*qset->Name()][q->Name()] = std::to_string(v);
} }
} }
+22
View File
@@ -915,6 +915,28 @@ void setSurfaceColour(IfcHierarchyHelper<Ifc4x3_add1>& file, Ifc4x3_add1::IfcRep
} }
#endif #endif
#ifdef HAS_SCHEMA_4x3_add2
Ifc4x3_add2::IfcPresentationStyle* addStyleAssignment(IfcHierarchyHelper<Ifc4x3_add2>& file, double r, double g, double b, double a) {
return addStyleAssignment_4x3(file, r, g, b, a);
}
Ifc4x3_add2::IfcPresentationStyle* setSurfaceColour(IfcHierarchyHelper<Ifc4x3_add2>& 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<Ifc4x3_add2>& 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<Ifc4x3_add2>& file, Ifc4x3_add2::IfcProductRepresentation* shape, Ifc4x3_add2::IfcPresentationStyle* style) {
setSurfaceColour_4x3(file, shape, style);
}
void setSurfaceColour(IfcHierarchyHelper<Ifc4x3_add2>& file, Ifc4x3_add2::IfcRepresentation* shape, Ifc4x3_add2::IfcPresentationStyle* style) {
setSurfaceColour_4x3(file, shape, style);
}
#endif
template <typename Schema> template <typename Schema>
typename Schema::IfcProductDefinitionShape* IfcHierarchyHelper<Schema>::addMappedItem( typename Schema::IfcProductDefinitionShape* IfcHierarchyHelper<Schema>::addMappedItem(
typename Schema::IfcShapeRepresentation* rep, typename Schema::IfcShapeRepresentation* rep,
+8
View File
@@ -623,4 +623,12 @@ IFC_PARSE_API void setSurfaceColour(IfcHierarchyHelper<Ifc4x3_add1>& file, Ifc4x
IFC_PARSE_API void setSurfaceColour(IfcHierarchyHelper<Ifc4x3_add1>& file, Ifc4x3_add1::IfcRepresentation* shape, Ifc4x3_add1::IfcPresentationStyle* style); IFC_PARSE_API void setSurfaceColour(IfcHierarchyHelper<Ifc4x3_add1>& file, Ifc4x3_add1::IfcRepresentation* shape, Ifc4x3_add1::IfcPresentationStyle* style);
#endif #endif
#ifdef HAS_SCHEMA_4x3_add2
IFC_PARSE_API Ifc4x3_add2::IfcPresentationStyle* addStyleAssignment(IfcHierarchyHelper<Ifc4x3_add2>& file, double r, double g, double b, double a = 1.0);
IFC_PARSE_API Ifc4x3_add2::IfcPresentationStyle* setSurfaceColour(IfcHierarchyHelper<Ifc4x3_add2>& file, Ifc4x3_add2::IfcProductRepresentation* shape, double r, double g, double b, double a = 1.0);
IFC_PARSE_API Ifc4x3_add2::IfcPresentationStyle* setSurfaceColour(IfcHierarchyHelper<Ifc4x3_add2>& file, Ifc4x3_add2::IfcRepresentation* shape, double r, double g, double b, double a = 1.0);
IFC_PARSE_API void setSurfaceColour(IfcHierarchyHelper<Ifc4x3_add2>& file, Ifc4x3_add2::IfcProductRepresentation* shape, Ifc4x3_add2::IfcPresentationStyle* style);
IFC_PARSE_API void setSurfaceColour(IfcHierarchyHelper<Ifc4x3_add2>& file, Ifc4x3_add2::IfcRepresentation* shape, Ifc4x3_add2::IfcPresentationStyle* style);
#endif
#endif #endif