Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion register_selection_tools.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,15 @@ void RegisterSelectionTools(ProMeshRegistry& reg, string baseGrp)
.add_function("SelectUnorientableVolumes", &SelectUnorientableVolumes, grp, "",
"mesh", TOOLTIP_SELECT_UNORIENTABLE_VOLUMES)
.add_function("SelectVolumeByIndex", &SelectVolumeByIndex, grp, "",
"mesh # index", TOOLTIP_SELECT_VOLUME_BY_INDEX);
"mesh # index", TOOLTIP_SELECT_VOLUME_BY_INDEX)
.add_function("SelectVolumesByType", &SelectVolumesByType, grp, "",
"mesh #"
"Hexahedra || value=true #"
"Octahedra || value=true #"
"Prisms || value=true #"
"Pyramids || value=true #"
"Tetrahedra || value=true #",
TOOLTIP_SELECT_VOLUMES_BY_TYPE);

grp = baseGrp + "/Volumes/Coordinate Based";
reg.add_function("SelectVolumeByCoordinate", &SelectElemByCoordinate<Volume>, grp, "",
Expand Down
23 changes: 23 additions & 0 deletions tools/selection_tools.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -961,6 +961,29 @@ bool SelectVolumeByIndex(Mesh* obj, int index)
return false;
}

void SelectVolumesByType(
Mesh* obj,
bool selHexahedra,
bool selOctahedra,
bool selPrisms,
bool selPyramids,
bool selTetrahedra)
{
Grid& grid = obj->grid();
Selector& sel = obj->selector();

if(selHexahedra)
sel.select(grid.begin<Hexahedron>(), grid.end<Hexahedron>());
if(selOctahedra)
sel.select(grid.begin<Octahedron>(), grid.end<Octahedron>());
if(selPrisms)
sel.select(grid.begin<Prism>(), grid.end<Prism>());
if(selPyramids)
sel.select(grid.begin<Pyramid>(), grid.end<Pyramid>());
if(selTetrahedra)
sel.select(grid.begin<Tetrahedron>(), grid.end<Tetrahedron>());
}

void VolumeSelectionFill(Mesh* obj)
{
Selector& sel = obj->selector();
Expand Down
9 changes: 9 additions & 0 deletions tools/selection_tools.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@
#define TOOLTIP_SELECT_FACE_BY_INDEX "Selects a face given its index."
#define TOOLTIP_SELECT_FACES_BY_NORMAL "Selects faces given a normal and a maximum deviation angle."
#define TOOLTIP_SELECT_VOLUME_BY_INDEX "Selects a volume given its index."
#define TOOLTIP_SELECT_VOLUMES_BY_TYPE "Selects all volumes of a given type."
#define TOOLTIP_SELECT_VERTEX_BY_COORDINATE "Selects a vertex given a coordinate."
#define TOOLTIP_SELECT_EDGE_BY_COORDINATE "Selects the edge whose center is closest to the specified coordinate."
#define TOOLTIP_SELECT_FACE_BY_COORDINATE "Selects the face whose center is closest to the specified coordinate."
Expand Down Expand Up @@ -383,6 +384,14 @@ int SelectSlivers(Mesh* obj, number thresholdRatio);

bool SelectVolumeByIndex(Mesh* obj, int index);

void SelectVolumesByType(
Mesh* obj,
bool selHexahedra,
bool selOctahedra,
bool selPrisms,
bool selPyramids,
bool selTetrahedra);

void VolumeSelectionFill(Mesh* obj);

void ClearMarks(Mesh* obj);
Expand Down