Default selection mode 0 would make MeshVS_Mesh selectable as a whole object. To selection mesh elements you need activating other selection modes like MeshVS_SMF_Element from MeshVS_SelectionModeFlags enumeration with help of AIS_InteractiveContext::SetSelectionModeActive() or using extended AIS_InteractiveContext::Display().
Archived discussion
How can I select face or vertex with MeshVS_Mesh
Hello, I opened my STL file via MeshVS_Mesh and with certain display modes I can see nodes and triangles but is there way to select that triangles/surfaces and vertices one by one or multi select in certain area.
Discussion
10 archived replies
Posts are displayed in their archived order.
Hello and thanks for tip but ,I tried this way;
Handle(MeshVS_Mesh) m_mesh;
m_viewer->getContext()->InitSelected();
m_viewer->getContext()->SetSelectionModeActive(mesh->m_mesh, MeshVS_SMF_Face,Standard_True);
and I tried this
m_viewer->getContext()->Display(mesh->m_mesh,1, MeshVS_SMF_Face,true);
but I couldn't able to click on "face(s)"
That's strange. vselmode command should basically do the same thing and it works in Draw Harness:
pload XDE VISUALIZATION
vinit View1
meshfromstl m [locate_data_file shape.stl]
vsetdispmode m 3
vselmode m 8 1
Archived image: external image
I tested with my file as well and yes it is working. Do I need to "init selection" before or after, I'm kind of confused by selection.
Check description of AIS_InteractiveContext::InitSelected() - it has nothing to do with activating selection. It is a legacy interface to iterate over selected objects.
Yeah, I figured that out and also I was able to selected as well, after display object I did SetSelectionModeActive
m_viewer->getContext()->Display(mesh->m_mesh,true);
m_viewer->getContext()->SetSelectionModeActive(mesh->m_mesh, MeshVS_SMF_Face, Standard_True);
Thank you.
Hello, I have a question on this topic:
I need to select verteices of the mesh.
I tried this :
m_viewer->getContext()->SetSelectionModeActive(mesh->m_mesh, MeshVS_SMF_Node, Standard_True);
but I am not able click a vertex.
(the same with "MeshVS_SMF_Face" runs fine)
Any suggestion for mesh verteices selection?
Thanks
occHandle(TColStd_HPackedMapOfInteger) nodes = new TColStd_HPackedMapOfInteger(aMesh->GetDataSource()->GetAllNodes());
aMesh->SetSelectableNodes(nodes);
occHandle(TColStd_HPackedMapOfInteger) nodes = new TColStd_HPackedMapOfInteger(aMesh->GetDataSource()->GetAllNodes());
aMesh->SetSelectableNodes(nodes);
How to get the selected mesh nodes?