Standard_Real len = 6;

Standard_Real hei = 15;

Standard_Real wit = 10;

Standard_Real thk = 3;

Standard_Real outside_R = ((thk * 2) < len && (thk*2) < hei) ? (thk*2) : thk;

Standard_Real inside_R = ((thk * 2) < len && (thk * 2) < hei) ? (thk * 2) : thk/2;

gp_Pnt p1(0, 0, 0);

gp_Pnt p2(len, 0, 0);

gp_Pnt p3(len, thk, 0);

gp_Pnt p4(thk, thk, 0);

gp_Pnt p5(thk, hei, 0);

gp_Pnt p6(0, hei, 0);

Handle(Geom_TrimmedCurve) s1 = GC_MakeSegment(p1, p2);

Handle(Geom_TrimmedCurve) s2 = GC_MakeSegment(p2, p3);

Handle(Geom_TrimmedCurve) s3 = GC_MakeSegment(p3, p4);

Handle(Geom_TrimmedCurve) s4 = GC_MakeSegment(p4, p5);

Handle(Geom_TrimmedCurve) s5 = GC_MakeSegment(p5, p6);

Handle(Geom_TrimmedCurve) s6 = GC_MakeSegment(p6, p1);

TopoDS_Edge e1 = BRepBuilderAPI_MakeEdge(s1);

TopoDS_Edge e2 = BRepBuilderAPI_MakeEdge(s2);

TopoDS_Edge e3 = BRepBuilderAPI_MakeEdge(s3);

TopoDS_Edge e4 = BRepBuilderAPI_MakeEdge(s4);

TopoDS_Edge e5 = BRepBuilderAPI_MakeEdge(s5);

TopoDS_Edge e6 = BRepBuilderAPI_MakeEdge(s6);

TopoDS_Wire aWire = BRepBuilderAPI_MakeWire(e1, e2, e3);

TopoDS_Wire aWire2 = BRepBuilderAPI_MakeWire(e4, e5, e6);

BRepBuilderAPI_MakeWire mkWire;

mkWire.Add(aWire);

mkWire.Add(aWire2);

TopoDS_Wire myWireProfile = mkWire.Wire();

TopoDS_Face myFaceProfile = BRepBuilderAPI_MakeFace(myWireProfile);

gp_Vec aPrismVec(0, 0, wit);

TopoDS_Shape myBody = BRepPrimAPI_MakePrism(myFaceProfile, aPrismVec);

BRepFilletAPI_MakeFillet mkFillets(myBody);

ChFi3d_FilletShape FSH = ChFi3d_Rational;

mkFillets.SetFilletShape(FSH);

TopExp_Explorer anEdgeExplorer(myBody, TopAbs_EDGE);

while (anEdgeExplorer.More()) {

Standard_Real u0 = (std::numeric_limits<double>::min)();

Standard_Real u1 = (std::numeric_limits<double>::min)();

TopoDS_Edge theEdge = TopoDS::Edge(anEdgeExplorer.Current());

auto curve = BRep_Tool::Curve(theEdge, u0, u1);

gp_Pnt s = curve->Value(u0);

gp_Pnt e = curve->Value(u1);

if (s.Distance(p1) <= Precision::Confusion() &&

e.Distance(p1.Translated(aPrismVec)) <= Precision::Confusion())

{

Handle(AIS_Shape) edge = new AIS_Shape(theEdge);

mkFillets.Add(outside_R,theEdge);

}

if (s.Distance(p4) <= Precision::Confusion() &&

e.Distance(p4.Translated(aPrismVec)) <= Precision::Confusion())

{

Handle(AIS_Shape) edge = new AIS_Shape(theEdge);

mkFillets.Add(inside_R, theEdge);

}

anEdgeExplorer.Next();

}

if(mkFillets.IsDone())

TopoDS_Shape S2 = mkFillets.Shape();