
Wed, 06/09/2021 - 10:56
Hello,
I am updating an application from OCC 6.7.0 to 7.5.0.
Detecting of shapes or compounds in the viewer works well :
- A colored wireframe is shown when moving the mouse over.
Now I want to change the color by user for detecting.
My Code is :
try
{
myAISContext->MoveTo(point.x,point.y,myView,false);
myAISContext->Select(true); // this works well
return;
}
catch(...) {}
I found that information in the documentation :
// Run the detection mechanism for activated entities in the current mouse coordinates and in the current view.
// Detected owners will be highlighted with context highlight color
theContext->MoveTo (aXMousePos, aYMousePos, myView, false);
// Select the detected owners
theContext->Select();
But where I have to change the above mentioned context highlight color ?
Thanks for a hint.
Wed, 06/09/2021 - 12:23
Take a look onto documentation of method AIS_InteractiveContext::HighlightStyle() taking Prs3d_TypeOfHighlight enumeration value in case if you would like configuring highlight colors globally (as default for all objects):
Draw Harness command vselprops can be used for testing this functionality:
Wed, 06/09/2021 - 16:17
Thank you for your answer,
although the script works with Draw Harness fine it works not in my Application ?
Win 10, VS 2017, OCC 7.5.0, x64, Debug-Mode
While detecting the Compound with the mouse only a grey wirframe is shown.
Maybe any default. The color did not change.
This has no effect:
myAISContext->HighlightStyle(Prs3d_TypeOfHighlight_Dynamic)->SetColor(Quantity_NOC_RED);
myAISContext->HighlightStyle(Prs3d_TypeOfHighlight_Selected)->SetColor(Quantity_NOC_BLUE);
myAISContext->MoveTo(point.x, point.y, myView, Standard_False);//this is needed so the context is aware of where the mouse is
myAISContext->Select(true);
Thanks for another hint
Wed, 06/09/2021 - 17:46
What do you mean by "detecting Compound"? Is is a single AIS_Shape, or maybe selection of sub-shapes or some other class?
Wed, 06/09/2021 - 18:06
It is a single Shape.
I am using:
myAISContext->Activate(AIS_Shape::SelectionMode(TopAbs_SHAPE));
Wed, 06/09/2021 - 18:20
Sorry,
TopAbs_ShapeEnum myShapeType = myDetectedShape.ShapeType();;
gives me:
TopAbs_COMPOUND (0)