43 #include <pybind11/include/pybind11/pybind11.h> 44 #include <pybind11/include/pybind11/embed.h> 47 #include <MeshRepairPlugin.hh> 51 #include <OpenFlipper/BasePlugin/PythonFunctions.hh> 52 #include <OpenFlipper/PythonInterpreter/PythonTypeConversions.hh> 58 PYBIND11_EMBEDDED_MODULE(MeshRepair, m) {
60 QObject* pluginPointer = getPluginPointer(
"MeshRepair");
63 std::cerr <<
"Error Getting plugin pointer for Plugin-MeshRepair" << std::endl;
70 std::cerr <<
"Error converting plugin pointer for Plugin-MeshRepair" << std::endl;
76 py::class_< MeshRepairPlugin,std::unique_ptr<MeshRepairPlugin, py::nodelete> > repair(m,
"MeshRepair");
81 repair.def(py::init([plugin]() {
return plugin; }));
84 QCoreApplication::translate(
"PythonDocMeshRepair",
"Selects all vertices that have valence 3 and the normals of their neighboring faces have an angle less then the given angle").toLatin1().data(),
85 py::arg(QCoreApplication::translate(
"PythonDocMeshRepair",
"ID of the object").toLatin1().data()),
86 py::arg(QCoreApplication::translate(
"PythonDocMeshRepair",
"Maximal angle between the adjacent faces").toLatin1().data()) );
89 QCoreApplication::translate(
"PythonDocMeshRepair",
"Remove all selected valence 3 vertices").toLatin1().data(),
90 py::arg(QCoreApplication::translate(
"PythonDocMeshRepair",
"ID of the object").toLatin1().data()) );
94 QCoreApplication::translate(
"PythonDocMeshRepair",
"Selects all edges of an object which are shorter than the given length").toLatin1().data(),
95 py::arg(QCoreApplication::translate(
"PythonDocMeshRepair",
"ID of the object").toLatin1().data()),
96 py::arg(QCoreApplication::translate(
"PythonDocMeshRepair",
"All edges shorter than this length will be selected").toLatin1().data()) );
99 QCoreApplication::translate(
"PythonDocMeshRepair",
"Selects all edges of an object which are longer than the given length").toLatin1().data(),
100 py::arg(QCoreApplication::translate(
"PythonDocMeshRepair",
"ID of the object").toLatin1().data()),
101 py::arg(QCoreApplication::translate(
"PythonDocMeshRepair",
"All edges longer than this length will be selected").toLatin1().data()) );
104 QCoreApplication::translate(
"PythonDocMeshRepair",
"Remove the selected edges").toLatin1().data(),
105 py::arg(QCoreApplication::translate(
"PythonDocMeshRepair",
"ID of the object").toLatin1().data()) );
108 QCoreApplication::translate(
"PythonDocMeshRepair",
"Select or remove skinny triangles (determined by a minimum angle threshold).").toLatin1().data(),
109 py::arg(QCoreApplication::translate(
"PythonDocMeshRepair",
"ID of the object").toLatin1().data()),
110 py::arg(QCoreApplication::translate(
"PythonDocMeshRepair",
"Minimum angle threshold").toLatin1().data()),
111 py::arg(QCoreApplication::translate(
"PythonDocMeshRepair",
"Remove? (Otherwise they will be selected)").toLatin1().data()));
114 QCoreApplication::translate(
"PythonDocMeshRepair",
"Selects edges that are incident to folded over faces.").toLatin1().data(),
115 py::arg(QCoreApplication::translate(
"PythonDocMeshRepair",
"ID of the object").toLatin1().data()),
116 py::arg(QCoreApplication::translate(
"PythonDocMeshRepair",
"Minimum threshold angle for fold-overs").toLatin1().data()) );
120 QCoreApplication::translate(
"PythonDocMeshRepair",
"Selects all faces that have a larger aspect ratio than the given one.").toLatin1().data(),
121 py::arg(QCoreApplication::translate(
"PythonDocMeshRepair",
"ID of the object").toLatin1().data()),
122 py::arg(QCoreApplication::translate(
"PythonDocMeshRepair",
"The minimal aspect ratio to select").toLatin1().data()) );
125 QCoreApplication::translate(
"PythonDocMeshRepair",
"Flips the normals of all faces by changing the vertex order in each face").toLatin1().data(),
126 py::arg(QCoreApplication::translate(
"PythonDocMeshRepair",
"ID of the object").toLatin1().data()) );
130 QCoreApplication::translate(
"PythonDocMeshRepair",
"Recompute Face normals").toLatin1().data(),
131 py::arg(QCoreApplication::translate(
"PythonDocMeshRepair",
"ID of the object").toLatin1().data()) );
134 QCoreApplication::translate(
"PythonDocMeshRepair",
"Recompute Halfedge normals").toLatin1().data(),
135 py::arg(QCoreApplication::translate(
"PythonDocMeshRepair",
"ID of the object").toLatin1().data()) );
138 QCoreApplication::translate(
"PythonDocMeshRepair",
"Recompute Vertex normals").toLatin1().data(),
139 py::arg(QCoreApplication::translate(
"PythonDocMeshRepair",
"ID of the object").toLatin1().data()) );
142 QCoreApplication::translate(
"PythonDocMeshRepair",
"Recompute Face and Vertex normals").toLatin1().data(),
143 py::arg(QCoreApplication::translate(
"PythonDocMeshRepair",
"ID of the object").toLatin1().data()) );
146 QCoreApplication::translate(
"PythonDocMeshRepair",
"Snaps selected boundary vertices together if they are closer than the given distance. No new vertices will be introduced on either edge, so they are just snapped to existing ones.").toLatin1().data(),
147 py::arg(QCoreApplication::translate(
"PythonDocMeshRepair",
"ID of the object").toLatin1().data()),
148 py::arg(QCoreApplication::translate(
"PythonDocMeshRepair",
"Max snapping distance").toLatin1().data()) );
151 QCoreApplication::translate(
"PythonDocMeshRepair",
"Remove non-manifold vertices by duplicating them").toLatin1().data(),
152 py::arg(QCoreApplication::translate(
"PythonDocMeshRepair",
"ID of the object").toLatin1().data()) );
155 QCoreApplication::translate(
"PythonDocMeshRepair",
"Fix Mesh: Degenerated faces will be removed and all vertices which are closer than the given distance will be collapsed. Non-manifold configurations at vertices will be removed and all faces of each component will be updated to have the same orientation.").toLatin1().data(),
156 py::arg(QCoreApplication::translate(
"PythonDocMeshRepair",
"ID of the object").toLatin1().data()),
157 py::arg(QCoreApplication::translate(
"PythonDocMeshRepair",
"Max snapping distance").toLatin1().data()) );
void detectFlatValence3Vertices(int _objectId, double _angle)
Detect valence 3 vertices with faces that lie in the plane of their adjacent triangles.
void removeSelectedVal3Vertices(int _objectId)
Remove all selected valence 3 vertices.
void updateHalfedgeNormals(int _objectId)
Recomputes the halfedge normals of an object.
void detectSkinnyTriangleByAngle(int _objectId, double _angle, bool _remove)
Detect/Remove edges where neighboring faces form angle > _angle degrees.
void updateFaceNormals(int _objectId)
Recomputes the face normals of an object.
void detectFoldover(int _objectId, float _angle)
Detect folded-over configurations by the dihedral angle.
void fixMesh(int _objectId, double _epsilon)
Fix a mesh.
void updateVertexNormals(int _objectId)
Recomputes the vertex normals of an object.
void selectEdgesLongerThan(int _objectId, double _length)
Selects all edges of an object which are larger than the given length.
void selectEdgesShorterThan(int _objectId, double _length)
Selects all edges of an object which are shorter than the given length.
void removeSelectedEdges(int _objectId)
Removes all selected edges.
void flipOrientation(int _objectId)
Flips the normals of all selected faces by changing the vertex order.
void fixNonManifoldVertices(int _objectId)
remove non-manifold vertices by duplicating them
void detectTriangleAspect(int _objectId, float _aspect)
Detect triangles with aspect ratio greater than _aspect and select them.
void updateNormals(int _objectId)
Recomputes the face and vertex normals of an object.
void snapBoundary(int _objectId, double _eps)
Snaps selected vertices at boundaries.