Changing the default highlight thickness when a face, edge or a shape is selected?


I want to increase the default highlight thickness when a face, edge or whole shape is selected. 

Handle(AIS_ColoredDrawer) selectionStyle = new AIS_ColoredDrawer(new Prs3d_Drawer());

Standard_ShortReal width = selectionStyle->LineAspect()->Aspect()->Width();

selectionStyle->LineAspect()->Aspect()->SetWidth(width * 5);

if (selectionStyle->HasOwnWidth()) {



else {





nevertheless, my program highlights faces in red color with the default thickness. But expected result is faces get selected in black color with a bold thickness. Could you please correct my code or help me to do this?




Kirill Gavrilov's picture

You can manage a color of Wireframe highlighting, see Draw Harness script configuring colors for a Local Selection:

vinit View1
box b 1 2 3
vdisplay -dispMode 1 b
vselprops localDynHighlight -color RED
vselprops localSelHighlight -color BLUE1
vselmode FACE 1

Managing line width is not the same.
Currently, general highlighting logic reuses existing graphic presentation and alters only its color (but not other properties).

For more complicated scenarios (custom line width, custom line style or completely different logic, etc.),
application have to create a dedicated presentation for highlighting with customized styles (e.g. like subclassing AIS_Shape and defining a new Display Mode or in other ways).
Although in case of a Local Selection of AIS_Shape, it might work with minor changes, since it creates a new presentation for a sub-shape anyway.

Note that your code defining AIS_ColoredDrawer is broken, because you have not assigned custom aspect via ::SetLineAspect().
You should also handle other line styles like WireAspect, VIsoAspect, UIsoAspect and others, because presentation builder uses different aspects for different parts of a shape.
Usage of AIS_ColoredDrawer instead of Prs3d_Drawer is confusing here, because AIS_ColoredDrawer is designed only for usage in context of sub-shapes in AIS_ColoredShape.