For all issues regarding the Forums use, please, refer to the Forum Rules.

Our Solutions

Need professional assistance?
Consider our:

Support Offerings

 

Need to speed up your development?
Have a look at our:

Samples & Tools

 

Need some functionality extending standard OCCT capabilities?
Check out our:

Adv. Components

Related pages

How to change selection color on child shape

Keito Okajima's picture
Forums: 

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?

[Code]
// 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

 

Contact us

Attention: DO NOT use this form for all kind of request for the removal of your personal data. Please follow this link for such cases.