2011/5/22 Csanády István <istvancsan...@gmail.com>

> OK, I have figured out the answer to my last question -  I did not
> know that STANDARD_TYPE(Classname) simply creates a cstring from the
> class' name. However I have another question. Is it possible to
> integrate a pythonocc code with a C++ code? I want to write the
> modeling logic in python, and the rendering and other stuff in C++. So
> is it possible somehow to get a TopoDS object from python in a C++
> code?
>
> Thanks,
> Istvan
>
>
Hi Istvan,

IMO, the easiest way to exchange TopoDS shapes between python/C++ is to use
the .brep serialization. You can easily export any TopoDS_Shape from python
with the pickle module to a file 'my_shape.brep' and pass it to your c++ app
that will import it. Note that you won't loose any information unlike using
the STEP or IGES file format.

You can have a look at the TopoDS_Shape_pickling example (
http://code.google.com/p/pythonocc/source/browse/trunk/src/examples/Level1/Serialization/TopoDS_Shape_pickling.py).


Details about the implementation of TopoDS_Shape pickling with pythonn is
available at lines 925--944 of the SWIG_generator.py file (
http://code.google.com/p/pythonocc/source/browse/trunk/src/wrapper/SWIG_generator.py).
It can easily be ported to C++.

Best Regards,

Thomas
_______________________________________________
Pythonocc-users mailing list
Pythonocc-users@gna.org
https://mail.gna.org/listinfo/pythonocc-users

Reply via email to