diff --git a/src/examples/CMakeLists.txt b/src/examples/CMakeLists.txt index a7c99043bd..a7a797b6f4 100644 --- a/src/examples/CMakeLists.txt +++ b/src/examples/CMakeLists.txt @@ -36,7 +36,17 @@ else() endif() macro(build_example exe_name) + set(_target_schema "") set(additional_targets ${ARGN}) + list(LENGTH additional_targets _argc) + if(_argc GREATER 0) + list(GET additional_targets 0 _first_arg) + if("${_first_arg}" IN_LIST SCHEMA_VERSIONS) + set(_target_schema ${_first_arg}) + list(REMOVE_AT additional_targets 0) + endif() + endif() + add_executable(${exe_name} ${exe_name}.cpp) if(STANDALONE_PROJECT) @@ -50,27 +60,38 @@ macro(build_example exe_name) target_link_libraries(${exe_name} IfcParse ${additional_targets}) set_target_properties(${exe_name} PROPERTIES FOLDER Examples) endif() + + if(_target_schema) + set_target_properties( + ${exe_name} + PROPERTIES COMPILE_FLAGS "-DIfcSchema=Ifc${_target_schema}" + ) + endif() + + unset(_target_schema) + unset(_argc) + unset(_first_arg) install(TARGETS ${exe_name}) endmacro() -if("4" IN_LIST SCHEMA_VERSIONS) - build_example(arbitrary_open_profile_def) - build_example(triangulated_faceset) +if(SCHEMA_VERSIONS) + list(GET SCHEMA_VERSIONS -1 schema) endif() -if("2x3" IN_LIST SCHEMA_VERSIONS) - build_example(composite_profile_def) - build_example(csg_primitive) - build_example(ellipse_pies) - build_example(faces) - build_example(ifc_curve_rebar) - build_example(profiles) - build_example(IfcParseExamples) +build_example(arbitrary_open_profile_def ${schema}) +build_example(triangulated_faceset ${schema}) - if(WITH_OPENCASCADE) - build_example(IfcOpenHouse geometry_serializer) - build_example(IfcAdvancedHouse geometry_serializer) - endif() +build_example(composite_profile_def ${schema}) +build_example(csg_primitive ${schema}) +build_example(ellipse_pies ${schema}) +build_example(faces ${schema}) +build_example(ifc_curve_rebar ${schema}) +build_example(profiles ${schema}) +build_example(IfcParseExamples ${schema}) + +if(WITH_OPENCASCADE) + build_example(IfcOpenHouse ${schema} geometry_serializer) + build_example(IfcAdvancedHouse ${schema} geometry_serializer) endif() if("4x3_add2" IN_LIST SCHEMA_VERSIONS) diff --git a/src/examples/IfcAdvancedHouse.cpp b/src/examples/IfcAdvancedHouse.cpp index 9b680bd79b..83909ce4c6 100644 --- a/src/examples/IfcAdvancedHouse.cpp +++ b/src/examples/IfcAdvancedHouse.cpp @@ -38,9 +38,15 @@ #include -#define IfcSchema Ifc2x3 #include "ifcparse/macros.h" -#include "ifcparse/Ifc2x3.h" + +#ifndef IfcSchema +#define IfcSchema Ifc2x3 +#endif + +#include INCLUDE_SCHEMA(ifcparse, IfcSchema) +#include INCLUDE_SCHEMA_DEFINITIONS(ifcparse, IfcSchema) + #include "ifcparse/IfcBaseClass.h" #include "ifcparse/IfcHierarchyHelper.h" diff --git a/src/examples/IfcOpenHouse.cpp b/src/examples/IfcOpenHouse.cpp index 24654adca7..944f6f3eae 100644 --- a/src/examples/IfcOpenHouse.cpp +++ b/src/examples/IfcOpenHouse.cpp @@ -35,9 +35,15 @@ #include -#define IfcSchema Ifc2x3 #include "ifcparse/macros.h" -#include "ifcparse/Ifc2x3.h" + +#ifndef IfcSchema +#define IfcSchema Ifc2x3 +#endif + +#include INCLUDE_SCHEMA(ifcparse, IfcSchema) +#include INCLUDE_SCHEMA_DEFINITIONS(ifcparse, IfcSchema) + #include "ifcparse/IfcBaseClass.h" #include "ifcparse/IfcHierarchyHelper.h" @@ -52,6 +58,11 @@ using namespace std::string_literals; // Some convenience typedefs and definitions. typedef IfcParse::IfcGlobalId guid; typedef std::pair XY; +#ifdef SCHEMA_HAS_IfcPresentationStyleAssignment +typedef IfcSchema::IfcPresentationStyleAssignment surface_style_t; +#else +typedef IfcSchema::IfcPresentationStyle surface_style_t; +#endif boost::none_t const null = boost::none; // The creation of Nurbs-surface for the IfcSite mesh, to be implemented lateron @@ -74,7 +85,7 @@ int main() { 0, // ObjectPlacement 0, // Representation null // Tag -#ifdef USE_IFC4 +#ifdef SCHEMA_IfcWall_HAS_PredefinedType , IfcSchema::IfcWallTypeEnum::IfcWallType_STANDARD #endif ); @@ -105,7 +116,7 @@ int main() { south_wall->setObjectPlacement(file.addLocalPlacement(storey_placement)); // A pale white colour is assigned to the wall. - IfcSchema::IfcPresentationStyleAssignment* wall_colour = setSurfaceColour(file, south_wall_shape, 0.75, 0.73, 0.68); + surface_style_t* wall_colour = setSurfaceColour(file, south_wall_shape, 0.75, 0.73, 0.68); // Now create a footing for the wall to rest on. IfcSchema::IfcFooting* footing = new IfcSchema::IfcFooting(guid(), file.getSingle(), @@ -119,7 +130,7 @@ int main() { footing->setRepresentation(file.addBox(10100, 5460, 2000)); footing->setObjectPlacement(file.addLocalPlacement(storey_placement, 0, 2500, -2000)); // The footing will have a dark gray colour - IfcSchema::IfcPresentationStyleAssignment* footing_colour = setSurfaceColour(file,footing->Representation(), 0.26, 0.22, 0.18); + surface_style_t* footing_colour = setSurfaceColour(file,footing->Representation(), 0.26, 0.22, 0.18); // IFC has two ways to apply boolean operations to geometry. IfcBooleanResults are commonly used // to clip geometry to a surface, for example to a slanted roof. For openings that are filled @@ -129,7 +140,7 @@ int main() { IfcSchema::IfcOpeningElement* west_opening = new IfcSchema::IfcOpeningElement(guid(), file.getSingle(), null, null, null, file.addLocalPlacement(south_wall->ObjectPlacement(), -2500, 0, 400), file.addBox(6000, 3630, 1600), null -#ifdef USE_IFC4 +#ifdef SCHEMA_IfcOpeningElement_HAS_PredefinedType , IfcSchema::IfcOpeningElementTypeEnum::IfcOpeningElementType_OPENING #endif ); @@ -144,7 +155,7 @@ int main() { IfcSchema::IfcOpeningElement* south_opening = new IfcSchema::IfcOpeningElement(guid(), file.getSingle(), null, null, null, file.addLocalPlacement(storey_placement, 3000, 0, 400), file.addBox(1860, 3000, 1600), null -#ifdef USE_IFC4 +#ifdef SCHEMA_IfcOpeningElement_HAS_PredefinedType , IfcSchema::IfcOpeningElementTypeEnum::IfcOpeningElementType_OPENING #endif ); @@ -194,7 +205,7 @@ int main() { // Copy the south wall to the north IfcSchema::IfcWallStandardCase* north_wall = new IfcSchema::IfcWallStandardCase(guid(), file.getSingle(), "North wall"s, null, null, file.addLocalPlacement(storey_placement, 0, 5000, 0), file.addAxisBox(10000, 360, 3000), null -#ifdef USE_IFC4 +#ifdef SCHEMA_IfcWall_HAS_PredefinedType , IfcSchema::IfcWallTypeEnum::IfcWallType_STANDARD #endif ); @@ -226,7 +237,7 @@ int main() { // 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(), "East wall"s, 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 SCHEMA_IfcWall_HAS_PredefinedType , IfcSchema::IfcWallTypeEnum::IfcWallType_STANDARD #endif ); @@ -235,7 +246,7 @@ int main() { // The east wall is copied to the west location of the house IfcSchema::IfcWallStandardCase* west_wall = new IfcSchema::IfcWallStandardCase(guid(), file.getSingle(), "West wall"s, 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 SCHEMA_IfcWall_HAS_PredefinedType , IfcSchema::IfcWallTypeEnum::IfcWallType_STANDARD #endif ); @@ -252,7 +263,7 @@ int main() { IfcSchema::IfcOpeningElement* west_opening_copy = new IfcSchema::IfcOpeningElement(guid(), file.getSingle(), null, null, null, file.addLocalPlacement(west_wall->ObjectPlacement(), 2500, -2500+4820, 400, 0, 0, 1, 0, 1, 0), file.addBox(6000, 3630, 1600), null -#ifdef USE_IFC4 +#ifdef SCHEMA_IfcOpeningElement_HAS_PredefinedType , IfcSchema::IfcOpeningElementTypeEnum::IfcOpeningElementType_OPENING #endif ); @@ -274,7 +285,7 @@ int main() { IfcSchema::IfcProperty::list::ptr properties(new IfcSchema::IfcProperty::list); properties->push(new IfcSchema::IfcPropertySingleValue("TotalArea", null, new IfcSchema::IfcAreaMeasure(site_area), 0)); IfcSchema::IfcPropertySet* pset = new IfcSchema::IfcPropertySet(guid(), file.getSingle(), "Pset_SiteCommon"s, null, properties); -#ifdef USE_IFC4 +#ifdef SCHEMA_HAS_IfcDefinitionSelect IfcSchema::IfcObjectDefinition::list::ptr related_objs(new IfcSchema::IfcObjectDefinition::list); #else IfcSchema::IfcObject::list::ptr related_objs(new IfcSchema::IfcObject::list); @@ -297,7 +308,7 @@ int main() { // Some BIM authoring applications, such as Autodesk Revit, ignore the geometrical representation // by and large and construct native walls using the layer thickness and reference line offset // provided here. -#ifdef USE_IFC4 +#ifdef SCHEMA_IfcMaterial_HAS_Description IfcSchema::IfcMaterial* material = new IfcSchema::IfcMaterial("Brick", null, null); #else IfcSchema::IfcMaterial* material = new IfcSchema::IfcMaterial("Brick"); @@ -306,7 +317,7 @@ int main() { material, 360, null -#ifdef USE_IFC4 +#ifdef SCHEMA_IfcMaterialLayer_HAS_Name , null , null , null @@ -318,7 +329,7 @@ int main() { IfcSchema::IfcMaterialLayerSet* layer_set = new IfcSchema::IfcMaterialLayerSet( layers, "Wall"s -#ifdef USE_IFC4 +#ifdef SCHEMA_IfcMaterialLayerSet_HAS_Description , null #endif ); @@ -327,7 +338,7 @@ int main() { IfcSchema::IfcLayerSetDirectionEnum::IfcLayerSetDirection_AXIS2, IfcSchema::IfcDirectionSenseEnum::IfcDirectionSense_POSITIVE, -180 -#ifdef USE_IFC4 +#ifdef SCHEMA_IfcMaterialLayerSetUsage_HAS_ReferenceExtent , null #endif ); @@ -337,7 +348,7 @@ int main() { file.getSingle(), null, null, -#ifdef USE_IFC4 +#ifdef SCHEMA_HAS_IfcDefinitionSelect file.instances_by_type()->as(), #else file.instances_by_type()->as(), @@ -362,7 +373,7 @@ int main() { IfcSchema::IfcStairFlight* stair = new IfcSchema::IfcStairFlight(guid(), file.getSingle(), null, null, null, file.addLocalPlacement(storey_placement, 5050, 1000, 0, 0, 1, 0, 1, 0, 0), file.addExtrudedPolyline(stair_points, 1200), null, 2, 2, 0.2, 0.25 -#ifdef USE_IFC4 +#ifdef SCHEMA_IfcStairFlight_HAS_PredefinedType , IfcSchema::IfcStairFlightTypeEnum::IfcStairFlightType_STRAIGHT #endif ); @@ -372,7 +383,7 @@ int main() { IfcSchema::IfcOpeningElement* door_opening = new IfcSchema::IfcOpeningElement(guid(), file.getSingle(), null, null, null, file.addLocalPlacement(storey_placement, 5000-180, 2500-900, 0), file.addBox(1000, 1000, 2200), null -#ifdef USE_IFC4 +#ifdef SCHEMA_IfcOpeningElement_HAS_PredefinedType , IfcSchema::IfcOpeningElementTypeEnum::IfcOpeningElementType_OPENING #endif ); @@ -384,7 +395,7 @@ int main() { // which constitute the door and its frame. IfcSchema::IfcDoor* door = new IfcSchema::IfcDoor(guid(), file.getSingle(), null, null, null, file.addLocalPlacement(storey_placement, 4800, 1600, 0, 0, 0, 1, 0, 1, 0), 0, null, 2200, 1000 -#ifdef USE_IFC4 +#ifdef SCHEMA_IfcDoor_HAS_PredefinedType , IfcSchema::IfcDoorTypeEnum::IfcDoorType_DOOR , IfcSchema::IfcDoorTypeOperationEnum::IfcDoorTypeOperation_SINGLE_SWING_LEFT , null @@ -406,11 +417,15 @@ int main() { setSurfaceColour(file, door->Representation(), 0.9, 0.9, 0.9); file.addEntity(new IfcSchema::IfcRelFillsElement(guid(), file.getSingle(), null, null, door_opening, door)); +#ifdef SCHEMA_HAS_IfcDoorType + IfcSchema::IfcDoorType* door_type = new IfcSchema::IfcDoorType(guid(), file.getSingle(), "Door type"s, null, null, null, null, null, null, + IfcSchema::IfcDoorTypeEnum::IfcDoorType_DOOR, IfcSchema::IfcDoorTypeOperationEnum::IfcDoorTypeOperation_SINGLE_SWING_LEFT, false, null); + file.addRelatedObject(door_type, door); +#elif defined(SCHEMA_HAS_IfcDoorStyle) IfcSchema::IfcDoorStyle* door_style = new IfcSchema::IfcDoorStyle(guid(), file.getSingle(), "Door type"s, null, null, null, null, null, IfcSchema::IfcDoorStyleOperationEnum::IfcDoorStyleOperation_SINGLE_SWING_LEFT, IfcSchema::IfcDoorStyleConstructionEnum::IfcDoorStyleConstruction_WOOD, false, false); - // NOTE: typing by IfcDoorStyle will cause validation errors in IFC4+ but it's allowed for backwards compatibility - // better to use IfcDoorType in the actual use case file.addRelatedObject(door_style, door); +#endif // Surface styles are assigned to representation items, hence there is no real limitation to // assign different colours within the same representation. However, some viewers have @@ -436,7 +451,7 @@ int main() { frame_representations->push(vertical_bar); // Add another reference to the vertical bar created above // The beams all have the same surface style assigned - IfcSchema::IfcPresentationStyleAssignment* frame_style = 0; + surface_style_t* frame_style = 0; for (IfcSchema::IfcShapeRepresentation::list::it i = frame_representations->begin(); i != frame_representations->end(); i += 2) { if (frame_style) { setSurfaceColour(file,*i, frame_style); @@ -461,7 +476,7 @@ int main() { IfcSchema::IfcLocalPlacement* place = *it; IfcSchema::IfcWindow* window = new IfcSchema::IfcWindow(guid(), file.getSingle(), null, null, null, place, 0, null, 1600, 1860 -#ifdef USE_IFC4 +#ifdef SCHEMA_IfcWindow_HAS_PredefinedType , IfcSchema::IfcWindowTypeEnum::IfcWindowType_WINDOW , IfcSchema::IfcWindowTypePartitioningEnum::IfcWindowTypePartitioning_SINGLE_PANEL , null @@ -489,7 +504,7 @@ int main() { { IfcSchema::IfcMember* frame_part = new IfcSchema::IfcMember(guid(), file.getSingle(), null, null, null, *frame_placement, file.addMappedItem(*frame_representation), null -#ifdef USE_IFC4 +#ifdef SCHEMA_IfcMember_HAS_PredefinedType , IfcSchema::IfcMemberTypeEnum::IfcMemberType_MULLION #endif ); @@ -501,7 +516,7 @@ int main() { // Add the glass plate to the list of parts IfcSchema::IfcPlate* glass_part = new IfcSchema::IfcPlate(guid(), file.getSingle(), null, null, null, file.addLocalPlacement(storey_placement, 930, 45, 90), file.addBox(1680, 10, 1420), null -#ifdef USE_IFC4 +#ifdef SCHEMA_IfcPlate_HAS_PredefinedType , IfcSchema::IfcPlateTypeEnum::IfcPlateType_SHEET #endif ); diff --git a/src/examples/IfcParseExamples.cpp b/src/examples/IfcParseExamples.cpp index cf29151116..8af17f7717 100644 --- a/src/examples/IfcParseExamples.cpp +++ b/src/examples/IfcParseExamples.cpp @@ -17,12 +17,16 @@ * * ********************************************************************************/ -// TODO: Multiple schemas +#include "ifcparse/macros.h" + +#ifndef IfcSchema #define IfcSchema Ifc2x3 +#endif #include "ifcparse/IfcFile.h" #include "ifcparse/IfcLogger.h" -#include "ifcparse/Ifc2x3.h" +#include INCLUDE_SCHEMA(ifcparse, IfcSchema) +#include INCLUDE_SCHEMA_DEFINITIONS(ifcparse, IfcSchema) #include #include @@ -39,33 +43,6 @@ static_assert(false, "A boost preprocessor sequence of schema identifiers is needed for this file to compile."); #endif -// @todo duplicated with Kernel.h - -// @tfk A macro cannot define an include (I think), so here we can't -// loop over the sequence of schema identifiers, but rather we have -// unroll the loop with at least the amount of schemas we'd like support -// for and then overflow into an existing empty include file. - -#define INCLUDE_SCHEMA(n) \ - BOOST_PP_IIF(BOOST_PP_GREATER(BOOST_PP_SEQ_SIZE(SCHEMA_SEQ), n), BOOST_PP_STRINGIZE(../ifcparse/BOOST_PP_CAT(Ifc,BOOST_PP_SEQ_ELEM(BOOST_PP_MIN(n, BOOST_PP_SEQ_SIZE(BOOST_PP_SEQ_POP_BACK(SCHEMA_SEQ))),SCHEMA_SEQ)).h), "../ifcgeom/empty.h") - -#include INCLUDE_SCHEMA(0) -#include INCLUDE_SCHEMA(1) -#include INCLUDE_SCHEMA(2) -#include INCLUDE_SCHEMA(3) -#include INCLUDE_SCHEMA(4) -#include INCLUDE_SCHEMA(5) -#include INCLUDE_SCHEMA(6) -#include INCLUDE_SCHEMA(7) -#include INCLUDE_SCHEMA(8) -#include INCLUDE_SCHEMA(9) -#include INCLUDE_SCHEMA(10) -#include INCLUDE_SCHEMA(11) -#include INCLUDE_SCHEMA(12) -#include INCLUDE_SCHEMA(13) -#include INCLUDE_SCHEMA(14) -#include INCLUDE_SCHEMA(15) - #include #if USE_VLD @@ -80,6 +57,12 @@ struct is_ifc4_or_higher> : s typedef std::map> element_properties; +#ifdef SCHEMA_HAS_IfcBuildingElement +typedef IfcSchema::IfcBuildingElement element_t +#else +typedef IfcSchema::IfcBuiltElement element_t +#endif + std::string format_string(const AttributeValue& argument) { // Argument is a runtime tagged variant for the various data types in a IFC model, // in this particular case we only care about flattening it to a string. @@ -259,7 +242,7 @@ int main(int argc, char** argv) { // we need to cast them to IfcWindows. Since these properties // are optional we need to make sure the properties are // defined for the window in question before accessing them. - IfcSchema::IfcBuildingElement::list::ptr elements = file.instances_by_type(); + example_element_type::list::ptr elements = file.instances_by_type(); std::cout << "Found " << elements->size() << " elements in " << argv[1] << ":" << std::endl; diff --git a/src/examples/arbitrary_open_profile_def.cpp b/src/examples/arbitrary_open_profile_def.cpp index 1346c56a5d..c79a1cf2e4 100644 --- a/src/examples/arbitrary_open_profile_def.cpp +++ b/src/examples/arbitrary_open_profile_def.cpp @@ -28,8 +28,15 @@ #include #include +#include "ifcparse/macros.h" + +#ifndef IfcSchema #define IfcSchema Ifc4 -#include "ifcparse/Ifc4.h" +#endif + +#include INCLUDE_SCHEMA(ifcparse, IfcSchema) +#include INCLUDE_SCHEMA_DEFINITIONS(ifcparse, IfcSchema) + #include "ifcparse/IfcHierarchyHelper.h" typedef std::string S; @@ -138,4 +145,4 @@ int main(int argc, char** argv) { std::ofstream f(filename); f << file; -} \ No newline at end of file +} diff --git a/src/examples/composite_profile_def.cpp b/src/examples/composite_profile_def.cpp index 2b5f082f55..98b5c52c00 100644 --- a/src/examples/composite_profile_def.cpp +++ b/src/examples/composite_profile_def.cpp @@ -27,14 +27,45 @@ #include #include +#include "ifcparse/macros.h" + +#ifndef IfcSchema #define IfcSchema Ifc2x3 -#include "ifcparse/Ifc2x3.h" +#endif + +#include INCLUDE_SCHEMA(ifcparse, IfcSchema) +#include INCLUDE_SCHEMA_DEFINITIONS(ifcparse, IfcSchema) + #include "ifcparse/IfcHierarchyHelper.h" typedef std::string S; typedef IfcParse::IfcGlobalId guid; boost::none_t const null = boost::none; +#ifdef SCHEMA_IfcIShapeProfileDef_HAS_FlangeEdgeRadius +#define IFC_I_SHAPE_PROFILE_DEF_EXTRA_ARGS , null, null +#else +#define IFC_I_SHAPE_PROFILE_DEF_EXTRA_ARGS +#endif + +#ifdef SCHEMA_IfcLShapeProfileDef_HAS_CentreOfGravityInX +#define IFC_L_SHAPE_PROFILE_DEF_EXTRA_ARGS , null, null +#else +#define IFC_L_SHAPE_PROFILE_DEF_EXTRA_ARGS +#endif + +#ifdef SCHEMA_IfcTShapeProfileDef_HAS_CentreOfGravityInY +#define IFC_T_SHAPE_PROFILE_DEF_EXTRA_ARGS , null +#else +#define IFC_T_SHAPE_PROFILE_DEF_EXTRA_ARGS +#endif + +#ifdef SCHEMA_IfcCShapeProfileDef_HAS_CentreOfGravityInX +#define IFC_C_SHAPE_PROFILE_DEF_EXTRA_ARGS , null +#else +#define IFC_C_SHAPE_PROFILE_DEF_EXTRA_ARGS +#endif + int main(int argc, char** argv) { const char filename[] = "composite_profile_def.ifc"; IfcHierarchyHelper file; @@ -49,21 +80,21 @@ int main(int argc, char** argv) { IfcSchema::IfcCartesianTransformationOperator2D* transform1 = new IfcSchema::IfcCartesianTransformationOperator2D(file.addDoublet(1, 0), file.addDoublet(0, -1), file.addDoublet(40, 0), null); IfcSchema::IfcCartesianTransformationOperator2D* transform2 = new IfcSchema::IfcCartesianTransformationOperator2D(file.addDoublet(0, -1), file.addDoublet(1, 0), file.addDoublet(40, 0), 0.3); - IfcSchema::IfcProfileDef* p1 = new Ifc2x3::IfcIShapeProfileDef( + IfcSchema::IfcProfileDef* p1 = new IfcSchema::IfcIShapeProfileDef( IfcSchema::IfcProfileTypeEnum::IfcProfileType_AREA, - null, file.addPlacement2d(), 25.0, 50.0, 5.0, 5.0, 2.0); + null, file.addPlacement2d(), 25.0, 50.0, 5.0, 5.0, 2.0 IFC_I_SHAPE_PROFILE_DEF_EXTRA_ARGS); - IfcSchema::IfcProfileDef* p2 = new Ifc2x3::IfcLShapeProfileDef( + IfcSchema::IfcProfileDef* p2 = new IfcSchema::IfcLShapeProfileDef( IfcSchema::IfcProfileTypeEnum::IfcProfileType_AREA, - null, file.addPlacement2d(), 50.0, 25.0, 5.0, 1.0, 2.0, 2.0, null, null); + null, file.addPlacement2d(), 50.0, 25.0, 5.0, 1.0, 2.0, 2.0 IFC_L_SHAPE_PROFILE_DEF_EXTRA_ARGS); - IfcSchema::IfcProfileDef* p3 = new Ifc2x3::IfcTShapeProfileDef( + IfcSchema::IfcProfileDef* p3 = new IfcSchema::IfcTShapeProfileDef( IfcSchema::IfcProfileTypeEnum::IfcProfileType_AREA, - null, file.addPlacement2d(), 50.0, 40.0, 10.0, 10.0, 3.0, 2.0, 1.0, 2.0, 2.0, null); + null, file.addPlacement2d(), 50.0, 40.0, 10.0, 10.0, 3.0, 2.0, 1.0, 2.0, 2.0 IFC_T_SHAPE_PROFILE_DEF_EXTRA_ARGS); - IfcSchema::IfcProfileDef* p4 = new Ifc2x3::IfcCShapeProfileDef( + IfcSchema::IfcProfileDef* p4 = new IfcSchema::IfcCShapeProfileDef( IfcSchema::IfcProfileTypeEnum::IfcProfileType_AREA, - null, file.addPlacement2d(80.), 50.0, 25.0, 5.0, 10.0, 2.0, null); + null, file.addPlacement2d(80.), 50.0, 25.0, 5.0, 10.0, 2.0 IFC_C_SHAPE_PROFILE_DEF_EXTRA_ARGS); file.addEntity(p2); file.addEntity(p3); diff --git a/src/examples/csg_primitive.cpp b/src/examples/csg_primitive.cpp index 4d805a3375..238f911741 100644 --- a/src/examples/csg_primitive.cpp +++ b/src/examples/csg_primitive.cpp @@ -27,8 +27,15 @@ #include #include +#include "ifcparse/macros.h" + +#ifndef IfcSchema #define IfcSchema Ifc2x3 -#include "ifcparse/Ifc2x3.h" +#endif + +#include INCLUDE_SCHEMA(ifcparse, IfcSchema) +#include INCLUDE_SCHEMA_DEFINITIONS(ifcparse, IfcSchema) + #include "ifcparse/IfcHierarchyHelper.h" typedef std::string S; diff --git a/src/examples/ellipse_pies.cpp b/src/examples/ellipse_pies.cpp index 8128c4377c..fec702b405 100644 --- a/src/examples/ellipse_pies.cpp +++ b/src/examples/ellipse_pies.cpp @@ -27,14 +27,27 @@ #include #include +#include "ifcparse/macros.h" + +#ifndef IfcSchema #define IfcSchema Ifc2x3 -#include "ifcparse/Ifc2x3.h" +#endif + +#include INCLUDE_SCHEMA(ifcparse, IfcSchema) +#include INCLUDE_SCHEMA_DEFINITIONS(ifcparse, IfcSchema) + #include "ifcparse/IfcHierarchyHelper.h" typedef std::string S; typedef IfcParse::IfcGlobalId guid; boost::none_t const null = boost::none; +#ifdef SCHEMA_HAS_IfcSegment +typedef IfcSchema::IfcSegment curve_segment_tt; +#else +typedef IfcSchema::IfcCompositeCurveSegment curve_segment_tt; +#endif + typedef struct { double r1; double r2; @@ -54,44 +67,44 @@ void create_testcase_for(IfcHierarchyHelper& file, const EllipsePie& std::vector coords2(flt2, flt2 + 2); std::vector coords3(flt3, flt3 + 2); - Ifc2x3::IfcCartesianPoint* p1 = new Ifc2x3::IfcCartesianPoint(coords1); - Ifc2x3::IfcCartesianPoint* p2 = new Ifc2x3::IfcCartesianPoint(coords2); - Ifc2x3::IfcCartesianPoint* p3 = new Ifc2x3::IfcCartesianPoint(coords3); + IfcSchema::IfcCartesianPoint* p1 = new IfcSchema::IfcCartesianPoint(coords1); + IfcSchema::IfcCartesianPoint* p2 = new IfcSchema::IfcCartesianPoint(coords2); + IfcSchema::IfcCartesianPoint* p3 = new IfcSchema::IfcCartesianPoint(coords3); - Ifc2x3::IfcCartesianPoint::list::ptr points(new Ifc2x3::IfcCartesianPoint::list()); + IfcSchema::IfcCartesianPoint::list::ptr points(new IfcSchema::IfcCartesianPoint::list()); points->push(p3); points->push(p1); points->push(p2); file.addEntities(points->generalize()); - Ifc2x3::IfcEllipse* ellipse = new Ifc2x3::IfcEllipse(file.addPlacement2d(), pie.r1, pie.r2); + IfcSchema::IfcEllipse* ellipse = new IfcSchema::IfcEllipse(file.addPlacement2d(), pie.r1, pie.r2); file.addEntity(ellipse); aggregate_of_instance::ptr trim1(new aggregate_of_instance); aggregate_of_instance::ptr trim2(new aggregate_of_instance); if (pref == IfcSchema::IfcTrimmingPreference::IfcTrimmingPreference_PARAMETER) { - trim1->push(new Ifc2x3::IfcParameterValue(pie.t1)); - trim2->push(new Ifc2x3::IfcParameterValue(pie.t2)); + trim1->push(new IfcSchema::IfcParameterValue(pie.t1)); + trim2->push(new IfcSchema::IfcParameterValue(pie.t2)); } else { trim1->push(p2); trim2->push(p3); } - Ifc2x3::IfcTrimmedCurve* trim = new Ifc2x3::IfcTrimmedCurve(ellipse, trim1->as(), trim2->as(), true, pref); + IfcSchema::IfcTrimmedCurve* trim = new IfcSchema::IfcTrimmedCurve(ellipse, trim1->as(), trim2->as(), true, pref); file.addEntity(trim); - Ifc2x3::IfcCompositeCurveSegment::list::ptr segments(new Ifc2x3::IfcCompositeCurveSegment::list()); - Ifc2x3::IfcCompositeCurveSegment* s2 = new Ifc2x3::IfcCompositeCurveSegment(Ifc2x3::IfcTransitionCode::IfcTransitionCode_CONTINUOUS, true, trim); + curve_segment_tt::list::ptr segments(new curve_segment_tt::list()); + IfcSchema::IfcCompositeCurveSegment* s2 = new IfcSchema::IfcCompositeCurveSegment(IfcSchema::IfcTransitionCode::IfcTransitionCode_CONTINUOUS, true, trim); - Ifc2x3::IfcPolyline* poly = new Ifc2x3::IfcPolyline(points); + IfcSchema::IfcPolyline* poly = new IfcSchema::IfcPolyline(points); file.addEntity(poly); - Ifc2x3::IfcCompositeCurveSegment* s1 = new Ifc2x3::IfcCompositeCurveSegment(Ifc2x3::IfcTransitionCode::IfcTransitionCode_CONTINUOUS, true, poly); + IfcSchema::IfcCompositeCurveSegment* s1 = new IfcSchema::IfcCompositeCurveSegment(IfcSchema::IfcTransitionCode::IfcTransitionCode_CONTINUOUS, true, poly); segments->push(s1); segments->push(s2); file.addEntities(segments->generalize()); - Ifc2x3::IfcCompositeCurve* ccurve = new Ifc2x3::IfcCompositeCurve(segments, false); - Ifc2x3::IfcArbitraryClosedProfileDef* profile = new Ifc2x3::IfcArbitraryClosedProfileDef(Ifc2x3::IfcProfileTypeEnum::IfcProfileType_AREA, null, ccurve); + IfcSchema::IfcCompositeCurve* ccurve = new IfcSchema::IfcCompositeCurve(segments, false); + IfcSchema::IfcArbitraryClosedProfileDef* profile = new IfcSchema::IfcArbitraryClosedProfileDef(IfcSchema::IfcProfileTypeEnum::IfcProfileType_AREA, null, ccurve); file.addEntity(ccurve); file.addEntity(profile); diff --git a/src/examples/faces.cpp b/src/examples/faces.cpp index f7e3858c58..550ed06e13 100644 --- a/src/examples/faces.cpp +++ b/src/examples/faces.cpp @@ -24,8 +24,15 @@ ********************************************************************************/ #include +#include "ifcparse/macros.h" + +#ifndef IfcSchema #define IfcSchema Ifc2x3 -#include "ifcparse/Ifc2x3.h" +#endif + +#include INCLUDE_SCHEMA(ifcparse, IfcSchema) +#include INCLUDE_SCHEMA_DEFINITIONS(ifcparse, IfcSchema) + #include "ifcparse/IfcHierarchyHelper.h" typedef std::string S; @@ -205,4 +212,4 @@ int main(int argc, char** argv) { file.header().file_name()->setname(filename); std::ofstream f(filename); f << file; -} \ No newline at end of file +} diff --git a/src/examples/ifc_curve_rebar.cpp b/src/examples/ifc_curve_rebar.cpp index 0f66f7b45a..5553123b13 100644 --- a/src/examples/ifc_curve_rebar.cpp +++ b/src/examples/ifc_curve_rebar.cpp @@ -27,8 +27,15 @@ #include #include +#include "ifcparse/macros.h" + +#ifndef IfcSchema #define IfcSchema Ifc2x3 -#include "ifcparse/Ifc2x3.h" +#endif + +#include INCLUDE_SCHEMA(ifcparse, IfcSchema) +#include INCLUDE_SCHEMA_DEFINITIONS(ifcparse, IfcSchema) + #include "ifcparse/IfcHierarchyHelper.h" #include @@ -38,6 +45,18 @@ typedef std::string S; typedef IfcParse::IfcGlobalId guid; boost::none_t const null = boost::none; +#ifdef SCHEMA_HAS_IfcSegment +typedef IfcSchema::IfcSegment curve_segment_t; +#else +typedef IfcSchema::IfcCompositeCurveSegment curve_segment_t; +#endif + +#ifdef SCHEMA_IfcReinforcingBar_HAS_PredefinedType +#define IFC_REINFORCING_BAR_TYPE IfcSchema::IfcReinforcingBarTypeEnum::IfcReinforcingBarType_LIGATURE +#else +#define IFC_REINFORCING_BAR_TYPE IfcSchema::IfcReinforcingBarRoleEnum::IfcReinforcingBarRole_LIGATURE +#endif + void create_curve_rebar(IfcHierarchyHelper& file) { int dia = 24; @@ -52,14 +71,14 @@ void create_curve_rebar(IfcHierarchyHelper& file) dia, //diameter crossSectionarea, //crossSectionarea = math.pi*(12.0/2)**2 0, - IfcSchema::IfcReinforcingBarRoleEnum::IfcReinforcingBarRoleEnum::IfcReinforcingBarRole_LIGATURE, + IFC_REINFORCING_BAR_TYPE, IfcSchema::IfcReinforcingBarSurfaceEnum::IfcReinforcingBarSurfaceEnum::IfcReinforcingBarSurface_PLAIN //PLAIN or TEXTURED ); file.addBuildingProduct(rebar); rebar->setOwnerHistory(file.getSingle()); - IfcSchema::IfcCompositeCurveSegment::list::ptr segments(new IfcSchema::IfcCompositeCurveSegment::list()); + curve_segment_t::list::ptr segments(new curve_segment_t::list()); IfcSchema::IfcCartesianPoint* p1 = file.addTriplet(0, 0, 1000.); IfcSchema::IfcCartesianPoint* p2 = file.addTriplet(0, 0, 0); diff --git a/src/examples/profiles.cpp b/src/examples/profiles.cpp index 78cc67f13f..5392ce7195 100644 --- a/src/examples/profiles.cpp +++ b/src/examples/profiles.cpp @@ -27,14 +27,57 @@ #include #include +#include "ifcparse/macros.h" + +#ifndef IfcSchema #define IfcSchema Ifc2x3 -#include "ifcparse/Ifc2x3.h" +#endif + +#include INCLUDE_SCHEMA(ifcparse, IfcSchema) +#include INCLUDE_SCHEMA_DEFINITIONS(ifcparse, IfcSchema) + #include "ifcparse/IfcHierarchyHelper.h" typedef std::string S; typedef IfcParse::IfcGlobalId guid; boost::none_t const null = boost::none; +#ifdef SCHEMA_IfcUShapeProfileDef_HAS_CentreOfGravityInX +#define IFC_U_SHAPE_PROFILE_DEF_EXTRA_ARGS , null +#else +#define IFC_U_SHAPE_PROFILE_DEF_EXTRA_ARGS +#endif + +#ifdef SCHEMA_IfcTShapeProfileDef_HAS_CentreOfGravityInY +#define IFC_T_SHAPE_PROFILE_DEF_EXTRA_ARGS , null +#else +#define IFC_T_SHAPE_PROFILE_DEF_EXTRA_ARGS +#endif + +#ifdef SCHEMA_IfcIShapeProfileDef_HAS_FlangeEdgeRadius +#define IFC_I_SHAPE_PROFILE_DEF_EXTRA_ARGS , null, null +#else +#define IFC_I_SHAPE_PROFILE_DEF_EXTRA_ARGS +#endif + +#ifdef SCHEMA_IfcAsymmetricIShapeProfileDef_HAS_BottomFlangeSlope +#define IFC_ASYMMETRIC_I_SHAPE_PROFILE_DEF_EXTRA_ARGS , null, null, null +#else +#define IFC_ASYMMETRIC_I_SHAPE_PROFILE_DEF_EXTRA_ARGS +#endif + +#ifdef SCHEMA_IfcLShapeProfileDef_HAS_CentreOfGravityInX +#define IFC_L_SHAPE_PROFILE_DEF_EXTRA_ARGS , null, null +#else +#define IFC_L_SHAPE_PROFILE_DEF_EXTRA_ARGS +#endif + +#ifdef SCHEMA_IfcCShapeProfileDef_HAS_CentreOfGravityInX +#define IFC_C_SHAPE_PROFILE_DEF_EXTRA_ARGS , null +#else +#define IFC_C_SHAPE_PROFILE_DEF_EXTRA_ARGS +#endif + void create_testcase_for(IfcSchema::IfcProfileDef::list::ptr profiles) { IfcSchema::IfcProfileDef* profile = *profiles->begin(); const std::string& profile_type = profile->declaration().name(); @@ -88,31 +131,31 @@ int main(int argc, char** argv) { { IfcSchema::IfcProfileDef::list::ptr profiles (new IfcSchema::IfcProfileDef::list); profiles->push(new IfcSchema::IfcUShapeProfileDef( IfcSchema::IfcProfileTypeEnum::IfcProfileType_AREA, - null, 0, 50.0, 25.0, 5.0, 5.0, null, null, null, null)); + null, 0, 50.0, 25.0, 5.0, 5.0, null, null, null IFC_U_SHAPE_PROFILE_DEF_EXTRA_ARGS)); profiles->push(new IfcSchema::IfcUShapeProfileDef( IfcSchema::IfcProfileTypeEnum::IfcProfileType_AREA, - null, 0, 50.0, 25.0, 5.0, 5.0, 2.0, 2.0, null, null)); + null, 0, 50.0, 25.0, 5.0, 5.0, 2.0, 2.0, null IFC_U_SHAPE_PROFILE_DEF_EXTRA_ARGS)); profiles->push(new IfcSchema::IfcUShapeProfileDef( IfcSchema::IfcProfileTypeEnum::IfcProfileType_AREA, - null, 0, 50.0, 25.0, 5.0, 5.0, null, null, 4.0, null)); + null, 0, 50.0, 25.0, 5.0, 5.0, null, null, 4.0 IFC_U_SHAPE_PROFILE_DEF_EXTRA_ARGS)); profiles->push(new IfcSchema::IfcUShapeProfileDef( IfcSchema::IfcProfileTypeEnum::IfcProfileType_AREA, - null, 0, 50.0, 25.0, 5.0, 5.0, 1.0, 3.0, 6.0, null)); + null, 0, 50.0, 25.0, 5.0, 5.0, 1.0, 3.0, 6.0 IFC_U_SHAPE_PROFILE_DEF_EXTRA_ARGS)); create_testcase_for(profiles); } { IfcSchema::IfcProfileDef::list::ptr profiles (new IfcSchema::IfcProfileDef::list); profiles->push(new IfcSchema::IfcTShapeProfileDef( IfcSchema::IfcProfileTypeEnum::IfcProfileType_AREA, - null, 0, 50.0, 25.0, 5.0, 5.0, null, null, null, null, null, null)); + null, 0, 50.0, 25.0, 5.0, 5.0, null, null, null, null, null IFC_T_SHAPE_PROFILE_DEF_EXTRA_ARGS)); profiles->push(new IfcSchema::IfcTShapeProfileDef( IfcSchema::IfcProfileTypeEnum::IfcProfileType_AREA, - null, 0, 50.0, 25.0, 5.0, 5.0, 2.0, 2.0, 2.0, null, null, null)); + null, 0, 50.0, 25.0, 5.0, 5.0, 2.0, 2.0, 2.0, null, null IFC_T_SHAPE_PROFILE_DEF_EXTRA_ARGS)); profiles->push(new IfcSchema::IfcTShapeProfileDef( IfcSchema::IfcProfileTypeEnum::IfcProfileType_AREA, - null, 0, 50.0, 25.0, 5.0, 5.0, null, null, null, 2.0, 2.0, null)); + null, 0, 50.0, 25.0, 5.0, 5.0, null, null, null, 2.0, 2.0 IFC_T_SHAPE_PROFILE_DEF_EXTRA_ARGS)); profiles->push(new IfcSchema::IfcTShapeProfileDef( IfcSchema::IfcProfileTypeEnum::IfcProfileType_AREA, - null, 0, 50.0, 25.0, 5.0, 5.0, 3.0, 2.0, 1.0, 2.0, 2.0, null)); + null, 0, 50.0, 25.0, 5.0, 5.0, 3.0, 2.0, 1.0, 2.0, 2.0 IFC_T_SHAPE_PROFILE_DEF_EXTRA_ARGS)); create_testcase_for(profiles); } { IfcSchema::IfcProfileDef::list::ptr profiles (new IfcSchema::IfcProfileDef::list); @@ -133,40 +176,40 @@ int main(int argc, char** argv) { null, 0, 15.0, 25.0)); create_testcase_for(profiles); } - { IfcSchema::IfcProfileDef::list::ptr profiles (new IfcSchema::IfcProfileDef::list); + { IfcSchema::IfcProfileDef::list::ptr profiles (new IfcSchema::IfcProfileDef::list); profiles->push(new IfcSchema::IfcIShapeProfileDef( IfcSchema::IfcProfileTypeEnum::IfcProfileType_AREA, - null, 0, 25.0, 50.0, 5.0, 5.0, null)); + null, 0, 25.0, 50.0, 5.0, 5.0, null IFC_I_SHAPE_PROFILE_DEF_EXTRA_ARGS)); profiles->push(new IfcSchema::IfcIShapeProfileDef( IfcSchema::IfcProfileTypeEnum::IfcProfileType_AREA, - null, 0, 25.0, 50.0, 5.0, 5.0, 2.0)); + null, 0, 25.0, 50.0, 5.0, 5.0, 2.0 IFC_I_SHAPE_PROFILE_DEF_EXTRA_ARGS)); profiles->push(new IfcSchema::IfcAsymmetricIShapeProfileDef( IfcSchema::IfcProfileTypeEnum::IfcProfileType_AREA, - null, 0, 25.0, 50.0, 5.0, 5.0, 2.0, 20.0, 10.0, 5.0, null)); + null, 0, 25.0, 50.0, 5.0, 5.0, 2.0, 20.0, 10.0, 5.0, null IFC_ASYMMETRIC_I_SHAPE_PROFILE_DEF_EXTRA_ARGS)); create_testcase_for(profiles); } { IfcSchema::IfcProfileDef::list::ptr profiles (new IfcSchema::IfcProfileDef::list); profiles->push(new IfcSchema::IfcLShapeProfileDef( IfcSchema::IfcProfileTypeEnum::IfcProfileType_AREA, - null, 0, 50.0, 25.0, 5.0, null, null, null, null, null)); + null, 0, 50.0, 25.0, 5.0, null, null, null IFC_L_SHAPE_PROFILE_DEF_EXTRA_ARGS)); profiles->push(new IfcSchema::IfcLShapeProfileDef( IfcSchema::IfcProfileTypeEnum::IfcProfileType_AREA, - null, 0, 50.0, 25.0, 5.0, 2.0, 2.0, null, null, null)); + null, 0, 50.0, 25.0, 5.0, 2.0, 2.0, null IFC_L_SHAPE_PROFILE_DEF_EXTRA_ARGS)); profiles->push(new IfcSchema::IfcLShapeProfileDef( IfcSchema::IfcProfileTypeEnum::IfcProfileType_AREA, - null, 0, 50.0, 25.0, 5.0, null, null, 2.0, null, null)); + null, 0, 50.0, 25.0, 5.0, null, null, 2.0 IFC_L_SHAPE_PROFILE_DEF_EXTRA_ARGS)); profiles->push(new IfcSchema::IfcLShapeProfileDef( IfcSchema::IfcProfileTypeEnum::IfcProfileType_AREA, - null, 0, 50.0, 25.0, 5.0, 1.0, 2.0, 2.0, null, null)); + null, 0, 50.0, 25.0, 5.0, 1.0, 2.0, 2.0 IFC_L_SHAPE_PROFILE_DEF_EXTRA_ARGS)); create_testcase_for(profiles); } { IfcSchema::IfcProfileDef::list::ptr profiles (new IfcSchema::IfcProfileDef::list); profiles->push(new IfcSchema::IfcCShapeProfileDef( IfcSchema::IfcProfileTypeEnum::IfcProfileType_AREA, - null, 0, 50.0, 25.0, 5.0, 10.0, null, null)); + null, 0, 50.0, 25.0, 5.0, 10.0, null IFC_C_SHAPE_PROFILE_DEF_EXTRA_ARGS)); profiles->push(new IfcSchema::IfcCShapeProfileDef( IfcSchema::IfcProfileTypeEnum::IfcProfileType_AREA, - null, 0, 50.0, 25.0, 5.0, 10.0, 2.0, null)); + null, 0, 50.0, 25.0, 5.0, 10.0, 2.0 IFC_C_SHAPE_PROFILE_DEF_EXTRA_ARGS)); create_testcase_for(profiles); } { IfcSchema::IfcProfileDef::list::ptr profiles (new IfcSchema::IfcProfileDef::list); diff --git a/src/examples/triangulated_faceset.cpp b/src/examples/triangulated_faceset.cpp index 18eb1c3b73..b2545e83dd 100644 --- a/src/examples/triangulated_faceset.cpp +++ b/src/examples/triangulated_faceset.cpp @@ -27,8 +27,15 @@ #include #include +#include "ifcparse/macros.h" + +#ifndef IfcSchema #define IfcSchema Ifc4 -#include "ifcparse/Ifc4.h" +#endif + +#include INCLUDE_SCHEMA(ifcparse, IfcSchema) +#include INCLUDE_SCHEMA_DEFINITIONS(ifcparse, IfcSchema) + #include "ifcparse/IfcHierarchyHelper.h" #include "suzanne_geometry.h" @@ -69,7 +76,11 @@ int main(int argc, char** argv) { std::vector< std::vector< double > > vertices_vector = create_vector_from_array(vertices, sizeof(vertices) / sizeof(vertices[0])); std::vector< std::vector< int > > indices_vector = create_vector_from_array(indices, sizeof(indices) / sizeof(indices[0])); - IfcSchema::IfcCartesianPointList3D* coordinates = new IfcSchema::IfcCartesianPointList3D(vertices_vector); + IfcSchema::IfcCartesianPointList3D* coordinates = new IfcSchema::IfcCartesianPointList3D(vertices_vector +#ifdef SCHEMA_IfcCartesianPointList3D_HAS_TagList + , boost::none +#endif + ); IfcSchema::IfcTriangulatedFaceSet* faceset = new IfcSchema::IfcTriangulatedFaceSet(coordinates, null, null, indices_vector, null); items->push(faceset); diff --git a/src/ifcgeom/mapping/mapping.h b/src/ifcgeom/mapping/mapping.h index 2ddfadd728..cdc9cdfbb8 100644 --- a/src/ifcgeom/mapping/mapping.h +++ b/src/ifcgeom/mapping/mapping.h @@ -9,12 +9,8 @@ #include #include -#define INCLUDE_SCHEMA(x) STRINGIFY(../../ifcparse/x.h) -#include INCLUDE_SCHEMA(IfcSchema) -#undef INCLUDE_SCHEMA -#define INCLUDE_SCHEMA(x) STRINGIFY(../../ifcparse/x-definitions.h) -#include INCLUDE_SCHEMA(IfcSchema) -#undef INCLUDE_SCHEMA +#include INCLUDE_SCHEMA(../../ifcparse, IfcSchema) +#include INCLUDE_SCHEMA_DEFINITIONS(../../ifcparse, IfcSchema) namespace ifcopenshell { diff --git a/src/ifcparse/macros.h b/src/ifcparse/macros.h index 113152a5f2..77b6ba26dd 100644 --- a/src/ifcparse/macros.h +++ b/src/ifcparse/macros.h @@ -27,6 +27,9 @@ #define STRINGIFY_(x) #x #define STRINGIFY(x) STRINGIFY_(x) +#define INCLUDE_SCHEMA(prefix, x) STRINGIFY(prefix/x.h) +#define INCLUDE_SCHEMA_DEFINITIONS(prefix, x) STRINGIFY(prefix/x-definitions.h) + #define MAKE_INIT_FN__(a, b) init_##a##_##b #define MAKE_INIT_FN_(a, b) MAKE_INIT_FN__(a, b) #define MAKE_INIT_FN(t) MAKE_INIT_FN_(t, IfcSchema)