Open CASCADE, the 3D modelling kernel
3D modeling & numerical simulation

Search the Forums
See All Topics

error when adding fillets onto a polygon

error when adding fillets onto a polygon
Gan Lu 2012/11/02 23:56
Hi all;
I'm trying to add fillets onto the four corners of a rectangle polygon. But the program reports error after I adding the fillets. Please can anyone help me to identify the mistake? Mannnnnny thanks!!!!
//Vertices of the first square
gp_Pnt E(0,10,0.0);
gp_Pnt F(0,0,0.0);
gp_Pnt G(10,0,0.0);
gp_Pnt H(10,10,0.0);
//Construction of the fist square
BRepBuilderAPI_MakeWire wireMakerb;
wireMakerb.Add(BRepBuilderAPI_MakeEdge(E, F).Edge());
wireMakerb.Add(BRepBuilderAPI_MakeEdge (F, G).Edge());
wireMakerb.Add(BRepBuilderAPI_MakeEdge(G, H).Edge());
wireMakerb.Add(BRepBuilderAPI_MakeEdge(H, E).Edge());
BRepBuilderAPI_MakeFace faceMakerb (wireMakerb.Wire());
TopoDS_Shape B = faceMakerb.Face();

BRepFilletAPI_MakeFillet afillet(B);
TopExp_Explorer ex;
for(ex.Init(B, TopAbs_EDGE); ex.More(); ex.Next())
TopoDS_Edge medge= TopoDS::Edge(ex.Current());

if(afillet.Shape().IsNull()) {cout<<" THE SHAPE IS BAD!"<<endl;} //****************HAS ERROR ON THIS LINE!
TopoDS_Shape t= afillet.Shape(); //***************HAS ERROR ON THIS LINE!
Gan Lu 2012/11/03 02:29
Please someone kindly help..... Many thanks!
PG 2012/11/03 19:50

If u r aware of test harness, u can use the 'chif2d' command to create 2d fillets/chamfer's.
good luck
- PG     
Gan Lu 2012/11/05 14:04
Thanks PG, sorry I didn't see you message! I'm not using the test harness for command-input/display and I'm only using the Opencascade API to program. Do you know which function it will call when it use the 'chif2d' command to create 2d fillets/chamfer's? There is no info on internet or the documentation about this command at all. Thanks!
PG 2012/11/05 14:41

You can look into the implementation of chfi2d in the source area of OCC,
src/BRepTest_Fillet2dCommands.cxx and see the related function.
It used the API BRepFilletAPI_MakeFillet2d.

good luck
Gan Lu 2012/11/05 17:11
Many thanks PG! I have done it. I had tried this method before. The error was that I can't just use the TopExp_Explorer loop to go through the four edges, but have to add the fillets onto the first 3 edges and then add the fillet onto the 1st and the 3rd separately. Thank you PG!
Arjan Schouten 2012/11/03 13:37
Hello Gan Lu,

Your polygon has no thickness, it is just a planar face.
You will first have to give it a thickness, for example extruding it
with MakePrism.

Hope this helps.
Gan Lu 2012/11/03 17:42
Thanks very much for reply, Arjan! What I'm actually doing is trying to use it as 2D, that is build 2D shapes(with fillets) and interpret the polylines using dots and display them through Gnuplot, rather than using 3D display GUI(e.g., qt). Because my focus in only on 2D right now. Is there a simple way I could just add fillets onto the lines in 2D? Many thanks!
Sharjith Naramparambath 2012/11/05 19:16
You must actually use BRepFilletAPI_MakeFillet2d for filleting wires.
Gan Lu 2012/11/05 19:35
Yes, thanks Sharijith. It has been solved and I need to use BRepFilletAPI_MakeFillet2d method. Thank you
Latest news
  • JT Assistant Linux and CAD Assistant
  • Open CASCADE JT Assistant
  • OCCT Applications

  • © OPEN CASCADE 2000 - 2015  |  Search  |  Contacts   |  Site map