Closing a BSplineSurface to form a solid

Hi,

I have generated a BSplineSurface in the form of a hemisphere. The bottom is open, and I would like to close it. I attached top and bottom views of the surface.

I need to use this surface in a CSG operation, basically adding it to a 'box' (using BRepPrimAPI_MakeBox). But in order to do this, I need to make a solid out of my surface.

I made a disk-shaped 'cap' out of the points along the bottom opening used to create the BSplineSurface.
I have tried two ways:
- create a polygon out of the points along the edge
- create another BSplineSurface out of those same points.

Now in order to get a solid out of this, I first need a closed shell. I have tried the sewing and fuse algos, and both generate a TopoDS_Compound instead of a TopoDS_Shell:
#test 1: sewing
sew = BRepBuilderAPI_Sewing()
sew.Add(face1) # the hemisphere bspline surface as a TopoDS_Face
sew.Add(face2) # the end cap bspline surface or polygon, also as a TopoDS_Face
sew.Perform()
shp = sew.SewedShape()
shell = topods.Shell(shp) # error here, shp is not a shell but a TopoDS_Compound

#test 2: fusing
fuse_shp = BRepAlgoAPI_Fuse(face1, face2).Shape()
shell = topods.Shell(fuse_shp) # same error here, fuse_shp is not a shell but a TopoDS_Compound

Granted, the fit between the endcap and the hemisphere has some small gaps, but I was hoping that the algorithms would fill them up.

Clearly there is something wrong with my strategy here. Is this not the proper way to do this? What would be the proper way? I am still quite new to opencascade.

thanks for your help,

Louis

Frank Martinez's picture

Have you tried basic shape builders?


TopoDS_Shell shell{}; TopoDS_Builder builder{}; builder.MakeShell(shell); builder.Add(shell, face1); builder.Add(shell, face2); BRep_Builder B; TopoDS_Solid solid; B.MakeSolid(solid); B.Add(solid, shell);