How to change selection color on child shape

Hello,

I use open cascade version V7.4.0.

When an edge is selected, the selection color differs in the following two patterns.

・ TopoDS_Wire is displayed
・ TopoDS_Edge is displayed

I want to change the selection color of Edge which is child of Wire.

Anyone had this problem?

// Create Context
m_context = new AIS_InteractiveContext( m_viewer );
Handle(Prs3d_Drawer) drowSelect = new Prs3d_Drawer();
drowSelect->SetColor( Quantity_Color(Quantity_NOC_MAGENTA1) );
m_context->SetSelectionStyle( drowSelect );
Handle(Prs3d_Drawer) drowHilight = new Prs3d_Drawer();
drowHilight->SetColor( Quantity_Color(Quantity_NOC_CYAN2) );
m_context->SetHighlightStyle​( drowHilight );
m_context->SetDisplayMode( AIS_Shaded, Standard_True );

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

// Display Shape
m_context->Deactivate();
Handle_AIS_Shape aisWire= new AIS_Shape( wire );
m_context->Display( aisWire​, Standard_False );
Handle_AIS_Shape asiEdge= new AIS_Shape( edge);
m_context->Display( asiEdge​​, Standard_False );
m_context->Activate( AIS_Shape::SelectionMode(TopAbs_EDGE) );
m_context->Activate( AIS_Shape::SelectionMode(TopAbs_VERTEX) );
m_context->UpdateCurrentViewer();

Best regards.

Kirill Gavrilov's picture

There is a dedicated drawer for highlighting parts within local selection.

pload MODELING VISUALIZATION
box b 1 2 3
explode b W
vclear
vinit View1
vaxo
vdisplay b_1 b_2
vfit
vselmode b_2 2 1
vselprops selHighlight      -color BLUE1
vselprops localSelHighlight -color MAGENTA1
vselect 160 50
vselect 290 64 1
Attachments: 
Keito Okajima's picture

Thank you for your reply.
But unfortunately, I couldn't understand your code.
If possible, would you please write code using class AIS_Shape etc ?

Kirill Gavrilov's picture

This is Tcl script for Draw Harness.
You can easily find C++ source code of used commands like vselprops (ViewerTest package) within OCCT itself.

Forum supervisor's picture

Dear Keito,

I welcome you to contact us via https://www.opencascade.com/contact to learn more how we can help you with this specific problem, and also generally in your development based on our technology.

Best regards,

Forum supervisor

Si An Chen's picture

Dear Keito, 

I have faced the same problem mentioned above. I could set the selection color of complete shape, but it does not work for child shape. Have you solved this problem? If yes, could you list the simple code for solution?

Best regards,

Si An Chen