
Sun, 04/12/2020 - 20:43
Hello,
I am a novice in OCC. Probably, it is a simple question.
I made a point with
void GLWidget::getPoint(QList<double> (pointList))
{
pointGList = pointList;
for (int i=0; i<pointGList.count()-2; i=i+3)
{
gp_Pnt point (pointGList.at(i),pointGList.at(i+1),pointGList.at(i+2));
TopoDS_Vertex V1 = BRepBuilderAPI_MakeVertex(point);
Handle(AIS_Shape) aShape = new AIS_Shape(V1);
Quantity_Color color(Quantity_NOC_RED);
Handle_Prs3d_PointAspect myPointAspect=new Prs3d_PointAspect(Aspect_TOM_O,color,1);
aShape->Attributes()->SetPointAspect(myPointAspect);
getContext()->Display(aShape, Standard_True);
}
}
I put in the selection the following code copied from forum:
void GLWidget::inputEvent(const int x, const int y)
{
Q_UNUSED(x);
Q_UNUSED(y);
myContext->Select(Standard_True);
emit selectionChanged();
Handle(AIS_InteractiveObject) picked;
myContext->InitSelected();
picked = myContext->SelectedInteractive();
Handle(AIS_Shape) aShape=Handle(AIS_Shape)::DownCast(picked);
TopoDS_Shape topShape = aShape->Shape();
TopExp_Explorer vertEx(topShape, TopAbs_VERTEX);
TopoDS_Vertex aVertex=TopoDS::Vertex(vertEx.Current());
gp_Pnt point = BRep_Tool::Pnt(aVertex);
gp_Pnt P = BRep_Tool::Pnt(aVertex);
qDebug() << "check";
}
So, how to get the coordinates of selected point: X, Y, Z?
Sun, 05/03/2020 - 19:44
Forgot to add, the program is just crashed after it...