
Wed, 03/29/2023 - 17:42
Forums:
Hello! I have an array of Graphic3d_ArrayOfPrimitives which contains segments colored with different colors. When highlighting it (using HilightSelected() and HilightOwnerWithColor()), I want to modify only the segment width of each element inside the array, but the colors to remain the same. Which is the best approach? I tried various tests but with no success, I can only modify the complete array color, and no success with modifying the width. This is a test sample:
// init drawers attributes
Handle(Prs3d_ShadingAspect) shasp = new Prs3d_ShadingAspect();
shasp->SetTransparency(1.0f);
shasp->Aspect()->SetEdgeWidth(2);
myDynHilightDrawer = new Prs3d_Drawer();
myDynHilightDrawer->Link(myDrawer);
myDynHilightDrawer->SetShadingAspect(shasp);
myDynHilightDrawer->SetFaceBoundaryDraw(true);
myDynHilightDrawer->SetDisplayMode(1);
myHilightDrawer = new Prs3d_Drawer();
myHilightDrawer->Link(myDrawer);
myHilightDrawer->SetShadingAspect(shasp);
myHilightDrawer->SetFaceBoundaryDraw(true);
myHilightDrawer->SetDisplayMode(1);
void MyAISObject::HilightOwnerWithColor(const Handle(PrsMgr_PresentationManager)& thePrsMgr, const Handle(Prs3d_Drawer)& theStyle, const Handle(SelectMgr_EntityOwner)& theOwner)
{
thePrsMgr->Color(this, myDynHilightDrawer, myDynHilightDrawer->DisplayMode());
}
void MyAISObject::HilightSelected(const Handle(PrsMgr_PresentationManager)& thePrsMgr, const SelectMgr_SequenceOfOwner& theSeq)
{
thePrsMgr->Color(this, myHilightDrawer, myHilightDrawer->DisplayMode());
}
Thu, 03/30/2023 - 12:44
For the moment, highlighting methods like
PrsMgr_PresentationManager::Color()
has no power to change any attributes of existing presentation other than color of entire presentation. You may change attributes of existing presentation on your own when selection status changes, or compute a dedicated presentation with different style, which will be displayed on top.Thu, 03/30/2023 - 13:04
Hi Kirill!
Thank you for your response!
Can you indicate some sample for both approaches from Open cascade documentation or from Draw Harness plugin command scripts?
Much appreciated!
Best regards!
Ioan
Thu, 03/30/2023 - 13:23
For duplicated presentation - it is like
AIS_Shape
displayed inAIS_Shaded
mode and highlighted byAIS_Wireframe
presentation. You'll need your::Compute()
to handle differenttheMode
values and set different display mode to highlight style(s).For changing style of existing presentation - it is like calling
SetWidth()
orSetColor()
to presentation object and redrawing the view, but in sync with selection state changes. I don't recall samples of such logic in OCCT, although this approach has been used in some projects.Sun, 04/02/2023 - 13:16
Everything works as expected!
Thank you very much!