bool IfcGeom::Kernel::convert(const IfcSchema::IfcCircleProfileDef* l, TopoDS_Shape& face) { const double r = l->Radius() * getValue(GV_LENGTH_UNIT); if ( r == 0.0f ) { Logger::Message(Logger::LOG_NOTICE,"Skipping zero sized profile:",l->entity); return false; } gp_Trsf2d trsf2d; bool has_position = true; #ifdef USE_IFC4 has_position = l->hasPosition(); #endif if (has_position) { IfcGeom::Kernel::convert(l->Position(), trsf2d); } gp_Ax2 ax = gp_Ax2().Transformed(trsf2d); Handle(Geom_Circle) circle = new Geom_Circle(ax, r); TopoDS_Edge edge = BRepBuilderAPI_MakeEdge(circle); BRepBuilderAPI_MakeWire w; w.Add(edge); TopoDS_Face f; bool success = convert_wire_to_face(w, f); if (success) face = f; return success; }
bool IfcGeom::Kernel::convert(const IfcSchema::IfcEllipseProfileDef* l, TopoDS_Shape& face) { double rx = l->SemiAxis1() * getValue(GV_LENGTH_UNIT); double ry = l->SemiAxis2() * getValue(GV_LENGTH_UNIT); if ( rx < ALMOST_ZERO || ry < ALMOST_ZERO ) { Logger::Message(Logger::LOG_NOTICE,"Skipping zero sized profile:",l->entity); return false; } const bool rotated = ry > rx; gp_Trsf2d trsf; convert(l->Position(),trsf); gp_Ax2 ax = gp_Ax2(); if (rotated) { ax.Rotate(ax.Axis(), M_PI / 2.); std::swap(rx, ry); } ax.Transform(trsf); BRepBuilderAPI_MakeWire w; Handle(Geom_Ellipse) ellipse = new Geom_Ellipse(ax, rx, ry); TopoDS_Edge edge = BRepBuilderAPI_MakeEdge(ellipse); w.Add(edge); TopoDS_Face f; bool success = convert_wire_to_face(w, f); if (success) face = f; return success; }
bool IfcGeom::Kernel::convert(const IfcSchema::IfcArbitraryClosedProfileDef* l, TopoDS_Shape& face) { TopoDS_Wire wire; if ( ! convert_wire(l->OuterCurve(),wire) ) return false; TopoDS_Face f; bool success = convert_wire_to_face(wire, f); if (success) face = f; return success; }