Tue, 07/31/2018 - 02:16
Forums:
what is the proper way of selecting a vertex from the view ?
i use mContext->Select(true); in the left_mouse_down event handler
and use
mContext->Deactivate();
mContext->Activate(AIS_Shape::SelectionMode(TopAbs_VERTEX ), Standard_True);
mContext->MoveTo(point.x, point.y, mView, true);
in mouse_move event handler
is this the proper method of doing that ? if not what should i do?!
Wed, 08/08/2018 - 02:14
any ideas ?!
Thu, 08/09/2018 - 10:15
It doesn't look completely wrong. Have you tried it? What is your problem?
Thu, 08/09/2018 - 11:59
Hello,
In the mouse move handler function you should only call AIS_InteractiveContext::MoveTo().
Deactivate() + Activate() should be called once elsewhere in some function when the user starts to select some vertices.
Make also sure that point.x and point.y are relative to the top-left corner of the OpenCascade rendering window (and not global coords).
Thu, 08/09/2018 - 16:40
Hello
yes, i tried that too.
(for activate/deactivate inside or outside the handler) it works for edges , faces,bodies ,... but not for vertex!!!
it doesn't show vertices highlighted nor selected!!
Thu, 08/09/2018 - 16:37
i also tried that code :
aGeom_Cartpnt = new Geom_CartesianPoint(20.0, 20.0, 20.0);
ais_pnt = new AIS_Point(aGeom_Cartpnt);
ais_pnt->SetColor(Quantity_NOC_BLACK);
mContext->Display(ais_pnt, Standard_False);
and it didn't display a point or + mark at (20,20,20) too !!
i thought i may have a problem with displaying vertices or points!
Thu, 08/09/2018 - 17:20
And if you create a vertex like this?
gp_Pnt point(20.0, 20.0, 20.0);
TopoDS_Vertex vertex = BRepBuilderAPI_MakeVertex(point);
... new AIS_Shape(vertex);
Thu, 08/09/2018 - 17:30
yes i tried it before and it didn't display it
Fri, 08/10/2018 - 09:23
I also had that once that vertices didn't appear, especially when they were quite far away from the origin. I found out, that there were displayed correctly when I performed depth panning after adding them. For that I am using this method:
void View::performDepthPanning()
{
myView->ZFitAll();
myView->DepthFitAll();
}
myView is of type V3d_View (code similar to the Qt Tutorial sample).
Benjamin