Developer Documentation

Python.cc
1
2 /*===========================================================================*\
3 * *
4 * OpenFlipper *
5 * Copyright (c) 2001-2015, RWTH-Aachen University *
6 * Department of Computer Graphics and Multimedia *
7 * All rights reserved. *
8 * www.openflipper.org *
9 * *
10 *---------------------------------------------------------------------------*
11 * This file is part of OpenFlipper. *
12 *---------------------------------------------------------------------------*
13 * *
14 * Redistribution and use in source and binary forms, with or without *
15 * modification, are permitted provided that the following conditions *
16 * are met: *
17 * *
18 * 1. Redistributions of source code must retain the above copyright notice, *
19 * this list of conditions and the following disclaimer. *
20 * *
21 * 2. Redistributions in binary form must reproduce the above copyright *
22 * notice, this list of conditions and the following disclaimer in the *
23 * documentation and/or other materials provided with the distribution. *
24 * *
25 * 3. Neither the name of the copyright holder nor the names of its *
26 * contributors may be used to endorse or promote products derived from *
27 * this software without specific prior written permission. *
28 * *
29 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
30 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
31 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
32 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER *
33 * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, *
34 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, *
35 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
36 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
37 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
38 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
39 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
40 * *
41 \*===========================================================================*/
42
43 #include <pybind11/include/pybind11/pybind11.h>
44 #include <pybind11/include/pybind11/embed.h>
45
46
47 #include <MeshObjectSelectionPlugin.hh>
48 #include <QString>
49 #include <QChar>
50
51 #include <OpenFlipper/BasePlugin/PythonFunctions.hh>
52 #include <OpenFlipper/PythonInterpreter/PythonTypeConversions.hh>
53
54 namespace py = pybind11;
55
56
57
58 PYBIND11_EMBEDDED_MODULE(MeshObjectSelection, m) {
59
60 QObject* pluginPointer = getPluginPointer("MeshObjectSelection");
61
62 if (!pluginPointer) {
63 std::cerr << "Error Getting plugin pointer for Plugin-MeshObjectSelection" << std::endl;
64 return;
65 }
66
67 MeshObjectSelectionPlugin* plugin = qobject_cast<MeshObjectSelectionPlugin*>(pluginPointer);
68
69 if (!plugin) {
70 std::cerr << "Error converting plugin pointer for Plugin-MeshObjectSelection" << std::endl;
71 return;
72 }
73
74 // Export our core. Make sure that the c++ worlds core object is not deleted if
75 // the python side gets deleted!!
76 py::class_< MeshObjectSelectionPlugin,std::unique_ptr<MeshObjectSelectionPlugin, py::nodelete> > select(m, "MeshObjectSelection");
77
78 // On the c++ side we will just return the existing core instance
79 // and prevent the system to recreate a new core as we need
80 // to work on the existing one.
81 select.def(py::init([plugin]() { return plugin; }));
82
83 select.def("loadSelection", &MeshObjectSelectionPlugin::loadSelection,
84 QCoreApplication::translate("PythonDocMeshObjectSelection","Load selection from selection file").toLatin1().data(),
85 py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","ID of the object").toLatin1().data()),
86 py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","File containing a selection").toLatin1().data()) );
87
88 //==========================================
89 // Vertex OPERATIONS
90 //==========================================
91
92 select.def("selectVertices", &MeshObjectSelectionPlugin::selectVertices,
93 QCoreApplication::translate("PythonDocMeshObjectSelection","Select the specified vertices").toLatin1().data(),
94 py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","ID of the object").toLatin1().data()),
95 py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","List of vertices").toLatin1().data()) );
96
97 select.def("unselectVertices", &MeshObjectSelectionPlugin::unselectVertices,
98 QCoreApplication::translate("PythonDocMeshObjectSelection","Unselect the specified vertices").toLatin1().data(),
99 py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","ID of the object").toLatin1().data()),
100 py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","List of vertices").toLatin1().data()) );
101
102 select.def("selectAllVertices", &MeshObjectSelectionPlugin::selectAllVertices,
103 QCoreApplication::translate("PythonDocMeshObjectSelection","Select all vertices of an object").toLatin1().data(),
104 py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","ID of the object").toLatin1().data()) );
105
106 select.def("clearVertexSelection", &MeshObjectSelectionPlugin::clearVertexSelection,
107 QCoreApplication::translate("PythonDocMeshObjectSelection","Clear vertex selection of an object").toLatin1().data(),
108 py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","ID of the object").toLatin1().data()) );
109
110 select.def("invertVertexSelection", &MeshObjectSelectionPlugin::invertVertexSelection,
111 QCoreApplication::translate("PythonDocMeshObjectSelection","Invert vertex selection of an object").toLatin1().data(),
112 py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","ID of the object").toLatin1().data()) );
113
114 select.def("selectBoundaryVertices", &MeshObjectSelectionPlugin::selectBoundaryVertices,
115 QCoreApplication::translate("PythonDocMeshObjectSelection","Select all boundary vertices of an object").toLatin1().data(),
116 py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","ID of the object").toLatin1().data()) );
117
118 select.def("selectClosestBoundaryVertices", &MeshObjectSelectionPlugin::selectClosestBoundaryVertices,
119 QCoreApplication::translate("PythonDocMeshObjectSelection","Select boundary vertices closest to a specific vertex").toLatin1().data(),
120 py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","ID of the object").toLatin1().data()),
121 py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","Id of closest vertex").toLatin1().data()) );
122
123 select.def("shrinkVertexSelection", &MeshObjectSelectionPlugin::shrinkVertexSelection,
124 QCoreApplication::translate("PythonDocMeshObjectSelection","Shrink vertex selection by outer selection ring").toLatin1().data(),
125 py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","ID of the object").toLatin1().data()) );
126
127 select.def("growVertexSelection", &MeshObjectSelectionPlugin::growVertexSelection,
128 QCoreApplication::translate("PythonDocMeshObjectSelection","Grow vertex selection by an-ring of selection").toLatin1().data(),
129 py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","ID of the object").toLatin1().data()) );
130
131 select.def("deleteVertexSelection", &MeshObjectSelectionPlugin::deleteVertexSelection,
132 QCoreApplication::translate("PythonDocMeshObjectSelection","Delete selected vertices").toLatin1().data(),
133 py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","ID of the object").toLatin1().data()) );
134
135 select.def("getVertexSelection", &MeshObjectSelectionPlugin::getVertexSelection,
136 QCoreApplication::translate("PythonDocMeshObjectSelection","Return a list of all selected vertices").toLatin1().data(),
137 py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","ID of the object").toLatin1().data()) );
138
139 select.def("createMeshFromVertexSelection", &MeshObjectSelectionPlugin::createMeshFromVertexSelection,
140 QCoreApplication::translate("PythonDocMeshObjectSelection","Create a mesh from the seslected vertices. Returns the Id of the new mesh").toLatin1().data(),
141 py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","ID of the object").toLatin1().data()) );
142
143 select.def("colorizeVertexSelection", &MeshObjectSelectionPlugin::colorizeVertexSelection,
144 QCoreApplication::translate("PythonDocMeshObjectSelection","Colorize the selected vertices").toLatin1().data(),
145 py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","ID of the object").toLatin1().data()),
146 py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","Red color component").toLatin1().data()),
147 py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","Green color component").toLatin1().data()),
148 py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","Blue color component").toLatin1().data()),
149 py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","Alpha color component").toLatin1().data()) );
150
151 select.def("selectHandleVertices", &MeshObjectSelectionPlugin::selectHandleVertices,
152 QCoreApplication::translate("PythonDocMeshObjectSelection","Add specified vertices to handle area").toLatin1().data(),
153 py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","ID of the object").toLatin1().data()),
154 py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","List of vertices").toLatin1().data()) );
155
156 select.def("unselectHandleVertices", &MeshObjectSelectionPlugin::selectHandleVertices,
157 QCoreApplication::translate("PythonDocMeshObjectSelection","Remove specified vertices from handle area").toLatin1().data(),
158 py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","ID of the object").toLatin1().data()),
159 py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","List of vertices").toLatin1().data()) );
160
161 select.def("clearHandleVertices", &MeshObjectSelectionPlugin::clearHandleVertices,
162 QCoreApplication::translate("PythonDocMeshObjectSelection","Clear handle area").toLatin1().data(),
163 py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","ID of the object").toLatin1().data()) );
164
165 select.def("setAllHandleVertices", &MeshObjectSelectionPlugin::setAllHandleVertices,
166 QCoreApplication::translate("PythonDocMeshObjectSelection","Add all vertices of an object to handle area").toLatin1().data(),
167 py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","ID of the object").toLatin1().data()) );
168
169 select.def("getHandleVertices", &MeshObjectSelectionPlugin::getHandleVertices,
170 QCoreApplication::translate("PythonDocMeshObjectSelection","Get a list of vertices belonging to handle area").toLatin1().data(),
171 py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","ID of the object").toLatin1().data()) );
172
173 select.def("loadFlipperModelingSelection", &MeshObjectSelectionPlugin::loadFlipperModelingSelection,
174 QCoreApplication::translate("PythonDocMeshObjectSelection","Load selection from Flipper selection file").toLatin1().data(),
175 py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","ID of the object").toLatin1().data()),
176 py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","Flipper selection file").toLatin1().data()) );
177
178 select.def("saveFlipperModelingSelection", &MeshObjectSelectionPlugin::saveFlipperModelingSelection,
179 QCoreApplication::translate("PythonDocMeshObjectSelection","Load selection from Flipper selection file").toLatin1().data(),
180 py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","ID of the object").toLatin1().data()),
181 py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","Flipper selection file").toLatin1().data()) );
182
183 select.def("selectModelingVertices", &MeshObjectSelectionPlugin::selectModelingVertices,
184 QCoreApplication::translate("PythonDocMeshObjectSelection","Add specified vertices to modeling area").toLatin1().data(),
185 py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","ID of the object").toLatin1().data()),
186 py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","List of vertices").toLatin1().data()) );
187
188 select.def("unselectModelingVertices", &MeshObjectSelectionPlugin::unselectModelingVertices,
189 QCoreApplication::translate("PythonDocMeshObjectSelection","Remove specified vertices to modeling area").toLatin1().data(),
190 py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","ID of the object").toLatin1().data()),
191 py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","List of vertices").toLatin1().data()) );
192
193 select.def("selectVerticesByValue", static_cast<void (MeshObjectSelectionPlugin::*)(int,QString,bool,double)> (&MeshObjectSelectionPlugin::selectVerticesByValue),
194 QCoreApplication::translate("PythonDocMeshObjectSelection","Select vertices based on the value of their component").toLatin1().data(),
195 py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","ID of the object").toLatin1().data()),
196 py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","component specification: string containing \"x\" or \"y\" or \"z\" ").toLatin1().data()),
197 py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","select vertex if component greater than value; false: select if component less than value").toLatin1().data()),
198 py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","value to test").toLatin1().data()) );
199
200 select.def("clearModelingVertices", &MeshObjectSelectionPlugin::clearModelingVertices,
201 QCoreApplication::translate("PythonDocMeshObjectSelection","Clear modeling area").toLatin1().data(),
202 py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","ID of the object").toLatin1().data()) );
203
204 select.def("setAllModelingVertices", &MeshObjectSelectionPlugin::setAllModelingVertices,
205 QCoreApplication::translate("PythonDocMeshObjectSelection","Add all vertices of an object to modeling area").toLatin1().data(),
206 py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","ID of the object").toLatin1().data()) );
207
208 select.def("getModelingVertices", &MeshObjectSelectionPlugin::getModelingVertices,
209 QCoreApplication::translate("PythonDocMeshObjectSelection","Get a list of all modeling vertices").toLatin1().data(),
210 py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","ID of the object").toLatin1().data()) );
211
212 //==========================================
213 // EDGE OPERATIONS
214 //==========================================
215
216
217 select.def("selectEdges", &MeshObjectSelectionPlugin::selectEdges,
218 QCoreApplication::translate("PythonDocMeshObjectSelection","Select the specified edges").toLatin1().data(),
219 py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","ID of the object").toLatin1().data()),
220 py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","List of vertices").toLatin1().data()),
221 py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","Maximal dihedral ange for selection").toLatin1().data()) = 0.0);
222
223 select.def("unselectEdges", &MeshObjectSelectionPlugin::unselectEdges,
224 QCoreApplication::translate("PythonDocMeshObjectSelection","Unselect the specified edges").toLatin1().data(),
225 py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","ID of the object").toLatin1().data()),
226 py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","List of edges").toLatin1().data()) );
227
228 select.def("selectAllEdges", &MeshObjectSelectionPlugin::selectAllEdges,
229 QCoreApplication::translate("PythonDocMeshObjectSelection","Select all edges of an object").toLatin1().data(),
230 py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","ID of the object").toLatin1().data()) );
231
232 select.def("invertEdgeSelection", &MeshObjectSelectionPlugin::invertEdgeSelection,
233 QCoreApplication::translate("PythonDocMeshObjectSelection","Invert edge selection of an object").toLatin1().data(),
234 py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","ID of the object").toLatin1().data()) );
235
236 select.def("clearEdgeSelection", &MeshObjectSelectionPlugin::clearEdgeSelection,
237 QCoreApplication::translate("PythonDocMeshObjectSelection","Clear edge selection of an object").toLatin1().data(),
238 py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","ID of the object").toLatin1().data()) );
239
240 select.def("selectBoundaryEdges", &MeshObjectSelectionPlugin::selectBoundaryEdges,
241 QCoreApplication::translate("PythonDocMeshObjectSelection","Select all boundary edges of an object").toLatin1().data(),
242 py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","ID of the object").toLatin1().data()) );
243
244 select.def("selectBoundaryEdges", &MeshObjectSelectionPlugin::selectBoundaryEdges,
245 QCoreApplication::translate("PythonDocMeshObjectSelection","Select all boundary edges of an object").toLatin1().data(),
246 py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","ID of the object").toLatin1().data()) );
247
248 select.def("deleteEdgeSelection", &MeshObjectSelectionPlugin::deleteEdgeSelection,
249 QCoreApplication::translate("PythonDocMeshObjectSelection","Delete selected edges of an object").toLatin1().data(),
250 py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","ID of the object").toLatin1().data()) );
251
252 select.def("getEdgeSelection", &MeshObjectSelectionPlugin::getEdgeSelection,
253 QCoreApplication::translate("PythonDocMeshObjectSelection","Return a list of all selected edges").toLatin1().data(),
254 py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","ID of the object").toLatin1().data()) );
255
256 select.def("convertEdgesToVertexPairs", &MeshObjectSelectionPlugin::convertEdgesToVertexPairs,
257 QCoreApplication::translate("PythonDocMeshObjectSelection","Convert edge ids to vertex pair ids. Returns vertex Idlist.").toLatin1().data(),
258 py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","ID of the object").toLatin1().data()),
259 py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","List of edges").toLatin1().data()));
260
261 select.def("convertVertexPairsToEdges", &MeshObjectSelectionPlugin::convertVertexPairsToEdges,
262 QCoreApplication::translate("PythonDocMeshObjectSelection","Convert vertex pair ids to edge ids. Returns edge Idlist.").toLatin1().data(),
263 py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","ID of the object").toLatin1().data()),
264 py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","Ids of paired vertices").toLatin1().data()));
265
266 select.def("createMeshFromEdgeSelection", &MeshObjectSelectionPlugin::createMeshFromEdgeSelection,
267 QCoreApplication::translate("PythonDocMeshObjectSelection","Take edge selection of an object and create a new mesh from it").toLatin1().data(),
268 py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","ID of the object").toLatin1().data()) );
269
270 select.def("colorizeEdgeSelection", &MeshObjectSelectionPlugin::colorizeEdgeSelection,
271 QCoreApplication::translate("PythonDocMeshObjectSelection","Colorize the selected edges").toLatin1().data(),
272 py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","ID of the object").toLatin1().data()),
273 py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","Red color component").toLatin1().data()),
274 py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","Green color component").toLatin1().data()),
275 py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","Blue color component").toLatin1().data()),
276 py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","Alpha color component").toLatin1().data()) );
277
278 select.def("traceEdgePath", &MeshObjectSelectionPlugin::traceEdgePath,
279 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(),
280 py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","ID of the object").toLatin1().data()),
281 py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","Threshold").toLatin1().data()));
282
283 //==========================================
284 // HALFEDGE OPERATIONS
285 //==========================================
286
287 select.def("selectHalfedges", &MeshObjectSelectionPlugin::selectHalfedges,
288 QCoreApplication::translate("PythonDocMeshObjectSelection","Select the specified halfedges").toLatin1().data(),
289 py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","ID of the object").toLatin1().data()),
290 py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","List of halfedges").toLatin1().data()) );
291
292 select.def("unselectHalfedges", &MeshObjectSelectionPlugin::unselectHalfedges,
293 QCoreApplication::translate("PythonDocMeshObjectSelection","Unselect the specified halfedges").toLatin1().data(),
294 py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","ID of the object").toLatin1().data()),
295 py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","List of halfedges").toLatin1().data()) );
296
297 select.def("selectAllHalfedges", &MeshObjectSelectionPlugin::selectAllHalfedges,
298 QCoreApplication::translate("PythonDocMeshObjectSelection","Select all halfedges of an object").toLatin1().data(),
299 py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","ID of the object").toLatin1().data()) );
300
301 select.def("invertHalfedgeSelection", &MeshObjectSelectionPlugin::invertHalfedgeSelection,
302 QCoreApplication::translate("PythonDocMeshObjectSelection","Invert halfedge selection of an object").toLatin1().data(),
303 py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","ID of the object").toLatin1().data()) );
304
305 select.def("clearHalfedgeSelection", &MeshObjectSelectionPlugin::clearHalfedgeSelection,
306 QCoreApplication::translate("PythonDocMeshObjectSelection","Clear halfedge selection of an object").toLatin1().data(),
307 py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","ID of the object").toLatin1().data()) );
308
309 select.def("selectBoundaryHalfedges", &MeshObjectSelectionPlugin::selectBoundaryHalfedges,
310 QCoreApplication::translate("PythonDocMeshObjectSelection","Select all boundary halfedges of an object").toLatin1().data(),
311 py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","ID of the object").toLatin1().data()) );
312
313 select.def("getHalfedgeSelection", &MeshObjectSelectionPlugin::getHalfedgeSelection,
314 QCoreApplication::translate("PythonDocMeshObjectSelection","Get a list of selected halfedges").toLatin1().data(),
315 py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","ID of the object").toLatin1().data()) );
316
317 select.def("convertHalfedgesToVertexPairs", &MeshObjectSelectionPlugin::convertHalfedgesToVertexPairs,
318 QCoreApplication::translate("PythonDocMeshObjectSelection","Convert halfedge ids to vertex pair ids. Returns vertex Idlist.").toLatin1().data(),
319 py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","ID of the object").toLatin1().data()),
320 py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","List of halfedges").toLatin1().data()) );
321
322 select.def("convertVertexPairsToHalfedges", &MeshObjectSelectionPlugin::convertVertexPairsToHalfedges,
323 QCoreApplication::translate("PythonDocMeshObjectSelection","Convert vertex pair ids to halfedge ids. Returns halfedge Idlist.").toLatin1().data(),
324 py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","ID of the object").toLatin1().data()),
325 py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","Ids of paired vertices").toLatin1().data()) );
326
327 select.def("colorizeHalfedgeSelection", &MeshObjectSelectionPlugin::colorizeHalfedgeSelection,
328 QCoreApplication::translate("PythonDocMeshObjectSelection","Colorize the selected halfedges").toLatin1().data(),
329 py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","ID of the object").toLatin1().data()),
330 py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","Red color component").toLatin1().data()),
331 py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","Green color component").toLatin1().data()),
332 py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","Blue color component").toLatin1().data()),
333 py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","Alpha color component").toLatin1().data()) );
334
335
336 //==========================================
337 // FACE OPERATIONS
338 //==========================================
339
340 select.def("selectFaces", &MeshObjectSelectionPlugin::selectFaces,
341 QCoreApplication::translate("PythonDocMeshObjectSelection","Select the specified faces").toLatin1().data(),
342 py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","ID of the object").toLatin1().data()),
343 py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","List of faces").toLatin1().data()) );
344
345 select.def("unselectFaces", &MeshObjectSelectionPlugin::unselectFaces,
346 QCoreApplication::translate("PythonDocMeshObjectSelection","Unselect the specified faces").toLatin1().data(),
347 py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","ID of the object").toLatin1().data()),
348 py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","List of faces").toLatin1().data()) );
349
350 select.def("selectAllFaces", &MeshObjectSelectionPlugin::selectAllFaces,
351 QCoreApplication::translate("PythonDocMeshObjectSelection","Select all faces of an object").toLatin1().data(),
352 py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","ID of the object").toLatin1().data()) );
353
354 select.def("clearFaceSelection", &MeshObjectSelectionPlugin::clearFaceSelection,
355 QCoreApplication::translate("PythonDocMeshObjectSelection","Clear face selection of an object").toLatin1().data(),
356 py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","ID of the object").toLatin1().data()) );
357
358 select.def("invertFaceSelection", &MeshObjectSelectionPlugin::invertFaceSelection,
359 QCoreApplication::translate("PythonDocMeshObjectSelection","Invert face selection of an object").toLatin1().data(),
360 py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","ID of the object").toLatin1().data()) );
361
362 select.def("deleteFaceSelection", &MeshObjectSelectionPlugin::deleteFaceSelection,
363 QCoreApplication::translate("PythonDocMeshObjectSelection","Delete face that are currently selected").toLatin1().data(),
364 py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","ID of the object").toLatin1().data()) );
365
366 select.def("selectBoundaryFaces", &MeshObjectSelectionPlugin::selectBoundaryFaces,
367 QCoreApplication::translate("PythonDocMeshObjectSelection","Select all boundary faces of an object").toLatin1().data(),
368 py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","ID of the object").toLatin1().data()) );
369
370 select.def("shrinkFaceSelection", &MeshObjectSelectionPlugin::shrinkFaceSelection,
371 QCoreApplication::translate("PythonDocMeshObjectSelection","Shrink face selection by outer face ring of selection").toLatin1().data(),
372 py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","ID of the object").toLatin1().data()) );
373
374 select.def("growFaceSelection", &MeshObjectSelectionPlugin::growFaceSelection,
375 QCoreApplication::translate("PythonDocMeshObjectSelection","Grow face selection by an-ring of faces around selection").toLatin1().data(),
376 py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","ID of the object").toLatin1().data()) );
377
378 select.def("getFaceSelection", &MeshObjectSelectionPlugin::getFaceSelection,
379 QCoreApplication::translate("PythonDocMeshObjectSelection","Get current face selection").toLatin1().data(),
380 py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","ID of the object").toLatin1().data()) );
381
382 select.def("createMeshFromFaceSelection", &MeshObjectSelectionPlugin::createMeshFromFaceSelection,
383 QCoreApplication::translate("PythonDocMeshObjectSelection","Take face selection and create a new mesh from it").toLatin1().data(),
384 py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","ID of the object").toLatin1().data()) );
385
386 select.def("colorizeFaceSelection", &MeshObjectSelectionPlugin::colorizeFaceSelection,
387 QCoreApplication::translate("PythonDocMeshObjectSelection","Colorize the selected faces").toLatin1().data(),
388 py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","ID of the object").toLatin1().data()),
389 py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","Red color component").toLatin1().data()),
390 py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","Green color component").toLatin1().data()),
391 py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","Blue color component").toLatin1().data()),
392 py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","Alpha color component").toLatin1().data()) );
393
394 QString conversionStrings = QCoreApplication::translate("PythonDocMeshObjectSelection"," Possible strings:\n"
395 "- Vertex/Edge/Halfedge/Face Selection\n"
396 "- Model/Handle Region\n"
397 "- Feature Vertices/Edges/Faces");
398
399
400 select.def("convertSelection", &MeshObjectSelectionPlugin::convertSelection,
401 (QCoreApplication::translate("PythonDocMeshObjectSelection","Convert the selection on given object.Conversion must be given as strings.")+conversionStrings).toLatin1().data(),
402 py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","ID of the object").toLatin1().data()),
403 py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","string of selection type which will be converted").toLatin1().data()),
404 py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","string of selection type").toLatin1().data()),
405 py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","unselect original selection after conversion").toLatin1().data()) );
406
407 select.def("conversion", &MeshObjectSelectionPlugin::conversion,
408 (QCoreApplication::translate("PythonDocMeshObjectSelection","Convert selection on all target Objects. Conversion must be given as strings.")+conversionStrings).toLatin1().data(),
409 py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","string of selection type which will be converted").toLatin1().data()),
410 py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","string of selection type").toLatin1().data()),
411 py::arg(QCoreApplication::translate("PythonDocMeshObjectSelection","unselect original selection after conversion").toLatin1().data()) );
412
413
414 }
415
MeshObjectSelectionPlugin::invertEdgeSelection
void invertEdgeSelection(int objectId)
Unselect all Edges.
Definition: EdgeSelection.cc:171
MeshObjectSelectionPlugin::convertSelection
void convertSelection(const int &_objectId, const QString &_from, const QString &_to, bool _deselect)
Convert the selection on one object.
Definition: MeshObjectSelectionPlugin.cc:865
MeshObjectSelectionPlugin::colorizeHalfedgeSelection
void colorizeHalfedgeSelection(int objectId, int r, int g, int b, int a)
Colorize the edge selection.
Definition: HalfedgeSelection.cc:353
MeshObjectSelectionPlugin::getModelingVertices
IdList getModelingVertices(int objectId)
Get a list of all modeling vertices.
Definition: VertexSelection.cc:647
MeshObjectSelectionPlugin::deleteFaceSelection
void deleteFaceSelection(int _objectId)
Delete face that are currently selected.
Definition: FaceSelection.cc:193
MeshObjectSelectionPlugin::shrinkFaceSelection
void shrinkFaceSelection(int objectId)
Shrink the current face selection.
Definition: FaceSelection.cc:246
MeshObjectSelectionPlugin::selectAllHalfedges
void selectAllHalfedges(int objectId)
Select all Halfedges.
Definition: HalfedgeSelection.cc:124
MeshObjectSelectionPlugin::createMeshFromEdgeSelection
int createMeshFromEdgeSelection(int _objectId)
Create a mesh containing the face selection of the given mesh.
Definition: EdgeSelection.cc:240
MeshObjectSelectionPlugin::setAllModelingVertices
void setAllModelingVertices(int objectId)
Set all vertices to be part of the modeling area.
Definition: VertexSelection.cc:625
MeshObjectSelectionPlugin::unselectFaces
void unselectFaces(int objectId, IdList _facesList)
Unselect given faces.
Definition: FaceSelection.cc:91
MeshObjectSelectionPlugin::saveFlipperModelingSelection
void saveFlipperModelingSelection(int _objectId, QString _filename)
Save a selection in Flipper Selection Format.
Definition: VertexSelection.cc:754
MeshObjectSelectionPlugin::selectBoundaryHalfedges
void selectBoundaryHalfedges(int objectId)
Select boundary edges.
Definition: HalfedgeSelection.cc:193
MeshObjectSelectionPlugin::invertHalfedgeSelection
void invertHalfedgeSelection(int objectId)
Unselect all Halfedges.
Definition: HalfedgeSelection.cc:170
MeshObjectSelectionPlugin::unselectHalfedges
void unselectHalfedges(int objectId, IdList _vertexList)
Unselect given Halfedges.
Definition: HalfedgeSelection.cc:91
MeshObjectSelectionPlugin::colorizeEdgeSelection
void colorizeEdgeSelection(int objectId, int r, int g, int b, int a)
Colorize the edge selection.
Definition: EdgeSelection.cc:382
MeshObjectSelectionPlugin::clearFaceSelection
void clearFaceSelection(int objectId)
Unselect all faces.
Definition: FaceSelection.cc:147
MeshObjectSelectionPlugin::convertEdgesToVertexPairs
IdList convertEdgesToVertexPairs(int _id, const IdList &_edges)
Convert edge ids to vertex pairs.
Definition: EdgeSelection.cc:271
pybind11
Definition: PythonTypeConversions.hh:49
MeshObjectSelectionPlugin::conversion
void conversion(const QString &_from, const QString &_to, bool _deselect)
Convert the selection on all target objects.
Definition: MeshObjectSelectionPlugin.cc:1220
MeshObjectSelectionPlugin::clearEdgeSelection
void clearEdgeSelection(int objectId)
Invert the current edge selection.
Definition: EdgeSelection.cc:148
MeshObjectSelectionPlugin::unselectVertices
void unselectVertices(int objectId, IdList _vertexList)
unselect given vertices
Definition: VertexSelection.cc:91
MeshObjectSelectionPlugin::selectClosestBoundaryVertices
void selectClosestBoundaryVertices(int _objectId, int _vertexId)
Select all vertices of the boundary close to the given vertex.
Definition: VertexSelection.cc:218
MeshObjectSelectionPlugin
Definition: MeshObjectSelectionPlugin.hh:73
MeshObjectSelectionPlugin::colorizeVertexSelection
void colorizeVertexSelection(int _objectId, int _r, int _g, int _b, int a)
Colorize the vertex selection.
Definition: VertexSelection.cc:341
MeshObjectSelectionPlugin::clearModelingVertices
void clearModelingVertices(int objectId)
Clear Modeling Area.
Definition: VertexSelection.cc:602
MeshObjectSelectionPlugin::getFaceSelection
IdList getFaceSelection(int objectId)
Return a list of all selected faces.
Definition: FaceSelection.cc:292
MeshObjectSelectionPlugin::selectBoundaryVertices
void selectBoundaryVertices(int _objectId)
Select all boundary vertices of the given object.
Definition: VertexSelection.cc:195
MeshObjectSelectionPlugin::selectVerticesByValue
void selectVerticesByValue(int _objectId, QString _component, bool _greater, double _value)
Select vertices by their value.
Definition: VertexSelection.cc:577
MeshObjectSelectionPlugin::createMeshFromVertexSelection
int createMeshFromVertexSelection(int _objectId)
set dihedral angle threshold for edge selection
Definition: VertexSelection.cc:334
MeshObjectSelectionPlugin::selectAllVertices
void selectAllVertices(int _objectId)
Select all Vertices.
Definition: VertexSelection.cc:126
MeshObjectSelectionPlugin::growFaceSelection
void growFaceSelection(int objectId)
Grow the current face selection.
Definition: FaceSelection.cc:269
MeshObjectSelectionPlugin::clearHalfedgeSelection
void clearHalfedgeSelection(int objectId)
Invert the current edge selection.
Definition: HalfedgeSelection.cc:147
MeshObjectSelectionPlugin::selectHandleVertices
void selectHandleVertices(int objectId, IdList _vertexList)
Set vertices to be part of the handle area.
Definition: VertexSelection.cc:368
MeshObjectSelectionPlugin::convertHalfedgesToVertexPairs
IdList convertHalfedgesToVertexPairs(int _id, const IdList &_halfedges)
Convert halfedge ids to vertex pairs.
Definition: HalfedgeSelection.cc:241
MeshObjectSelectionPlugin::selectAllEdges
void selectAllEdges(int objectId)
Select all Edges.
Definition: EdgeSelection.cc:125
MeshObjectSelectionPlugin::getHalfedgeSelection
IdList getHalfedgeSelection(int objectId)
Return a list of all selected edges.
Definition: HalfedgeSelection.cc:216
MeshObjectSelectionPlugin::unselectEdges
void unselectEdges(int objectId, IdList _edgeList)
Unselect given Edges.
Definition: EdgeSelection.cc:92
MeshObjectSelectionPlugin::selectModelingVertices
void selectModelingVertices(int objectId, IdList _vertexList)
Set vertices to be part of the modeling area.
Definition: VertexSelection.cc:509
MeshObjectSelectionPlugin::setAllHandleVertices
void setAllHandleVertices(int objectId)
Set all vertices to be part of the handle area.
Definition: VertexSelection.cc:460
MeshObjectSelectionPlugin::colorizeFaceSelection
void colorizeFaceSelection(int objectId, int r, int g, int b, int a)
Colorize the face selection.
Definition: FaceSelection.cc:315
MeshObjectSelectionPlugin::clearVertexSelection
void clearVertexSelection(int _objectId)
Unselect all vertices.
Definition: VertexSelection.cc:149
MeshObjectSelectionPlugin::convertVertexPairsToHalfedges
IdList convertVertexPairsToHalfedges(int _id, const IdList &_vertices)
Inverse of function above.
Definition: HalfedgeSelection.cc:287
MeshObjectSelectionPlugin::invertVertexSelection
void invertVertexSelection(int _objectId)
Invert the current vertex selection.
Definition: VertexSelection.cc:172
MeshObjectSelectionPlugin::selectHalfedges
void selectHalfedges(int objectId, IdList _vertexList)
Select given Halfedges.
Definition: HalfedgeSelection.cc:58
MeshObjectSelectionPlugin::selectBoundaryEdges
void selectBoundaryEdges(int objectId)
select boundary edges
Definition: EdgeSelection.cc:194
MeshObjectSelectionPlugin::deleteEdgeSelection
void deleteEdgeSelection(int _objectId)
Delete edges that are currently selected.
Definition: EdgeSelection.cc:217
MeshObjectSelectionPlugin::invertFaceSelection
void invertFaceSelection(int objectId)
Invert the current face selection.
Definition: FaceSelection.cc:170
MeshObjectSelectionPlugin::selectAllFaces
void selectAllFaces(int objectId)
Select all faces.
Definition: FaceSelection.cc:124
MeshObjectSelectionPlugin::getHandleVertices
IdList getHandleVertices(int objectId)
Get a list of all handle vertices.
Definition: VertexSelection.cc:483
MeshObjectSelectionPlugin::createMeshFromFaceSelection
int createMeshFromFaceSelection(int _objectId)
Create a mesh containing the face selection of the given mesh.
Definition: FaceSelection.cc:216
MeshObjectSelectionPlugin::getVertexSelection
IdList getVertexSelection(int _objectId)
Return a list of all selected vertices.
Definition: VertexSelection.cc:287
MeshObjectSelectionPlugin::growVertexSelection
void growVertexSelection(int _objectId)
Grow the current vertex selection.
Definition: VertexSelection.cc:264
MeshObjectSelectionPlugin::loadFlipperModelingSelection
void loadFlipperModelingSelection(int _objectId, QString _filename)
Load a selection from an Flipper selection file for the given object.
Definition: VertexSelection.cc:670
MeshObjectSelectionPlugin::selectBoundaryFaces
void selectBoundaryFaces(int objectId)
Select all boundary faces of the given object.
Definition: FaceSelection.cc:222
MeshObjectSelectionPlugin::clearHandleVertices
void clearHandleVertices(int objectId)
Clear handle Area.
Definition: VertexSelection.cc:437
MeshObjectSelectionPlugin::deleteVertexSelection
void deleteVertexSelection(int _objectId)
Delete vertices and faces that are currently selected.
Definition: VertexSelection.cc:311
MeshObjectSelectionPlugin::selectEdges
void selectEdges(int objectId, IdList _edgeList, const double _dihedral_angle_threshold=0.0)
Select given Edges.
Definition: EdgeSelection.cc:58
MeshObjectSelectionPlugin::getEdgeSelection
IdList getEdgeSelection(int objectId)
Return a list of all selected edges.
Definition: EdgeSelection.cc:246
MeshObjectSelectionPlugin::traceEdgePath
void traceEdgePath(int objectId, double threshold)
Trace Edge Path.
Definition: EdgeSelection.cc:459
MeshObjectSelectionPlugin::selectFaces
void selectFaces(int objectId, IdList _facesList)
Select given faces.
Definition: FaceSelection.cc:58
MeshObjectSelectionPlugin::convertVertexPairsToEdges
IdList convertVertexPairsToEdges(int _id, const IdList &_vertices)
Inverse of function above.
Definition: EdgeSelection.cc:317
MeshObjectSelectionPlugin::shrinkVertexSelection
void shrinkVertexSelection(int _objectId)
Shrink the current vertex selection.
Definition: VertexSelection.cc:241
MeshObjectSelectionPlugin::unselectModelingVertices
void unselectModelingVertices(int objectId, IdList _vertexList)
Remove vertices from modeling area.
Definition: VertexSelection.cc:544
MeshObjectSelectionPlugin::selectVertices
void selectVertices(int objectId, IdList _vertexList)
select given vertices
Definition: VertexSelection.cc:58