43 #include <pybind11/include/pybind11/pybind11.h> 44 #include <pybind11/include/pybind11/embed.h> 50 #include <QCoreApplication> 52 #include <OpenFlipper/BasePlugin/PythonFunctions.hh> 53 #include <OpenFlipper/PythonInterpreter/PythonTypeConversions.hh> 61 PYBIND11_EMBEDDED_MODULE(FileSTL, m) {
63 QObject* pluginPointer = getPluginPointer(
"FileSTL");
66 std::cerr <<
"Error Getting plugin pointer for Plugin-FileSTL" << std::endl;
73 std::cerr <<
"Error converting plugin pointer for Plugin-FileSTL" << std::endl;
79 py::class_< FileSTLPlugin,std::unique_ptr<FileSTLPlugin, py::nodelete> > stl(m,
"FileSTL");
84 stl.def(py::init([plugin]() {
return plugin; }));
89 QCoreApplication::translate(
"PythonDocFileSTL",
"Loads an object and returns its id").toLatin1().data(),
90 py::arg(QCoreApplication::translate(
"PythonDocFileSTL",
"Filename").toLatin1().data()) );
93 stl.def(
"saveObject",
static_cast<bool (
FileSTLPlugin::*)(
int,QString)
>( &FileSTLPlugin::saveObject),
94 QCoreApplication::translate(
"PythonDocFileSTL",
"saves a given object to a file").toLatin1().data(),
95 py::arg(QCoreApplication::translate(
"PythonDocFileSTL",
"Object id to save").toLatin1().data()),
96 py::arg(QCoreApplication::translate(
"PythonDocFileSTL",
"Filename").toLatin1().data()) );
98 stl.def(
"saveObject",
static_cast<bool (
FileSTLPlugin::*)(
int,QString,
const bool,
const std::streamsize)
>( &FileSTLPlugin::saveObject),
99 QCoreApplication::translate(
"PythonDocFileSTL",
"saves a given object to a file").toLatin1().data(),
100 py::arg(QCoreApplication::translate(
"PythonDocFileSTL",
"Object id to save").toLatin1().data()),
101 py::arg(QCoreApplication::translate(
"PythonDocFileSTL",
"Filename").toLatin1().data()),
102 py::arg(QCoreApplication::translate(
"PythonDocFileSTL",
"Binary mode?").toLatin1().data()),
103 py::arg(QCoreApplication::translate(
"PythonDocFileSTL",
"Precision").toLatin1().data()) = 6 );
int loadObject(QString _filename)
Loads Object as triangle mesh.