Any way to create a gizmo

Hello! 

I need to create a gizmo in the visualizer for selected objects.

Something like in attached picture.

Are there some general tips on how to do this with OpenCASCADE?

Or at least how draw any shape on screen which will be attached to the "camera" and not changes its size when zoomed/rotated?

Daniel Neander's picture

Hello!

This may not be the best way

Have a look at OpenGl_Trihedron for drawing it (this doesn't include selection). ViewerTest_OpenGlCommands.cxx has example of using OpenGl_Element.

For creating plane from part transformation

Handle(Geom_Axis2Placement) shapeCoordSystemPlacement = new Geom_Axis2Placement(gp::XOY());

shapeCoordSystemPlacement->Transform(AIS_Shape->Transformation());

Handle(Geom_Plane) axe_xy_plane = new Geom_Plane(shapeCoordSystemPlacement->Location(), shapeCoordSystemPlacement->Direction());

Handle(Geom_Plane) axe_xz_plane = new Geom_Plane(shapeCoordSystemPlacement->Location(), shapeCoordSystemPlacement->YDirection());

Handle(Geom_Plane) axe_yz_plane = new Geom_Plane(shapeCoordSystemPlacement->Location(), shapeCoordSystemPlacement->XDirection());

For other calculations use http://cvl-robot.hateblo.jp/entry/2015/12/07/164319

Alex Sbyshko's picture

Thank you very much, Daniel! You helped me a lot :)

Forum supervisor's picture

Dear Alex,

You can try the new interactive object AIS_Manipulator.
This object is not yet available in OCCT master, but it can be retrieved from the branch CR27038_3 of official git repository.
You are welcome to our support services if you need any help!

Best regards
FSR
 

Attachments: 
Alex Sbyshko's picture

Oh, that is really great! Thank you all for help!

Daniel Neander's picture

Thats great news

jelle's picture

AIS_Manipulator sounds exciting indeed...

mfregeau's picture

You mean a gimbal.. not a gizmo