shape cant be selected and highlighted

i create a box and display it. I want it can not be selected and highlighted. Is there a good a way?

Dmitrii Pasukhin's picture

Hello, could you share more information. Code samples and other, as much as possible.

Best regards, Dmitrii.

Luke jk's picture

this is my code ,thanks a lot
Handle(AIS_InteractiveContex)mycontext=.....
TopoDS_Shape aBox1=BrepPrimAPI_MakeBox(5.0,10.0,15.0)
Handle(AIS_Shape) ais_shape=new AIS_Shape(aBox1);
mycontext->Display(ais_Shape,true);

gkv311 n's picture

If you want displaying a shape, that shouldn't be selectable, then you may use a longer method AIS_InteractiveContext::Display() and pass -1 as selection mode:

Handle(AIS_InteractiveContext) theCtx = ... ;
Handle(AIS_Shape) aPrs = ... ;
theCtx->Display(aPrs, AIS_Shaded, -1, true);
Luke jk's picture

Thanks for your reply.
Best regards, LuKe.

Luke jk's picture

hello! I have another question. i want change the selectionStyle .the follow is my code
the lineAspect is not work. the width and the theType is not changed when i select edge. Can you let me know if im doing this wrong 

Handle(AIS_InteractiveContext) theCtx = ... ; 
Handle(Prs3d_Drawer) select_style=theCtx->SelectionStyle(); 
select_style->SetMethod(Aspect_TOHM_COLOR); 
select_style->SetColor(Quantity_NOC_ORANGE); 
select_style->SetDisplay(1); 
Handle(Prs3d_LineAspect)lineAspect=new Prs3d_LineAspect(Quantity_NOC_ORANGE,Aspect_TOL_DOTDASH,3.0);
select_style->setLineAspect(lineAspect);
gkv311 n's picture

Luke wrote:

i want change the selectionStyle .the follow is my code the lineAspect is not work. the width and the theType is not changed when i select edge. Can you let me know if im doing this wrong

In general, highlighting style allows overriding only color, display mode and shading material properties - as it reuses existing presentation. The only exeption is local highlighting of subshapes, but that logic also doesn't expect different styles for main and highlighted presentations.

For changing this behavior you would have to subclass AIS_Shape and implement own highlight logic.