selecting AIS_Trihedron

Hello,

I can set the selection mode of AIS_Trihedron as in this code but I would like to retrieve the properties of AIS_Trihedron during the mouse selection. In particular, the axis gets highlighted correctly when I click the mouse but I don't know how to get the information of the clicked axis from AIS_InteractiveContext. I should figure out which axis of the  AIS_Trihedron that was clicked/selected. Any help?

 

Handle(AIS_Trihedron) aTrihedron;
Handle(Geom_Axis2Placement) aTrihedronAxis=new Geom_Axis2Placement(gp::XOY());
aTrihedron=new AIS_Trihedron(aTrihedronAxis);
aTrihedron->SetSelectionMode(2);
myAISContext->Display(aTrihedron);

 

Thanks,

Emad

Daniel Neander's picture

Try this (not tested)

for (context->InitSelected(); context->MoreSelected(); context->NextSelected()) {

const Handle(AIS_InteractiveObject) obj = context->SelectedInteractive();

if ((obj->Type() == AIS_KOI_Datum) && (obj->Signature() == 2) && !obj.IsNull()) {

Handle(AIS_Axis) anAxis = Handle(AIS_Axis)::DownCast(obj);

}

}

2265636806_166500's picture

Hi:

  There is no function : aTrihedron->SetSelectionMode(2)    in 7.5.0,

  How to set selection mode? 

 And obj->Signature() always return 3,  how to solve it? 

Emad Dlala's picture

Hi Daniel,

Thank you for your reply. 

The lines seem to work except the last line.

Handle(AIS_Axis) anAxis = Handle(AIS_Axis)::DownCast(obj);

Where AIS_Axis is first defined? Frankly I am using PythonOCC so the syntax is slightly different.

Thanks,

Emad