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

Function main

src/examples/IfcSimplifiedAlignment.cpp:81–164  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

79}
80
81int main() {
82 IfcHierarchyHelper<Schema> file;
83
84 auto project = setup_project(file);
85
86 //
87 // Define horizontal alignment
88 //
89
90 // PI Data
91 // B.1.1 pg 211
92 std::vector<std::pair<double, double>> points{
93 { 500.0, 2500.0}, // beginning
94 {3340.0, 660.0}, // Point of intersection (PI), Curve #1
95 {4340.0, 5000.0}, // Point of intersection (PI), Curve #2
96 {7600.0, 4560.0}, // Point of intersection (PI), Curve #3
97 {8480.0, 2010.0} // ending
98 };
99
100 // Curve Data
101 // B.1.3 pg 212
102 std::vector<double> radii{ 1000,1250,950 };
103
104 //
105 // Define vertical profile segments
106 //
107
108 // Vertical Profile Data
109 // Figure B.2 pg 213
110 double xStart = 10000.0; // subtract xStart so the points are distance along, not station
111 std::vector<std::pair<double,double>> vpoints {
112 {10000.0-xStart,100.0}, // Vertical point of beginning (VPOB)
113 {12000.0-xStart,135.0}, // Point of vertical intersection (VPI), Curve #1
114 {15000.0-xStart,105.0}, // Point of vertical intersection (VPI), Curve #2
115 {17400.0-xStart,153.0}, // Point of vertical intersection (VPI), Curve #3
116 {19800.0-xStart,105.0}, // Point of vertical intersection (VPI), Curve #4
117 {22800.0-xStart, 90.0} // Vertical poitn of ending (VPOE)
118 };
119
120 // Vertical Curve Lengths
121 // Figure B.2 pg 213
122 std::vector<double> vclengths{1600.0, 1200.0, 2000.0, 800.0};
123
124 // Use utility function to create alignment
125 auto alignment = addAlignment(file, "Example Alignment", points, radii, vpoints, vclengths);
126
127 // Define the alignment's relationship with the project
128
129 // IFC 4.1.4.1.1 "Every IfcAlignment must be related to IfcProject using the IfcRelAggregates relationship"
130 // https://standards.buildingsmart.org/IFC/RELEASE/IFC4_3/HTML/concepts/Object_Composition/Aggregation/Alignment_Aggregation_To_Project/content.html
131 // IfcProject <-> IfcRelAggregates <-> IfcAlignment
132 typename aggregate_of<typename Schema::IfcObjectDefinition>::ptr list_of_alignments_in_project(new aggregate_of<typename Schema::IfcObjectDefinition>());
133 list_of_alignments_in_project->push(alignment);
134 auto aggregate_alignments_with_project = new Schema::IfcRelAggregates(IfcParse::IfcGlobalId(), nullptr, std::string("Alignments in project"), boost::none, project, list_of_alignments_in_project);
135 file.addEntity(aggregate_alignments_with_project);
136
137 // Define the spatial structure of the alignment with respect to the site
138

Callers

nothing calls this directly

Calls 6

addAlignmentFunction · 0.85
addEntityMethod · 0.80
addSiteMethod · 0.80
setup_projectFunction · 0.70
pushMethod · 0.45
strMethod · 0.45

Tested by

no test coverage detected