How to get the Selected Mesh

Hi friends. I am developing a CAD software where I am using OCC Viewer. I am displaying multiple mesh using MeshVS_Mesh. The problem is that when a user manually using mouse selectes a mesh (I am selecting mesh based on MeshVS_ET_Face), I am not able to find which mesh was selected.

Could anyone please tell me how to get a selected mesh from AIS_InteractiveContext. When I compare AIS_InteractiveObject that I am getting from context and the AIS_InteractiveObject that I saved when displaying the mesh, the result is always false. Same approach was working with OpenCASCADE 6.3 but ater I updated it to 6.7.2, it stopped working.

Please some help.

Anil Arpaci's picture

Hello Samyak Jain, I have faced same problem and found this question without solutions. So could you please explain how you handle this problem if you solve that?

Thank you.

SAMYAK JAIN's picture

HI Anil,

I have solved the problem of selecting the mesh and obtaining the interactive context for the selected mesh. If you use the 'State()' variable of AIS_InteractiveContext object to compare the selected mesh interactive you have a handle to and the interactive object you obtain from AIS_InteractiveContext.SelectedInteractive() , you will see that it works and it gives you the actually selected mesh. I hope this helps. If not, please ask again.

Best Regards

Samyak

baler ilhan's picture

Hi friends,

A couple weeks ago, I have met the same problem. In the OpenCascade 6.7.1, it was working but when updated the occ with 6.8 and 6.9, the same problem showed up. Could anyone fixed the problem?

Thanks.

Anil Arpaci's picture

Hello again,

Actually my problem is not selecting mesh, my problem is highlighting selected mesh. I can get selected mesh with AIS_InteractiveContext->Select method, but it was not highlighted; so I could not understand that it has been selected.

Any help will be appreciated. Thanks.

Laszlo Kudela's picture

Hello Anil,

have you tried HilightSelected() function from AIS_InteractiveContext? This might do the job for you.

Alternatively, if you don't have any open local contexts (so you are in neutral mode), you could try HilightCurrents().

László

Anil Arpaci's picture

Hello Laszlo,

Thanks for your reply. Yes, I have tried HilightSelected() function, it is not working for mesh(MeshVS) type selections, while it is working for geometry(TopoDS). Also mesh types highlighting was working on OCC6.7.1, but it does not working on OCC6.9.0.

Anil Arpaci's picture

I have just realize that after OCC6..8, VTK has been used. I built my OCC with VTK, but is it possible that hilight problem related with VTK? I also have open local context.