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

Search the Forums
See All Topics
 

making a solid out of a shell with PythonOCC

making a solid out of a shell with PythonOCC
adrenalin123 2010/01/22 12:20
Hello Together!
I am using PythonOCC with my modelling an I try to make a Solid out of a Shell.
Here a fragment of my code:

sewing = BRepBuilderAPI_Sewing()

for i in range(14):
sewing.Add(faces[i])

sewing.Perform()
sewed_shape = sewing.SewedShape()
# It works fine until here, and I can display the shell

solid = BRepBuilderAPI_MakeSolid(sewing)

I tried to make the solid out of the original sewing and out of the sewed shape.
Neither works. Can anybody help me, please?

Bye, Martin
adrenalin123 2010/01/22 15:11
I get following error:

TypeError: in method 'new_BRepBuilderAPI_MakeSolid', argument 1 of type 'TopoDS_Solid const &'
Thomas Paviot 2010/01/22 16:06
adrenalin123,

The prototype for the BRepBuilderAPI_MakeSolid method is (just type help(BRepBuilderAPI_MakeSolid)):
__init__(self, TopoDS_CompSolid S) -> BRepBuilderAPI_MakeSolid
__init__(self, TopoDS_Shell S) -> BRepBuilderAPI_MakeSolid
__init__(self, TopoDS_Shell S1, TopoDS_Shell S2) -> BRepBuilderAPI_MakeSolid
__init__(self, TopoDS_Shell S1, TopoDS_Shell S2, TopoDS_Shell S3) -> BRepBuilderAPI_MakeSolid
__init__(self, TopoDS_Solid So) -> BRepBuilderAPI_MakeSolid
__init__(self, TopoDS_Solid So, TopoDS_Shell S) -> BRepBuilderAPI_MakeSolid

That is to say, you first have to convert the sewed shape to a Shell.

Here is your code corrected:

sewing = BRepBuilderAPI_Sewing()

for i in range(14):
sewing.Add(faces[i])

sewing.Perform()
sewed_shape = sewing.SewedShape()
# It works fine until here, and I can display the shell

from OCC.TopoDS import *
tds = TopoDS()

solid = BRepBuilderAPI_MakeSolid(tds.Shell(sewed_shape))

I guess it should work (not tested).

Regards,

Thomas
adrenalin123 2010/01/22 16:50
Thank you very much! It worked! I thought, sewing faces already returns a shell.
If I use ShapeType() on the sewed_shape, it says: this is a shell (enumeration 3)
For some reason, the MakeSolid does not take this shell.
If I use ShapeType() on the converted shape, it also says: this is a shell. But what is the difference between both of them?
 
 
Latest news
  • OCCT Applications
  • Open CASCADE Technology 6.8.0 is available for download!
  • New features to enhance the development process

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