How to get the selected vertex on TopAbs_VERTEX mode

How to get the selected vertex on TopAbs_VERTEX mode?

Seth Jackson's picture

hi. to get a selected vertex, or any other topods, try something like this:

TopoDS_Shape getSelectedVertex( Handle_AIS_InteractiveContext& theContext )
{
TopoDS_Shape shape;
theContext->InitSelected();
if ( type == TopAbs_VERTEX )
{
while( theContext->MoreSelected() )
{
shape = theContext->SelectedShape();
if ( shape.ShapeType() == TopAbs_VERTEX )
return shape;
theContext->NextSelected();
}
}
shape.Nullify();
return shape;
}

Seth Jackson's picture

sorry, i forgot that i use 'type' there too...

it should read more like:

( Handle_AIS_InteractiveContext& theContext, TopAbs_ShapeEnum type )

but really that test is unnecessary.