Spherical faces in STEP

Hi,
While working on my project, I discovered that spherical faces from STEP aren't read back in to OCC. The edges are present, but no face is displayed. I put together a quick program that would create a Sphere and a Box, fuse them together and write them out to STEP. After I ran it and read it back in, through OCC import/export, the Spere did not have any faces associated with it. As a result I had a box with a hole in it, and the edges that outlined a sphere, without the actual sphere. Seeing how that is pretty much what I was getting originally, I wonder if it is a known issue. Or maybe someone had a similar problem before.
Here is the code that I used:

#include
#include
#include
#include
#include
#include
#include

#include
#include

#define STEP_FILENAME "./spherical_surface.stp"
class SphereTests
{
public:

TopoDS_Shape makeSphere()
{
BRepPrimAPI_MakeSphere buildS(5.0);
TopoDS_Solid sphere = buildS.Solid();

BRepPrimAPI_MakeBox buildB(20.0, 30.0, 20.0);
TopoDS_Solid box = buildB.Solid();

return BRepAlgoAPI_Cut(box,sphere);
}

void writeOut(TopoDS_Shape& shape)
{
Handle(STEPControl_Controller) controller= new STEPControl_Controller;
controller->Init();
STEPControl_Writer writer;
writer.Transfershape,STEPControl_ManifoldSolidBrep);
writer.Write(STEP_FILENAME);
}
};

Thanks for your help!

timon_oblom's picture

Playing around with it a little more, it turns out that this problem only occurs when the center of the shpere is on any of the edges of the box. If it is not, then the rendering is done fine(I can see a part of the shpere as a face, not a gaping hole in the box). Still not a clue about those edge cases, no pun intended.

timon_oblom's picture

One more thing I just noticed. The code should read
return BRepAlgoAPI_Fuse(box,sphere);

I was just trying to see what I will get if I use Cut, and that seemed to work OK.