Ais color of selected.

Jonathan

CAD community veteran
Hello,

I was able to change the color of selected object, by using

C++:
        auto highlights = myAISContext->HighlightStyle();
        highlights->SetColor(Quantity_NameOfColor::Quantity_NOC_MEDIUMPURPLE3);
        highlights->SetShadingModel(Graphic3d_TypeOfShadingModel::V3d_PHONG);
        highlights->SetMethod(Aspect_TypeOfHighlightMethod::Aspect_TOHM_COLOR);
        myAISContext->SetHighlightStyle(highlights);

        auto ownface = selection->HasOwnFaceBoundaryDraw();
        if (!ownface) {
            selection->SetFaceBoundaryDraw(true);

        }
        selection->SetColor(Quantity_NameOfColor::Quantity_NOC_DEEPPINK2);
        selection->SetBasicFillAreaAspect(bfaa);
        myAISContext->SetSelectionStyle(selection);

how ever, this seem to only work on the top level of the AIS shape and not the sub shape.

If I activate the 'face' selection, the selection highlights are different, and frankly it's a bit difficult to see.

I would like to shade the selected surface instead of a simple edge color.

Could any one point me in the right direction?

Best regards,

Jonathan.
 

natalia

Moderator
Staff member
Hi, Jonathan

You should set the desired color into drawer of local selection of the context:

auto highlights_local = myAISContext->HighlightStyle(Prs3d_TypeOfHighlight_LocalSelected); highlights_local->SetColor(Quantity_NameOfColor::Quantity_NOC_MEDIUMPURPLE3);

Draw command to customize selection parameters in context is ‘vselprops’. Sample of using it:

Draw script (based on OCCT 7.5.0)Result
pload ALL
vinit
box b 10 10 10
vdisplay b –dispmode 1
vfit
vzoom 0.75
vselprops localSelHighlight -dispMode 1 -material SILVER -color WHITE
vselmode b FACE 1
vselect 270 200







1633967154812.png
 

Jonathan

CAD community veteran
Natalia,

thank you, I was able to get the highlight to change color, I am still not getting the face color

I will look at the code for vselprops maybe I will find it, thanks again!

** edit **

I didn't realize that the style had a display mode and I was only getting the edges because I never set the display mode to shaded.

Thank you so much !
1633984584581.png
 
Last edited:
Top