2828#include < iostream>
2929#include < fstream>
3030
31- #include " ../ifcparse/Ifc2x3.h "
32- #include " ../ ifcparse/IfcUtil .h"
33- #include " ../ ifcparse/IfcHierarchyHelper.h"
31+ #define IfcSchema Ifc4
32+ #include " ifcparse/Ifc4 .h"
33+ #include " ifcparse/IfcHierarchyHelper.h"
3434
3535typedef std::string S;
3636typedef IfcParse::IfcGlobalId guid;
3737boost::none_t const null = boost::none;
3838static int i = 0 ;
3939
40- void create_product_from_item (IfcHierarchyHelper& file, IfcSchema::IfcRepresentationItem* item, const std::string& s) {
40+ void create_product_from_item (IfcHierarchyHelper<IfcSchema> & file, IfcSchema::IfcRepresentationItem* item, const std::string& s) {
4141 IfcSchema::IfcBuildingElementProxy* product = new IfcSchema::IfcBuildingElementProxy (
4242 guid (), 0 , S (" product" ), null, null, 0 , 0 , null, null);
4343 file.addBuildingProduct (product);
@@ -50,7 +50,7 @@ void create_product_from_item(IfcHierarchyHelper& file, IfcSchema::IfcRepresenta
5050 items->push (item);
5151
5252 if (s == " GeometricSet" ) {
53- IfcSchema::IfcGeometricSet* set = new IfcSchema::IfcGeometricSet (items->generalize ());
53+ IfcSchema::IfcGeometricSet* set = new IfcSchema::IfcGeometricSet (items->as <IfcSchema::IfcGeometricSetSelect> ());
5454 file.addEntity (set);
5555 items = IfcSchema::IfcRepresentationItem::list::ptr (new IfcSchema::IfcRepresentationItem::list ());
5656 items->push (set);
@@ -67,7 +67,7 @@ void create_product_from_item(IfcHierarchyHelper& file, IfcSchema::IfcRepresenta
6767 product->setRepresentation (shape);
6868}
6969
70- void create_surfaces_from_profile (IfcHierarchyHelper& file, IfcSchema::IfcProfileDef* profile) {
70+ void create_surfaces_from_profile (IfcHierarchyHelper<IfcSchema> & file, IfcSchema::IfcProfileDef* profile) {
7171 IfcSchema::IfcSurfaceOfLinearExtrusion* extrusion = new IfcSchema::IfcSurfaceOfLinearExtrusion (profile, file.addPlacement3d (), file.addTriplet <IfcSchema::IfcDirection>(0 , 0 , 1 ), 100 .);
7272 file.addEntity (extrusion);
7373
@@ -80,7 +80,7 @@ void create_surfaces_from_profile(IfcHierarchyHelper& file, IfcSchema::IfcProfil
8080 create_product_from_item (file, revolution, " GeometricSet" );
8181}
8282
83- void create_solids_from_profile (IfcHierarchyHelper& file, IfcSchema::IfcProfileDef* profile) {
83+ void create_solids_from_profile (IfcHierarchyHelper<IfcSchema> & file, IfcSchema::IfcProfileDef* profile) {
8484 IfcSchema::IfcExtrudedAreaSolid* extrusion = new IfcSchema::IfcExtrudedAreaSolid (profile, file.addPlacement3d (), file.addTriplet <IfcSchema::IfcDirection>(0 , 0 , 1 ), 100 .);
8585 file.addEntity (extrusion);
8686
@@ -96,7 +96,7 @@ void create_solids_from_profile(IfcHierarchyHelper& file, IfcSchema::IfcProfileD
9696 create_product_from_item (file, revolution2, " SweptSolid" );
9797}
9898
99- void create_products_from_curve (IfcHierarchyHelper& file, IfcSchema::IfcBoundedCurve* curve) {
99+ void create_products_from_curve (IfcHierarchyHelper<IfcSchema> & file, IfcSchema::IfcBoundedCurve* curve) {
100100 IfcSchema::IfcArbitraryOpenProfileDef* open = new IfcSchema::IfcArbitraryOpenProfileDef (IfcSchema::IfcProfileTypeEnum::IfcProfileType_CURVE, null, curve);
101101 IfcSchema::IfcCenterLineProfileDef* center_line = new IfcSchema::IfcCenterLineProfileDef (IfcSchema::IfcProfileTypeEnum::IfcProfileType_AREA, null, curve, 10 .);
102102 file.addEntity (open);
@@ -107,9 +107,9 @@ void create_products_from_curve(IfcHierarchyHelper& file, IfcSchema::IfcBoundedC
107107}
108108
109109int main (int argc, char ** argv) {
110- const char filename[] = " IfcArbitraryOpenProfileDef .ifc" ;
111- IfcHierarchyHelper file;
112- file.header ().file_name (). name (filename);
110+ const char filename[] = " arbitrary_open_profile_def .ifc" ;
111+ IfcHierarchyHelper<IfcSchema> file;
112+ file.header ().file_name ()-> setname (filename);
113113
114114 double coords1[] = {-50.0 , 0.0 };
115115 double coords2[] = { 50.0 , 0.0 };
@@ -124,17 +124,18 @@ int main(int argc, char** argv) {
124124
125125 IfcSchema::IfcEllipse* ellipse = new IfcSchema::IfcEllipse (file.addPlacement2d (), 50 ., 25 .);
126126 file.addEntity (ellipse);
127- IfcEntityList ::ptr trim1 (new IfcEntityList );
128- IfcEntityList ::ptr trim2 (new IfcEntityList );
127+ aggregate_of_instance ::ptr trim1 (new aggregate_of_instance );
128+ aggregate_of_instance ::ptr trim2 (new aggregate_of_instance );
129129 trim1->push (new IfcSchema::IfcParameterValue ( 0 .));
130130 trim2->push (new IfcSchema::IfcParameterValue (180 .));
131- IfcSchema::IfcTrimmedCurve* trim = new IfcSchema::IfcTrimmedCurve (ellipse, trim1, trim2, true , IfcSchema::IfcTrimmingPreference::IfcTrimmingPreference_PARAMETER);
131+ IfcSchema::IfcTrimmedCurve* trim = new IfcSchema::IfcTrimmedCurve (ellipse, trim1-> as <IfcSchema::IfcTrimmingSelect>() , trim2-> as <IfcSchema::IfcTrimmingSelect>() , true , IfcSchema::IfcTrimmingPreference::IfcTrimmingPreference_PARAMETER);
132132 file.addEntity (trim);
133133
134134 create_products_from_curve (file, trim);
135135
136- file.getSingle <Ifc2x3::IfcProject>()->setName (" IfcArbitraryOpenProfileDef" );
136+ using namespace std ::string_literals;
137+ file.getSingle <IfcSchema::IfcProject>()->setName (" arbitrary_open_profile_def" s);
137138
138139 std::ofstream f (filename);
139140 f << file;
140- }
141+ }
0 commit comments