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

Function main

src/examples/triangulated_faceset.cpp:56–89  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

54}
55
56int main(int argc, char** argv) {
57 IfcHierarchyHelper<IfcSchema> file;
58
59 IfcSchema::IfcBuildingElementProxy* product = new IfcSchema::IfcBuildingElementProxy(
60 guid(), 0, S("Blender's Suzanne"), null, null, 0, 0, null, null);
61 file.addBuildingProduct(product);
62 product->setOwnerHistory(file.getSingle<IfcSchema::IfcOwnerHistory>());
63
64 product->setObjectPlacement(file.addLocalPlacement());
65
66 IfcSchema::IfcRepresentation::list::ptr reps (new IfcSchema::IfcRepresentation::list);
67 IfcSchema::IfcRepresentationItem::list::ptr items (new IfcSchema::IfcRepresentationItem::list);
68
69 std::vector< std::vector< double > > vertices_vector = create_vector_from_array(vertices, sizeof(vertices) / sizeof(vertices[0]));
70 std::vector< std::vector< int > > indices_vector = create_vector_from_array(indices, sizeof(indices) / sizeof(indices[0]));
71
72 IfcSchema::IfcCartesianPointList3D* coordinates = new IfcSchema::IfcCartesianPointList3D(vertices_vector);
73 IfcSchema::IfcTriangulatedFaceSet* faceset = new IfcSchema::IfcTriangulatedFaceSet(coordinates, null, null, indices_vector, null);
74
75 items->push(faceset);
76 IfcSchema::IfcShapeRepresentation* rep = new IfcSchema::IfcShapeRepresentation(
77 file.getRepresentationContext("Model"), S("Body"), S("SurfaceModel"), items);
78 reps->push(rep);
79
80 IfcSchema::IfcProductDefinitionShape* shape = new IfcSchema::IfcProductDefinitionShape(boost::none, boost::none, reps);
81 file.addEntity(shape);
82
83 product->setRepresentation(shape);
84
85 const std::string filename = "triangulated_faceset.ifc";
86 file.header().file_name()->setname(filename);
87 std::ofstream f(filename);
88 f << file;
89}

Callers

nothing calls this directly

Calls 9

create_vector_from_arrayFunction · 0.85
addBuildingProductMethod · 0.80
addLocalPlacementMethod · 0.80
addEntityMethod · 0.80
setnameMethod · 0.80
pushMethod · 0.45
file_nameMethod · 0.45
headerMethod · 0.45

Tested by

no test coverage detected