Drawing shaded shapes with visible edges


I'm trying to draw shapes (TopoDS_Shape's) in a V3D view that are both shaded (have a color and a transparency) and show visible edges (in a different color).

I've tried manipulating the AIS_Drawer returned by object->Attributes(), but nothing has worked.

I have achieved the effect I'm looking for by creating two AIS_Shapes for the TopoDS_Shape, displaying one of them shaded and displaying the other in WireFrame mode. But it seems there must be a more graceful and efficient way of doing this.

Any ideas? Thanks,

--Tom B.

Billy's picture

In Open CASCADE Technology 6.5.4 it says:

display of shading with edges

I can't find any documentation on this.

Billy's picture

I guess it is SetFaceBoundaryDraw (const Standard_Boolean theIsEnabled).
However, this doesn't work as expected. I am setting myContext()->DefaultDrawer. The line appears in shaded but when setting SetFaceBoundaryAspect although I specify black, the edge appears white.

Alexander Luger's picture

Did you solve your problem? My problem is, that sometimes the color of the shaded line switches from black to the color of its shape. Only a redisplay of the shape solves my problem.

Andrey Pozdeev's picture

try using the new AIS_ColoredShape class it's working for me, it keeps its color, with the added bonus you can specify a color to a subshape:

Handle_AIS_ColoredShape curais = new AIS_ColoredShape(theshape);

//do as your doing activate boundary edges at the global level
getContext()->DefaultDrawer ()->SetFaceBoundaryDraw(true);
getContext()->DefaultDrawer ()->FaceBoundaryAspect()->SetColor(Quantity_NameOfColor::Quantity_NOC_BLACK);
getContext()->DefaultDrawer ()->FaceBoundaryAspect()->SetWidth(1.2);

//change line width

//change line type

// to set color of subshape

Mauro C's picture

Hi,sorry,could you explain the meaning of "subshape"?
Suppose you have a box :

TopoDS_Shape B1 = BRepPrimAPI_MakeBox(200., 150., 100.).Shape();
Handle(AIS_Shape) aBox1 = new AIS_Shape(B1);

Then what's subshape meaning?