AIS_Plane

Hi:
Is it possible to set displaymodeof AIS_Plane to be Shading mode(AIS_Shaded) ? thanks a lot.

PS. I have tried SetDisplayMode function in AIS_InteractiveObject and AIS_InteractiveContext. It doesn't work.

Best regards,
Shawn

mbd's picture

Hi Shawn,

I think you cannot display an AIS_Plane in shading.

One possibility is to go to the upper level and use a V3d_Plane :

Handle (V3d_Plane) myPlane = new V3d_Plane (GetViewer(), 1, 0, 0, 0);
myViewer->InitActiveViews();
myPlane->Display(GetViewer()->ActiveView(), Quantity_NOC_GRAY);

The other "possibility" is to display a face ...

mbd

Shawn Yang's picture

Hi:
Thanks for your answer. But, It get error on
myPlane->Display(GetViewer()->ActiveView(), Quantity_NOC_GRAY);

I have tried to do:

Handle(Geom_Plane) aPlane = new Geom_Plane(P1, aDir); BRepBuilderAPI_MakeFace MakeFace(gp_Pln(aPlane->Pln()), 200, -200, 410, -410);
TopoDS_Face S = MakeFace.Face();
myCurrentIC->Display(new AIS_Shape(S),AIS_Shaded);

It doesn't work. I think that is because of gp_Pln. Do you have any suggestion that I can do? Thanks, again.

Best regards,
Shawn

mbd's picture

Hi,

Is used "GetViewer()->ActiveView()" to get my active V3d_View.

What kind of error do you get with this code ?

and with your code, what do you get ?

Try this :
gp_Pnt P1 (0, 0, 0);
gp_Dir aDir (1, 0, 0);
Handle(Geom_Plane) aPlane = new Geom_Plane(P1, aDir);
BRepBuilderAPI_MakeFace MakeFace(gp_Pln(aPlane->Pln()), -200, 200, -410, 410);
TopoDS_Face S = MakeFace.Face();
Handle (AIS_Shape) AIS_S = new AIS_Shape (S);
AIS_S->SetDisplayMode(1);
myAISContext->Display(AIS_S);

With this code, you get a shaded face. I think it is what you need !

Did you include gp_Pln ?
If you don't, you get a "strange" error : error C2440: 'type cast' : cannot convert from 'class gp_Pln' to 'class gp_Pln' !

mbd

Shawn Yang's picture

Hi mbd,
Thanks for your answer, this is my mistake, I use "myAISContext->Display(AIS_S,AIS_Shaded)" to display so shading mode is not use. I change the code to be "myAISContext->Display(AIS_S,1,Standard_True)" and it is work.

Sincerely,
Shawn