Several shapes as one object?

Hi, All!

I have a need to collect a group of shapes (eg. spheres) to one object for more simpler manipulation with it (set color, display, erase).
I tried such way:

BRep_Builder builder;
TopoDS_Compound compound;
builder.MakeCompound(compound);

gp_Sphere sphere1(gp_Ax3(gp_Pnt(40, 40, 0), gp_Dir(1, 0, 0)), 4.);
TopoDS_Face face1
= BRepBuilderAPI_MakeFace sphere);
builder.Add(compound, face1);
gp_Sphere sphere2(gp_Ax3(gp_Pnt(50, 50, 0), gp_Dir(1, 0, 0)), 4.);
TopoDS_Face face2
= BRepBuilderAPI_MakeFace sphere);
builder.Add(compound, face2);

Handle(AIS_Shape) shape_group
= new AIS_Shape(compound);
shape->SetColor(Quantity_NOC_PURPLE);
context_->SetDisplayMode(shape_group, AIS_Shaded);
context_->Display(shape_group);

While shapes count is small (1, 2) all is fine,
but when I add much shapes to TopoDS_Compound (eg. 10 spheres), these shapes look clumsy on display!
What I do incorrectly?

Ming_39674's picture

I have the same problem. Could someone help? Why the sphere display is so clumsy?

Thanks.