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

Function main

src/examples/IfcAlignment.cpp:206–494  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

204}
205
206int main() {
207 IfcHierarchyHelper<Schema> file;
208
209 auto project = setup_project(file);
210
211 auto geometric_representation_context = file.getRepresentationContext(std::string("Model")); // creates the representation context if it doesn't already exist
212
213 auto axis_model_representation_subcontext = new Schema::IfcGeometricRepresentationSubContext(std::string("Axis"), std::string("Model"), geometric_representation_context, boost::none, Schema::IfcGeometricProjectionEnum::IfcGeometricProjection_MODEL_VIEW, boost::none);
214 file.addEntity(axis_model_representation_subcontext);
215
216 auto global_placement = file.addLocalPlacement();
217
218 //
219 // Define horizontal alignment
220 //
221
222 // define key points
223 // B.1.4 pg 212
224 auto pob = file.addDoublet<Schema::IfcCartesianPoint>(500, 2500); // beginning
225 auto pc1 = file.addDoublet<Schema::IfcCartesianPoint>(2142.237995, 1436.014820); // Point of curve (PC), Curve #1
226 auto pt1 = file.addDoublet<Schema::IfcCartesianPoint>(3660.446123, 2050.736173); // Point of tangent (PT), Curve #1
227 auto pc2 = file.addDoublet<Schema::IfcCartesianPoint>(4084.115884, 3889.462938); // Point of curve (PC), Curve #2
228 auto pt2 = file.addDoublet<Schema::IfcCartesianPoint>(5469.395067, 4847.566310); // Point of tangent (PT), Curve #2
229 auto pc3 = file.addDoublet<Schema::IfcCartesianPoint>(7019.971367, 4638.286073); // Point of curve (PC), Curve #3
230 auto pt3 = file.addDoublet<Schema::IfcCartesianPoint>(7790.932128, 4006.730765); // Point of tangent (PT), Curve #3
231 auto poe = file.addDoublet<Schema::IfcCartesianPoint>(8480, 2010); // ending
232
233 // define tangent runs and curve lengths
234 double run_1 = 1956.785654;
235 double lc_1 = 1919.222667;
236 double run_2 = 1886.905454;
237 double lc_2 = 1848.115835;
238 double run_3 = 1564.635765;
239 double lc_3 = 1049.119737;
240 double run_4 = 2112.285084;
241
242 // define curve radii
243 double rc_1 = 1000;
244 double rc_2 = -1250; // negative radius for curves to the right
245 double rc_3 = -950;
246
247 // bearing of tangents
248 double angle_1 = to_radian(327.0613);
249 double angle_2 = to_radian(77.0247);
250 double angle_3 = to_radian(352.3133);
251 double angle_4 = to_radian(289.0395);
252
253 // create containers to store the curve segments
254 typename aggregate_of<typename Schema::IfcSegment>::ptr horizontal_curve_segments(new aggregate_of<typename Schema::IfcSegment>()); // geometry
255 typename aggregate_of<typename Schema::IfcObjectDefinition>::ptr horizontal_segments(new aggregate_of<typename Schema::IfcObjectDefinition>()); // business logic
256
257 //
258 // Build the horizontal alignment segments
259 //
260
261 // POB to PC1
262 auto curve_segment_1 = create_tangent(pob, angle_1, run_1);
263 horizontal_curve_segments->push(curve_segment_1.first);

Callers

nothing calls this directly

Calls 13

to_radianFunction · 0.85
create_tangentFunction · 0.85
create_hcurveFunction · 0.85
create_gradientFunction · 0.85
create_vcurveFunction · 0.85
addEntityMethod · 0.80
addLocalPlacementMethod · 0.80
addSiteMethod · 0.80
setup_projectFunction · 0.70
pushMethod · 0.45

Tested by

no test coverage detected