51 #include "VolumeMeshSelectionPlugin.hh"
61 emit log(
LOGERR, tr(
"Could not get object with id %1").arg(_objectId));
69 if(!polyMeshObj && !hexMeshObj)
return;
70 if(!polyMeshObj && !hexMeshObj)
return;
75 for(OpenVolumeMesh::StatusAttrib::vstatus_iterator vst_it = status.vstatus_begin();
76 vst_it != status.vstatus_end(); ++vst_it) {
77 vst_it->set_selected(
true);
80 emit scriptInfo(
"selectAllVertices(ObjectId)");
89 emit log(
LOGERR, tr(
"Could not get object with id %1").arg(_objectId));
97 if(!polyMeshObj && !hexMeshObj)
return;
102 for(OpenVolumeMesh::StatusAttrib::vstatus_iterator vst_it = status.vstatus_begin();
103 vst_it != status.vstatus_end(); ++vst_it) {
104 vst_it->set_selected(
false);
107 emit scriptInfo(
"deselectAllVertices(ObjectId)");
116 emit log(
LOGERR, tr(
"Could not get object with id %1").arg(_objectId));
124 if(!polyMeshObj && !hexMeshObj)
return;
129 for(OpenVolumeMesh::StatusAttrib::vstatus_iterator vst_it = status.vstatus_begin();
130 vst_it != status.vstatus_end(); ++vst_it) {
131 vst_it->set_selected(!vst_it->selected());
134 emit scriptInfo(
"invertVertexSelection(ObjectId)");
140 if(_ids.empty())
return;
145 emit log(
LOGERR, tr(
"Could not get object with id %1").arg(_objectId));
153 if(!polyMeshObj && !hexMeshObj)
return;
158 for(IdList::const_iterator v_it = _ids.begin(); v_it != _ids.end(); ++v_it) {
162 QString selection =
"selectVertices(ObjectId, [ " + QString::number(_ids[0]);
164 for (uint i = 1 ; i < _ids.size(); ++i) {
165 selection +=
", " + QString::number(_ids[i]);
170 emit scriptInfo(selection);
181 emit log(
LOGERR, tr(
"Could not get object with id %1").arg(_objectId));
189 if(!polyMeshObj && !hexMeshObj)
return list;
195 for(OpenVolumeMesh::StatusAttrib::vstatus_iterator vst_it = status.vstatus_begin();
196 vst_it != status.vstatus_end(); ++vst_it, ++id) {
197 if(vst_it->selected()) list.push_back(
id);
208 emit log(
LOGERR, tr(
"Could not get object with id %1").arg(_objectId));
216 if(!polyMeshObj && !hexMeshObj)
return;
221 for(OpenVolumeMesh::StatusAttrib::vstatus_iterator vst_it = status.vstatus_begin();
222 vst_it != status.vstatus_end(); ++vst_it) {
223 if(vst_it->selected()) vst_it->set_deleted(
true);
228 emit scriptInfo(
"deleteSelectedVertices(ObjectId)");
240 emit log(
LOGERR, tr(
"Could not get object with id %1").arg(_objectId));
248 if(!polyMeshObj && !hexMeshObj)
return;
253 for(OpenVolumeMesh::StatusAttrib::estatus_iterator est_it = status.estatus_begin();
254 est_it != status.estatus_end(); ++est_it) {
255 est_it->set_selected(
true);
258 emit scriptInfo(
"selectAllEdges(ObjectId)");
267 emit log(
LOGERR, tr(
"Could not get object with id %1").arg(_objectId));
275 if(!polyMeshObj && !hexMeshObj)
return;
280 for(OpenVolumeMesh::StatusAttrib::estatus_iterator est_it = status.estatus_begin();
281 est_it != status.estatus_end(); ++est_it) {
282 est_it->set_selected(
false);
285 emit scriptInfo(
"deselectAllEdges(ObjectId)");
294 emit log(
LOGERR, tr(
"Could not get object with id %1").arg(_objectId));
302 if(!polyMeshObj && !hexMeshObj)
return;
307 for(OpenVolumeMesh::StatusAttrib::estatus_iterator est_it = status.estatus_begin();
308 est_it != status.estatus_end(); ++est_it) {
309 est_it->set_selected(!est_it->selected());
312 emit scriptInfo(
"invertEdgeSelection(ObjectId)");
318 if(_ids.empty())
return;
323 emit log(
LOGERR, tr(
"Could not get object with id %1").arg(_objectId));
331 if(!polyMeshObj && !hexMeshObj)
return;
336 for(IdList::const_iterator v_it = _ids.begin(); v_it != _ids.end(); ++v_it) {
340 QString selection =
"selectEdges(ObjectId, [ " + QString::number(_ids[0]);
342 for (uint i = 1 ; i < _ids.size(); ++i) {
343 selection +=
", " + QString::number(_ids[i]);
348 emit scriptInfo(selection);
359 emit log(
LOGERR, tr(
"Could not get object with id %1").arg(_objectId));
367 if(!polyMeshObj && !hexMeshObj)
return list;
373 for(OpenVolumeMesh::StatusAttrib::estatus_iterator est_it = status.estatus_begin();
374 est_it != status.estatus_end(); ++est_it, ++id) {
375 if(est_it->selected()) list.push_back(
id);
386 emit log(
LOGERR, tr(
"Could not get object with id %1").arg(_objectId));
394 if(!polyMeshObj && !hexMeshObj)
return;
399 for(OpenVolumeMesh::StatusAttrib::estatus_iterator est_it = status.estatus_begin();
400 est_it != status.estatus_end(); ++est_it) {
401 if(est_it->selected()) est_it->set_deleted(
true);
406 emit scriptInfo(
"deleteSelectedEdges(ObjectId)");
418 emit log(
LOGERR, tr(
"Could not get object with id %1").arg(_objectId));
426 if(!polyMeshObj && !hexMeshObj)
return;
431 for(OpenVolumeMesh::StatusAttrib::hestatus_iterator hest_it = status.hestatus_begin();
432 hest_it != status.hestatus_end(); ++hest_it) {
433 hest_it->set_selected(
true);
436 emit scriptInfo(
"selectAllHalfEdges(ObjectId)");
445 emit log(
LOGERR, tr(
"Could not get object with id %1").arg(_objectId));
453 if(!polyMeshObj && !hexMeshObj)
return;
458 for(OpenVolumeMesh::StatusAttrib::hestatus_iterator hest_it = status.hestatus_begin();
459 hest_it != status.hestatus_end(); ++hest_it) {
460 hest_it->set_selected(
false);
463 emit scriptInfo(
"deselectAllHalfEdges(ObjectId)");
472 emit log(
LOGERR, tr(
"Could not get object with id %1").arg(_objectId));
480 if(!polyMeshObj && !hexMeshObj)
return;
485 for(OpenVolumeMesh::StatusAttrib::hestatus_iterator hest_it = status.hestatus_begin();
486 hest_it != status.hestatus_end(); ++hest_it) {
487 hest_it->set_selected(!hest_it->selected());
490 emit scriptInfo(
"invertHalfEdgeSelection(ObjectId)");
496 if(_ids.empty())
return;
501 emit log(
LOGERR, tr(
"Could not get object with id %1").arg(_objectId));
509 if(!polyMeshObj && !hexMeshObj)
return;
514 for(IdList::const_iterator v_it = _ids.begin(); v_it != _ids.end(); ++v_it) {
518 QString selection =
"selectHalfEdges(ObjectId, [ " + QString::number(_ids[0]);
520 for (uint i = 1 ; i < _ids.size(); ++i) {
521 selection +=
", " + QString::number(_ids[i]);
526 emit scriptInfo(selection);
537 emit log(
LOGERR, tr(
"Could not get object with id %1").arg(_objectId));
545 if(!polyMeshObj && !hexMeshObj)
return list;
551 for(OpenVolumeMesh::StatusAttrib::hestatus_iterator hest_it = status.hestatus_begin();
552 hest_it != status.hestatus_end(); ++hest_it, ++id) {
553 if(hest_it->selected()) list.push_back(
id);
567 emit log(
LOGERR, tr(
"Could not get object with id %1").arg(_objectId));
575 if(!polyMeshObj && !hexMeshObj)
return;
580 for(OpenVolumeMesh::StatusAttrib::fstatus_iterator fst_it = status.fstatus_begin();
581 fst_it != status.fstatus_end(); ++fst_it) {
582 fst_it->set_selected(
true);
585 emit scriptInfo(
"selectAllFaces(ObjectId)");
594 emit log(
LOGERR, tr(
"Could not get object with id %1").arg(_objectId));
602 if(!polyMeshObj && !hexMeshObj)
return;
607 for(OpenVolumeMesh::StatusAttrib::fstatus_iterator fst_it = status.fstatus_begin();
608 fst_it != status.fstatus_end(); ++fst_it) {
609 fst_it->set_selected(
false);
612 emit scriptInfo(
"deselectAllFaces(ObjectId)");
621 emit log(
LOGERR, tr(
"Could not get object with id %1").arg(_objectId));
629 if(!polyMeshObj && !hexMeshObj)
return;
634 for(OpenVolumeMesh::StatusAttrib::fstatus_iterator fst_it = status.fstatus_begin();
635 fst_it != status.fstatus_end(); ++fst_it) {
636 fst_it->set_selected(!fst_it->selected());
639 emit scriptInfo(
"invertFaceSelection(ObjectId)");
645 if(_ids.empty())
return;
650 emit log(
LOGERR, tr(
"Could not get object with id %1").arg(_objectId));
658 if(!polyMeshObj && !hexMeshObj)
return;
663 for(IdList::const_iterator v_it = _ids.begin(); v_it != _ids.end(); ++v_it) {
667 QString selection =
"selectFaces(ObjectId, [ " + QString::number(_ids[0]);
669 for (uint i = 1 ; i < _ids.size(); ++i) {
670 selection +=
", " + QString::number(_ids[i]);
675 emit scriptInfo(selection);
686 emit log(
LOGERR, tr(
"Could not get object with id %1").arg(_objectId));
694 if(!polyMeshObj && !hexMeshObj)
return list;
700 for(OpenVolumeMesh::StatusAttrib::fstatus_iterator fst_it = status.fstatus_begin();
701 fst_it != status.fstatus_end(); ++fst_it, ++id) {
702 if(fst_it->selected()) list.push_back(
id);
713 emit log(
LOGERR, tr(
"Could not get object with id %1").arg(_objectId));
721 if(!polyMeshObj && !hexMeshObj)
return;
726 for(OpenVolumeMesh::StatusAttrib::fstatus_iterator fst_it = status.fstatus_begin();
727 fst_it != status.fstatus_end(); ++fst_it) {
728 if(fst_it->selected()) fst_it->set_deleted(
true);
733 emit scriptInfo(
"deleteSelectedFaces(ObjectId)");
745 emit log(
LOGERR, tr(
"Could not get object with id %1").arg(_objectId));
753 if(!polyMeshObj && !hexMeshObj)
return;
758 for(OpenVolumeMesh::StatusAttrib::hfstatus_iterator hfst_it = status.hfstatus_begin();
759 hfst_it != status.hfstatus_end(); ++hfst_it) {
760 hfst_it->set_selected(
true);
763 emit scriptInfo(
"selectAllHalfFaces(ObjectId)");
772 emit log(
LOGERR, tr(
"Could not get object with id %1").arg(_objectId));
780 if(!polyMeshObj && !hexMeshObj)
return;
785 for(OpenVolumeMesh::StatusAttrib::hfstatus_iterator hfst_it = status.hfstatus_begin();
786 hfst_it != status.hfstatus_end(); ++hfst_it) {
787 hfst_it->set_selected(
false);
790 emit scriptInfo(
"deselectAllHalfFaces(ObjectId)");
799 emit log(
LOGERR, tr(
"Could not get object with id %1").arg(_objectId));
807 if(!polyMeshObj && !hexMeshObj)
return;
812 for(OpenVolumeMesh::StatusAttrib::hfstatus_iterator hfst_it = status.hfstatus_begin();
813 hfst_it != status.hfstatus_end(); ++hfst_it) {
814 hfst_it->set_selected(!hfst_it->selected());
817 emit scriptInfo(
"invertHalfFaceSelection(ObjectId)");
823 if(_ids.empty())
return;
828 emit log(
LOGERR, tr(
"Could not get object with id %1").arg(_objectId));
836 if(!polyMeshObj && !hexMeshObj)
return;
841 for(IdList::const_iterator v_it = _ids.begin(); v_it != _ids.end(); ++v_it) {
845 QString selection =
"selectHalfFaces(ObjectId, [ " + QString::number(_ids[0]);
847 for (uint i = 1 ; i < _ids.size(); ++i) {
848 selection +=
", " + QString::number(_ids[i]);
853 emit scriptInfo(selection);
864 emit log(
LOGERR, tr(
"Could not get object with id %1").arg(_objectId));
872 if(!polyMeshObj && !hexMeshObj)
return list;
878 for(OpenVolumeMesh::StatusAttrib::hfstatus_iterator hfst_it = status.hfstatus_begin();
879 hfst_it != status.hfstatus_end(); ++hfst_it, ++id) {
880 if(hfst_it->selected()) list.push_back(
id);
893 emit log(
LOGERR, tr(
"Could not get object with id %1").arg(_objectId));
901 if(!polyMeshObj && !hexMeshObj)
return;
906 for(OpenVolumeMesh::StatusAttrib::cstatus_iterator cst_it = status.cstatus_begin();
907 cst_it != status.cstatus_end(); ++cst_it) {
908 cst_it->set_selected(
true);
911 emit scriptInfo(
"selectAllCells(ObjectId)");
920 emit log(
LOGERR, tr(
"Could not get object with id %1").arg(_objectId));
928 if(!polyMeshObj && !hexMeshObj)
return;
933 for(OpenVolumeMesh::StatusAttrib::cstatus_iterator cst_it = status.cstatus_begin();
934 cst_it != status.cstatus_end(); ++cst_it) {
935 cst_it->set_selected(
false);
938 emit scriptInfo(
"deselectAllCells(ObjectId)");
947 emit log(
LOGERR, tr(
"Could not get object with id %1").arg(_objectId));
955 if(!polyMeshObj && !hexMeshObj)
return;
960 for(OpenVolumeMesh::StatusAttrib::cstatus_iterator cst_it = status.cstatus_begin();
961 cst_it != status.cstatus_end(); ++cst_it) {
962 cst_it->set_selected(!cst_it->selected());
965 emit scriptInfo(
"invertCellSelection(ObjectId)");
971 if(_ids.empty())
return;
976 emit log(
LOGERR, tr(
"Could not get object with id %1").arg(_objectId));
984 if(!polyMeshObj && !hexMeshObj)
return;
989 for(IdList::const_iterator v_it = _ids.begin(); v_it != _ids.end(); ++v_it) {
993 QString selection =
"selectCells(ObjectId, [ " + QString::number(_ids[0]);
995 for (uint i = 1 ; i < _ids.size(); ++i) {
996 selection +=
", " + QString::number(_ids[i]);
1001 emit scriptInfo(selection);
1012 emit log(
LOGERR, tr(
"Could not get object with id %1").arg(_objectId));
1020 if(!polyMeshObj && !hexMeshObj)
return list;
1026 for(OpenVolumeMesh::StatusAttrib::cstatus_iterator cst_it = status.cstatus_begin();
1027 cst_it != status.cstatus_end(); ++cst_it, ++id) {
1028 if(cst_it->selected()) list.push_back(
id);
1039 emit log(
LOGERR, tr(
"Could not get object with id %1").arg(_objectId));
1047 if(!polyMeshObj && !hexMeshObj)
return;
1052 for(OpenVolumeMesh::StatusAttrib::cstatus_iterator cst_it = status.cstatus_begin();
1053 cst_it != status.cstatus_end(); ++cst_it) {
1054 if(cst_it->selected()) cst_it->set_deleted(
true);
1059 emit scriptInfo(
"deleteSelectedCells(ObjectId)");
IdList getCellSelection(int _objectId)
Get current cell selection.
void invertHalfFaceSelection(int _objectId)
Invert half-face selection.
void selectAllHalfFaces(int _objectId)
Select all half-faces of a volume mesh.
const UpdateType UPDATE_ALL(UpdateTypeSet(1))
Identifier for all updates.
void deleteSelectedVertices(int _objectId, bool _preserveManifoldness=true)
Delete selected vertices from mesh.
bool getObject(int _identifier, BSplineCurveObject *&_object)
void deselectAllFaces(int _objectId)
Deselect all faces of a volume mesh.
void invertCellSelection(int _objectId)
Invert cell selection.
void garbage_collection(bool _preserveManifoldness=false)
Delete all entities that have been marked as deleted.
const UpdateType UPDATE_SELECTION(UpdateTypeSet(1)<< 4)
Selection updated.
void selectAllHalfEdges(int _objectId)
Select all half-edges of a volume mesh.
void selectCells(int _objectId, const IdList &_ids, bool _deselect=false)
Select specific cells of a volume mesh.
void selectHalfEdges(int _objectId, const IdList &_ids, bool _deselect=false)
Select specific half-edges of a volume mesh.
void invertFaceSelection(int _objectId)
Invert face selection.
void selectAllVertices(int _objectId)
Select all vertices of a volume mesh.
void selectHalfFaces(int _objectId, const IdList &_ids, bool _deselect=false)
Select specific half-faces of a volume mesh.
std::vector< int > IdList
Standard Type for id Lists used for scripting.
void invertEdgeSelection(int _objectId)
Invert edge selection.
void deleteSelectedEdges(int _objectId, bool _preserveManifoldness=true)
Delete selected edges from mesh.
void deselectAllHalfEdges(int _objectId)
Deselect all half-edges of a volume mesh.
const StatusAttrib & status() const
return a pointer to the mesh
void selectAllFaces(int _objectId)
Select all faces of a volume mesh.
void selectFaces(int _objectId, const IdList &_ids, bool _deselect=false)
Select specific faces of a volume mesh.
IdList getVertexSelection(int _objectId)
Get current vertex selection.
void selectEdges(int _objectId, const IdList &_ids, bool _deselect=false)
Select specific edges of a volume mesh.
void deselectAllVertices(int _objectId)
Deselect all vertices of a volume mesh.
void selectVertices(int _objectId, const IdList &_ids, bool _deselect=false)
Select specific vertices of a volume mesh.
IdList getHalfFaceSelection(int _objectId)
Get current half-face selection.
void deleteSelectedCells(int _objectId, bool _preserveManifoldness=true)
Delete selected cells from mesh.
void invertHalfEdgeSelection(int _objectId)
Invert half-edge selection.
IdList getHalfEdgeSelection(int _objectId)
Get current half-edge selection.
void selectAllEdges(int _objectId)
Select all edges of a volume mesh.
void selectAllCells(int _objectId)
Select all cells of a volume mesh.
IdList getEdgeSelection(int _objectId)
Get current edge selection.
void deleteSelectedFaces(int _objectId, bool _preserveManifoldness=true)
Delete selected faces from mesh.
void invertVertexSelection(int _objectId)
Invert vertex selection.
void deselectAllCells(int _objectId)
Deselect all cells of a volume mesh.
IdList getFaceSelection(int _objectId)
Get current face selection.
void deselectAllEdges(int _objectId)
Deselect all edges of a volume mesh.
void deselectAllHalfFaces(int _objectId)
Deselect all half-faces of a volume mesh.