Problems controlling default drawing

Hi, I am trying to change my selection colour I have found examples to turn on edge drawing via SetFaceboundaryDraw(true)..., and this was working as expected in OCC7.0.0, but I have now upgraded to 7.4.0 and the edge color is not being set, but width is. Similarly I have tried setting a SelectionStyle, but it is having no effect (colour is sort of grey and just a little thicker than normal edge drawing) As an experiment I tried changing the HighlightColor as well, this also has no effect, as I mouse over items I get a cyan highlight. I am new to this and I might be missing something obvious (I hope!).

 

Thanks,

Chris Were

myViewer->UpdateLights();

myViewer->SetLightOn();

myViewer->SetDefaultShadingModel(V3d_PHONG);

myAISContext->SetDisplayMode(AIS_Shaded, true);



//activate boundary edges at the global level

myAISContext->DefaultDrawer()->SetFaceBoundaryDraw(true);

myAISContext->DefaultDrawer()->FaceBoundaryAspect()->SetColor(Quantity_NameOfColor::Quantity_NOC_RED);

myAISContext->DefaultDrawer()->FaceBoundaryAspect()->SetWidth(1.2);

myAISContext->DefaultDrawer()->SetAutoTriangulation(false);//turnedAutoTriangulation off, so must call  BRepMesh_IncrementalMesh manually



const Handle(Prs3d_Drawer) aHilightStyle = new Prs3d_Drawer();

aHilightStyle->SetColor(Quantity_NameOfColor::Quantity_NOC_RED);

myAISContext->SetHighlightStyle(aHilightStyle);



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

selectionStyle->SetColor(Quantity_NameOfColor::Quantity_NOC_YELLOW);

myAISContext->SetSelectionStyle(selectionStyle);

 

 

cjwere's picture

More information, it is working initially, but breaks when I activate face selection mode.

I have simplified it so setting my selection and highlighting color is simply done by:

			myAISContext->HighlightStyle()->SetColor(Quantity_NameOfColor::Quantity_NOC_YELLOW);
			myAISContext->SelectionStyle()->SetColor(Quantity_NameOfColor::Quantity_NOC_CYAN1);

And this works OK, as expected.  However as soon as the below is called to change the selection mode, selection and highlighting seems to revert to the default behaviour :

myAISContext->Deactivate();
myAISContext->Activate(AIS_Shape::SelectionMode(TopAbs_FACE));

... even if I reset the selection and highlighting to my colors as above immediately afterwards.

I've spent a couple of days on this so far and am clearly missing something!!!!  Any help is very much appreciated.

Regards,

Chris

cjwere's picture

Finally found it after digging in forum, and then through the tcl script and code for vselprops.  I did not realize HighlightStyle() had overloads for a particular style, and its a little obscure (to me), and that activating face selection mode changed to a local selection/highlighting. 

Anyway, this works:

//Local selection and highlighting, for face selection
myAISContext->HighlightStyle(Prs3d_TypeOfHighlight_LocalDynamic)->SetColor(Quantity_NameOfColor::Quantity_NOC_YELLOW);
myAISContext->HighlightStyle(Prs3d_TypeOfHighlight_LocalSelected)->SetColor(Quantity_NameOfColor::Quantity_NOC_RED);