int main(int argc, char** argv) { const char filename[] = "IfcArbitraryOpenProfileDef.ifc"; IfcHierarchyHelper file; file.filename(filename); double coords1[] = {-50.0, 0.0}; double coords2[] = { 50.0, 0.0}; IfcSchema::IfcCartesianPoint::list points (new IfcTemplatedEntityList<IfcSchema::IfcCartesianPoint>()); points->push(new IfcSchema::IfcCartesianPoint(std::vector<double>(coords1, coords1+2))); points->push(new IfcSchema::IfcCartesianPoint(std::vector<double>(coords2, coords2+2))); file.AddEntities(points->generalize()); IfcSchema::IfcPolyline* poly = new IfcSchema::IfcPolyline(points); file.AddEntity(poly); create_products_from_curve(file, poly); IfcSchema::IfcEllipse* ellipse = new IfcSchema::IfcEllipse(file.addPlacement2d(), 50., 25.); file.AddEntity(ellipse); IfcEntities trim1(new IfcEntityList()); IfcEntities trim2(new IfcEntityList()); trim1->push(new IfcWrite::IfcSelectHelper( 0., Ifc2x3::Type::IfcParameterValue)); trim2->push(new IfcWrite::IfcSelectHelper(180., Ifc2x3::Type::IfcParameterValue)); IfcSchema::IfcTrimmedCurve* trim = new IfcSchema::IfcTrimmedCurve(ellipse, trim1, trim2, true, IfcSchema::IfcTrimmingPreference::IfcTrimmingPreference_PARAMETER); file.AddEntity(trim); create_products_from_curve(file, trim); file.getSingle<Ifc2x3::IfcProject>()->setName("IfcArbitraryOpenProfileDef"); std::ofstream f(filename); f << file; }
int main(int argc, char** argv) { const char filename[] = "IfcCompositeProfileDef.ifc"; IfcHierarchyHelper file; file.filename(filename); double coords1[] = {100.0, 0.0}; double coords2[] = {200.0, 0.0}; double coords3[] = {300.0, 0.0}; IfcSchema::IfcProfileDef::list profiles (new IfcTemplatedEntityList<IfcSchema::IfcProfileDef>()); IfcSchema::IfcCartesianTransformationOperator2D* transform1 = new IfcSchema::IfcCartesianTransformationOperator2D(file.addDoublet<IfcSchema::IfcDirection>(1, 0), file.addDoublet<IfcSchema::IfcDirection>(0, -1), file.addDoublet<IfcSchema::IfcCartesianPoint>(40, 0), null); IfcSchema::IfcCartesianTransformationOperator2D* transform2 = new IfcSchema::IfcCartesianTransformationOperator2D(file.addDoublet<IfcSchema::IfcDirection>(0, -1), file.addDoublet<IfcSchema::IfcDirection>(1, 0), file.addDoublet<IfcSchema::IfcCartesianPoint>(40, 0), 0.3); IfcSchema::IfcProfileDef* p1 = new Ifc2x3::IfcIShapeProfileDef( IfcSchema::IfcProfileTypeEnum::IfcProfileType_AREA, null, file.addPlacement2d(), 25.0, 50.0, 5.0, 5.0, 2.0); IfcSchema::IfcProfileDef* p2 = new Ifc2x3::IfcLShapeProfileDef( IfcSchema::IfcProfileTypeEnum::IfcProfileType_AREA, null, file.addPlacement2d(), 50.0, 25.0, 5.0, 1.0, 2.0, 2.0, null, null); IfcSchema::IfcProfileDef* p3 = new Ifc2x3::IfcTShapeProfileDef( IfcSchema::IfcProfileTypeEnum::IfcProfileType_AREA, null, file.addPlacement2d(), 50.0, 40.0, 10.0, 10.0, 3.0, 2.0, 1.0, 2.0, 2.0, null); IfcSchema::IfcProfileDef* p4 = new Ifc2x3::IfcCShapeProfileDef( IfcSchema::IfcProfileTypeEnum::IfcProfileType_AREA, null, file.addPlacement2d(80.), 50.0, 25.0, 5.0, 10.0, 2.0, null); file.AddEntity(p2); file.AddEntity(p3); file.AddEntity(transform1); file.AddEntity(transform2); IfcSchema::IfcDerivedProfileDef* p5 = new IfcSchema::IfcDerivedProfileDef(IfcSchema::IfcProfileTypeEnum::IfcProfileType_AREA, null, p2, transform1, null); IfcSchema::IfcDerivedProfileDef* p6 = new IfcSchema::IfcDerivedProfileDef(IfcSchema::IfcProfileTypeEnum::IfcProfileType_AREA, null, p3, transform2, null); profiles->push(p1); profiles->push(p5); profiles->push(p6); profiles->push(p4); file.AddEntities(profiles->generalize()); IfcSchema::IfcCompositeProfileDef* composite = new IfcSchema::IfcCompositeProfileDef(IfcSchema::IfcProfileTypeEnum::IfcProfileType_AREA, S("IFC"), profiles, null); IfcSchema::IfcBuildingElementProxy* product = new IfcSchema::IfcBuildingElementProxy( guid(), 0, S("profile"), null, null, 0, 0, null, null); file.addBuildingProduct(product); product->setOwnerHistory(file.getSingle<IfcSchema::IfcOwnerHistory>()); product->setObjectPlacement(file.addLocalPlacement()); IfcSchema::IfcExtrudedAreaSolid* solid = new IfcSchema::IfcExtrudedAreaSolid(composite, file.addPlacement3d(), file.addTriplet<IfcSchema::IfcDirection>(0, 0, 1), 20.0); file.AddEntity(composite); file.AddEntity(solid); IfcSchema::IfcRepresentation::list reps (new IfcTemplatedEntityList<IfcSchema::IfcRepresentation>()); IfcSchema::IfcRepresentationItem::list items (new IfcTemplatedEntityList<IfcSchema::IfcRepresentationItem>()); items->push(solid); IfcSchema::IfcShapeRepresentation* rep = new IfcSchema::IfcShapeRepresentation( file.getSingle<IfcSchema::IfcRepresentationContext>(), S("Body"), S("SweptSolid"), items); reps->push(rep); IfcSchema::IfcProductDefinitionShape* shape = new IfcSchema::IfcProductDefinitionShape(0, 0, reps); file.AddEntity(rep); file.AddEntity(shape); product->setRepresentation(shape); file.getSingle<IfcSchema::IfcProject>()->setName("IfcCompositeProfileDef"); std::ofstream f(filename); f << file; }