Fri, 01/22/2010 - 14:20
Forums:
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
Fri, 01/22/2010 - 17:11
I get following error:
TypeError: in method 'new_BRepBuilderAPI_MakeSolid', argument 1 of type 'TopoDS_Solid const &'
Fri, 01/22/2010 - 18: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
Fri, 01/22/2010 - 18: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?