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

Search the Forums
See All Topics
Open CASCADEShowroomGet it!Developer CornerSupport and ProductsAbout us
Technical overview
Areas of use
Advantages
FAQ
Screenshots
Shape factory
Shape gallery
Demonstrations
What's new
System requirements
Download Center
Public license
Documentation
Getting started
Forums
Open Source community
Training and e-learning
A-la Carte Support
Value-added software
Complementary Components
Customer Corner
Company Profile
Marketing Materials
Contact Us
News
Home / Developer Corner / Forums / pythonOCC / making a solid out of a shell with PythonOCC

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
  • Open CASCADE Technology 6.7.0 is available for download!
  • Open CASCADE Technology 6.6.0 is available for download!
  • Open CASCADE Technology 6.5.5 is available for download!

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