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

Function create_segment_representations

src/examples/IfcAlignment.cpp:182–204  ·  view source on GitHub ↗

creates representations for each IfcAlignmentSegment per CT 4.1.7.1.1.4 https://standards.buildingsmart.org/IFC/RELEASE/IFC4_3/HTML/concepts/Product_Shape/Product_Geometric_Representation/Alignment_Geometry/Alignment_Geometry_-_Segments/content.html

Source from the content-addressed store, hash-verified

180// creates representations for each IfcAlignmentSegment per CT 4.1.7.1.1.4
181// https://standards.buildingsmart.org/IFC/RELEASE/IFC4_3/HTML/concepts/Product_Shape/Product_Geometric_Representation/Alignment_Geometry/Alignment_Geometry_-_Segments/content.html
182void create_segment_representations(IfcHierarchyHelper<Schema>& file, Schema::IfcLocalPlacement* global_placement, Schema::IfcGeometricRepresentationSubContext* segment_axis_subcontext, typename aggregate_of<typename Schema::IfcSegment>::ptr curve_segments, typename aggregate_of<typename Schema::IfcObjectDefinition>::ptr segments) {
183 auto cs_iter = curve_segments->begin();
184 auto s_iter = segments->begin();
185 for (; cs_iter != curve_segments->end(); cs_iter++, s_iter++) {
186 auto curve_segment = *cs_iter;
187 auto alignment_segment = (*s_iter)->as<Schema::IfcAlignmentSegment>();
188
189 typename aggregate_of<typename Schema::IfcRepresentationItem>::ptr representation_items(new aggregate_of<typename Schema::IfcRepresentationItem>());
190 representation_items->push(curve_segment);
191
192 auto axis_representation = new Schema::IfcShapeRepresentation(segment_axis_subcontext, std::string("Axis"), std::string("Segment"), representation_items);
193 file.addEntity(axis_representation);
194
195 typename aggregate_of<typename Schema::IfcRepresentation>::ptr representations(new aggregate_of<typename Schema::IfcRepresentation>());
196 representations->push(axis_representation);
197
198 auto product = new Schema::IfcProductDefinitionShape(boost::none, boost::none, representations);
199 file.addEntity(product);
200
201 alignment_segment->setObjectPlacement(global_placement);
202 alignment_segment->setRepresentation(product);
203 }
204}
205
206int main() {
207 IfcHierarchyHelper<Schema> file;

Callers 1

mainFunction · 0.70

Calls 4

addEntityMethod · 0.80
beginMethod · 0.45
endMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected