Interoperability between an OCP object and its C++ equivalent #1571
-
Hello everyone, To provide some context for my question, I have a Python SDK and we are now using OCP, and I'm exploring the possibility of integrating a C++ SDK. In summary, this C++ SDK includes a function that reads a CAD file and ultimately returns a TopoDS_Shape C++ object. In this context, I'm interested in knowing if it's feasible to establish direct interoperability between the C++ TopoDS_Shape object and the pybind11-wrapped TopoDS_Shape object. In other words, I aim to create a pybind11 binding for this C++ function to enable its invocation from Python code and automatically generate an OCP pybind11 TopoDS_Shape object. Is it possible to achieve such a binding? If yes, how can I accomplish this? Specifically, how can I manage the seamless conversion between the C++ TopoDS_Shape object and the OCP pybind11 TopoDS_Shape object? Any insights or examples on this matter would be highly appreciated! Thank you very much for the attention |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
AFAIK it should just work (tm). Example here: https://github.com/NGSolve/netgen/pull/63/files |
Beta Was this translation helpful? Give feedback.
-
You're right!! I should had tested before asking! I did a binding to a C++ function that returns a TopoDS_Shape using pybind11 and on my python code I only needed to import OCP.TopoDS.TopoDS_Shape and when I call the C++ function from my python interpreter it automatically returns me an OCP.TopoDS.TopoDS_Shape. Thank you very much! |
Beta Was this translation helpful? Give feedback.
AFAIK it should just work (tm). Example here: https://github.com/NGSolve/netgen/pull/63/files