Skip to content
Snippets Groups Projects
Commit ae9d9cb4 authored by Jan Möbius's avatar Jan Möbius
Browse files

Edge operations for python

parent fb1368eb
No related branches found
No related tags found
No related merge requests found
......@@ -85,6 +85,10 @@ PYBIND11_EMBEDDED_MODULE(MeshObjectSelection, m) {
py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","ID of the object").toLatin1().data()),
py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","File containing a selection").toLatin1().data()) );
//==========================================
// Vertex OPERATIONS
//==========================================
select.def("selectVertices", &MeshObjectSelectionPlugin::selectVertices,
QCoreApplication::translate("PythonDocMeshObjectSelection","Select the specified vertices").toLatin1().data(),
py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","ID of the object").toLatin1().data()),
......@@ -186,9 +190,6 @@ PYBIND11_EMBEDDED_MODULE(MeshObjectSelection, m) {
py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","ID of the object").toLatin1().data()),
py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","List of vertices").toLatin1().data()) );
void selectVerticesByValue(int _objectId, QString _component, bool _greater, double _value );
select.def("selectVerticesByValue", static_cast<void (MeshObjectSelectionPlugin::*)(int,QString,bool,double)> (&MeshObjectSelectionPlugin::selectVerticesByValue),
QCoreApplication::translate("PythonDocMeshObjectSelection","Select vertices based on the value of their component").toLatin1().data(),
py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","ID of the object").toLatin1().data()),
......@@ -208,49 +209,77 @@ PYBIND11_EMBEDDED_MODULE(MeshObjectSelection, m) {
QCoreApplication::translate("PythonDocMeshObjectSelection","Get a list of all modeling vertices").toLatin1().data(),
py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","ID of the object").toLatin1().data()) );
//==========================================
// EDGE OPERATIONS
//==========================================
select.def("selectEdges", &MeshObjectSelectionPlugin::selectEdges,
QCoreApplication::translate("PythonDocMeshObjectSelection","Select the specified edges").toLatin1().data(),
py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","ID of the object").toLatin1().data()),
py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","List of vertices").toLatin1().data()),
py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","Maximal dihedral ange for selection").toLatin1().data()) = 0.0);
select.def("unselectEdges", &MeshObjectSelectionPlugin::unselectEdges,
QCoreApplication::translate("PythonDocMeshObjectSelection","Unselect the specified edges").toLatin1().data(),
py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","ID of the object").toLatin1().data()),
py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","List of vertices").toLatin1().data()) );
select.def("selectAllEdges", &MeshObjectSelectionPlugin::selectAllEdges,
QCoreApplication::translate("PythonDocMeshObjectSelection","Select all edges of an object").toLatin1().data(),
py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","ID of the object").toLatin1().data()) );
select.def("invertEdgeSelection", &MeshObjectSelectionPlugin::invertEdgeSelection,
QCoreApplication::translate("PythonDocMeshObjectSelection","Invert edge selection of an object").toLatin1().data(),
py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","ID of the object").toLatin1().data()) );
select.def("clearEdgeSelection", &MeshObjectSelectionPlugin::clearEdgeSelection,
QCoreApplication::translate("PythonDocMeshObjectSelection","Clear edge selection of an object").toLatin1().data(),
py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","ID of the object").toLatin1().data()) );
select.def("selectBoundaryEdges", &MeshObjectSelectionPlugin::selectBoundaryEdges,
QCoreApplication::translate("PythonDocMeshObjectSelection","Select all boundary edges of an object").toLatin1().data(),
py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","ID of the object").toLatin1().data()) );
select.def("selectBoundaryEdges", &MeshObjectSelectionPlugin::selectBoundaryEdges,
QCoreApplication::translate("PythonDocMeshObjectSelection","Select all boundary edges of an object").toLatin1().data(),
py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","ID of the object").toLatin1().data()) );
select.def("deleteEdgeSelection", &MeshObjectSelectionPlugin::deleteEdgeSelection,
QCoreApplication::translate("PythonDocMeshObjectSelection","Delete selected edges of an object").toLatin1().data(),
py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","ID of the object").toLatin1().data()) );
select.def("getEdgeSelection", &MeshObjectSelectionPlugin::getEdgeSelection,
QCoreApplication::translate("PythonDocMeshObjectSelection","Return a list of all selected edges").toLatin1().data(),
py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","ID of the object").toLatin1().data()) );
select.def("convertEdgesToVertexPairs", &MeshObjectSelectionPlugin::convertEdgesToVertexPairs,
QCoreApplication::translate("PythonDocMeshObjectSelection","Convert edge ids to vertex pair ids. Returns vertex Idlist.").toLatin1().data(),
py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","ID of the object").toLatin1().data()),
py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","List of edges").toLatin1().data()));
select.def("convertVertexPairsToEdges", &MeshObjectSelectionPlugin::convertVertexPairsToEdges,
QCoreApplication::translate("PythonDocMeshObjectSelection","Convert vertex pair ids to edge ids. Returns edge Idlist.").toLatin1().data(),
py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","ID of the object").toLatin1().data()),
py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","Ids of paired vertices").toLatin1().data()));
select.def("createMeshFromEdgeSelection", &MeshObjectSelectionPlugin::createMeshFromEdgeSelection,
QCoreApplication::translate("PythonDocMeshObjectSelection","Take edge selection of an object and create a new mesh from it").toLatin1().data(),
py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","ID of the object").toLatin1().data()) );
select.def("colorizeEdgeSelection", &MeshObjectSelectionPlugin::colorizeEdgeSelection,
QCoreApplication::translate("PythonDocMeshObjectSelection","Colorize the selected edges").toLatin1().data(),
py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","ID of the object").toLatin1().data()),
py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","Red color component").toLatin1().data()),
py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","Green color component").toLatin1().data()),
py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","Blue color component").toLatin1().data()),
py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","Alpha color component").toLatin1().data()) );
select.def("traceEdgePath", &MeshObjectSelectionPlugin::traceEdgePath,
QCoreApplication::translate("PythonDocMeshObjectSelection","Traces Edge Paths. Takes all selected edges and tries to continue them, as long as the angle between edges is not above threshold").toLatin1().data(),
py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","ID of the object").toLatin1().data()),
py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","Threshold").toLatin1().data()));
// //==========================================
// // EDGE OPERATIONS
// //==========================================
//
// /// Select given Edges
// void selectEdges(int objectId, IdList _edgeList, const double _dihedral_angle_threshold = 0.0);
//
// /// Unselect given Edges
// void unselectEdges(int objectId, IdList _edgeList);
//
// /// Select all Edges
// void selectAllEdges(int objectId);
//
// /// Unselect all Edges
// void invertEdgeSelection(int objectId);
//
// /// Invert the current edge selection
// void clearEdgeSelection(int objectId);
//
// /// select boundary edges
// void selectBoundaryEdges(int objectId);
//
// /// Delete edges that are currently selected
// void deleteEdgeSelection(int _objectId);
//
// /// Return a list of all selected edges
// IdList getEdgeSelection(int objectId);
//
// /// Convert edge ids to vertex pairs
// IdList convertEdgesToVertexPairs(int _id, const IdList& _edges);
//
// /// Inverse of function above
// IdList convertVertexPairsToEdges(int _id, const IdList& _vertices);
//
// /// Create a mesh containing the face selection of the given mesh
// int createMeshFromEdgeSelection( int _objectId);
//
// /// Colorize the edge selection
// void colorizeEdgeSelection(int objectId, int r, int g, int b, int a);
//
// /// Trace Edge Path
// void traceEdgePath(int objectId, double threshold);
//
// //==========================================
// // HALFEDGE OPERATIONS
......@@ -344,24 +373,8 @@ PYBIND11_EMBEDDED_MODULE(MeshObjectSelection, m) {
//
//
// emit setSlotDescription("selectEdges(int,IdList)", tr("Select the specified edges"),
// QString("objectId,edgeList").split(","), QString("Id of an object,List of edges").split(","));
// emit setSlotDescription("unselectEdges(int,IdList)", tr("Unselect the specified edges"),
// QString("objectId,edgeList").split(","), QString("Id of an object,List of edges").split(","));
// emit setSlotDescription("selectAllEdges(int)", tr("Select all edges of an object"),
// QStringList("objectId"), QStringList("Id of an object"));
// emit setSlotDescription("invertEdgeSelection(int)", tr("Invert edge selection of an object"),
// QStringList("objectId"), QStringList("Id of an object"));
// emit setSlotDescription("clearEdgeSelection(int)", tr("Clear edge selection of an object"),
// QStringList("objectId"), QStringList("Id of an object"));
// emit setSlotDescription("selectBoundaryEdges(int)", tr("Select all boundary edges of an object"),
// QStringList("objectId"), QStringList("Id of an object"));
//
// emit setSlotDescription("colorizeEdgeSelection(int,int,int,int)", tr("Colorize the selected edges"),
// QString("objectId,r,g,b").split(","), QString("Id of an object,Red,Green,Blue").split(","));
// emit setSlotDescription("createMeshFromEdgeSelection(int)", tr("Take edge selection and create a new mesh from it"),
// QString("objectId").split(","), QString("Id of an object where the selection should be used to create a new mesh").split(","));
//
// emit setSlotDescription("selectHalfedges(int,IdList)", tr("Select the specified halfedges"),
// QString("objectId,halfedgeList").split(","), QString("Id of an object,List of halfedges").split(","));
// emit setSlotDescription("unselectHalfedges(int,IdList)", tr("Unselect the specified halfedges"),
......@@ -412,64 +425,14 @@ PYBIND11_EMBEDDED_MODULE(MeshObjectSelection, m) {
// emit setSlotDescription("conversion(QString,QString,bool)", tr("Convert selection on all target Objects.")+conversionStrings,
// QString("from,to,deselect").split(","), QString("string of selection which will be converted,resulting selection region or feature,deselect selection after conversion").split(","));
//
// emit setSlotDescription("convertEdgesToVertexPairs(int,IdList)", tr("Convert edge ids to vertex pair ids. Returns vertex Idlist."),
// QString("objectId, edgeIds").split(","), QString("Id of an object, Ids of edges").split(","));
// emit setSlotDescription("convertHalfedgesToVertexPairs(int,IdList)", tr("Convert halfedge ids to vertex pair ids. Returns vertex Idlist."),
// QString("objectId, halfedgeIds").split(","), QString("Id of an object, Ids of halfedges").split(","));
//
// emit setSlotDescription("convertVertexPairsToHalfedges(int,IdList)", tr("Convert vertex pair ids to halfedge ids. Returns halfedge Idlist."),
// QString("objectId, vertexIds").split(","), QString("Id of an object, Ids of paired vertices").split(","));
// emit setSlotDescription("convertVertexPairsToEdges(int,IdList)", tr("Convert vertex pair ids to edge ids. Returns edge Idlist."),
// QString("objectId, vertexIds").split(","), QString("Id of an object, Ids of paired vertices").split(","));
// repair.def("detectFlatValence3Vertices", &MeshObjectSelectionPlugin::detectFlatValence3Vertices,
// QCoreApplication::translate("PythonDocMeshObjectSelection","Selects all vertices that have valence 3 and the normals of their neighboring faces have an angle less then the given angle").toLatin1().data(),
// py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","ID of the object").toLatin1().data()),
// py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","Maximal angle between the adjacent faces").toLatin1().data()) );
//
// repair.def("removeSelectedVal3Vertices", &MeshObjectSelectionPlugin::removeSelectedVal3Vertices,
// QCoreApplication::translate("PythonDocMeshObjectSelection","Remove all selected valence 3 vertices").toLatin1().data(),
// py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","ID of the object").toLatin1().data()) );
//
//
// repair.def("selectEdgesShorterThan", &MeshObjectSelectionPlugin::selectEdgesShorterThan,
// QCoreApplication::translate("PythonDocMeshObjectSelection","Selects all edges of an object which are shorter than the given length").toLatin1().data(),
// py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","ID of the object").toLatin1().data()),
// py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","All edges shorter than this length will be selected").toLatin1().data()) );
//
// repair.def("selectEdgesLongerThan", &MeshObjectSelectionPlugin::selectEdgesLongerThan,
// QCoreApplication::translate("PythonDocMeshObjectSelection","Selects all edges of an object which are longer than the given length").toLatin1().data(),
// py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","ID of the object").toLatin1().data()),
// py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","All edges longer than this length will be selected").toLatin1().data()) );
//
// repair.def("removeSelectedEdges", &MeshObjectSelectionPlugin::removeSelectedEdges,
// QCoreApplication::translate("PythonDocMeshObjectSelection","Remove the selected edges").toLatin1().data(),
// py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","ID of the object").toLatin1().data()) );
//
// repair.def("detectSkinnyTriangleByAngle", &MeshObjectSelectionPlugin::detectSkinnyTriangleByAngle,
// QCoreApplication::translate("PythonDocMeshObjectSelection","Select or remove skinny triangles (determined by a minimum angle threshold).").toLatin1().data(),
// py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","ID of the object").toLatin1().data()),
// py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","Minimum angle threshold").toLatin1().data()),
// py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","Remove? (Otherwise they will be selected)").toLatin1().data()));
//
// repair.def("detectFoldover", &MeshObjectSelectionPlugin::detectFoldover,
// QCoreApplication::translate("PythonDocMeshObjectSelection","Selects edges that are incident to folded over faces.").toLatin1().data(),
// py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","ID of the object").toLatin1().data()),
// py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","Minimum threshold angle for fold-overs").toLatin1().data()) );
//
//
// repair.def("detectTriangleAspect", &MeshObjectSelectionPlugin::detectTriangleAspect,
// QCoreApplication::translate("PythonDocMeshObjectSelection","Selects all faces that have a larger aspect ratio than the given one.").toLatin1().data(),
// py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","ID of the object").toLatin1().data()),
// py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","The minimal aspect ratio to select").toLatin1().data()) );
//
// repair.def("flipOrientation", static_cast<void (MeshObjectSelectionPlugin::*) (int)>(&MeshObjectSelectionPlugin::flipOrientation),
// QCoreApplication::translate("PythonDocMeshObjectSelection","Flips the normals of all faces by changing the vertex order in each face").toLatin1().data(),
// py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","ID of the object").toLatin1().data()) );
//
//
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment