MCPcopy Create free account
hub / github.com/IfcOpenShell/IfcOpenShell / main

Function main

src/examples/arbitrary_open_profile_def.cpp:109–141  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

107}
108
109int main(int argc, char** argv) {
110 const char filename[] = "arbitrary_open_profile_def.ifc";
111 IfcHierarchyHelper<IfcSchema> file;
112 file.header().file_name()->setname(filename);
113
114 double coords1[] = {-50.0, 0.0};
115 double coords2[] = { 50.0, 0.0};
116 IfcSchema::IfcCartesianPoint::list::ptr points (new IfcSchema::IfcCartesianPoint::list());
117 points->push(new IfcSchema::IfcCartesianPoint(std::vector<double>(coords1, coords1+2)));
118 points->push(new IfcSchema::IfcCartesianPoint(std::vector<double>(coords2, coords2+2)));
119 file.addEntities(points->generalize());
120 IfcSchema::IfcPolyline* poly = new IfcSchema::IfcPolyline(points);
121 file.addEntity(poly);
122
123 create_products_from_curve(file, poly);
124
125 IfcSchema::IfcEllipse* ellipse = new IfcSchema::IfcEllipse(file.addPlacement2d(), 50., 25.);
126 file.addEntity(ellipse);
127 aggregate_of_instance::ptr trim1(new aggregate_of_instance);
128 aggregate_of_instance::ptr trim2(new aggregate_of_instance);
129 trim1->push(new IfcSchema::IfcParameterValue( 0.));
130 trim2->push(new IfcSchema::IfcParameterValue(180.));
131 IfcSchema::IfcTrimmedCurve* trim = new IfcSchema::IfcTrimmedCurve(ellipse, trim1->as<IfcSchema::IfcTrimmingSelect>(), trim2->as<IfcSchema::IfcTrimmingSelect>(), true, IfcSchema::IfcTrimmingPreference::IfcTrimmingPreference_PARAMETER);
132 file.addEntity(trim);
133
134 create_products_from_curve(file, trim);
135
136 using namespace std::string_literals;
137 file.getSingle<IfcSchema::IfcProject>()->setName("arbitrary_open_profile_def"s);
138
139 std::ofstream f(filename);
140 f << file;
141}

Callers

nothing calls this directly

Calls 9

setnameMethod · 0.80
addEntitiesMethod · 0.80
addEntityMethod · 0.80
addPlacement2dMethod · 0.80
file_nameMethod · 0.45
headerMethod · 0.45
pushMethod · 0.45
generalizeMethod · 0.45

Tested by

no test coverage detected