Different colours within one TopoDS_Compound

Hi all,
can anyone tell me how to display several colours (of my personal choice) within one TopoDS_Compound of BSplines, Surfaces and so on. So I want a very colourful graphic visualization.
Do I need the AIS_Shape class or anything else ?

Any hint is very welcome.
Best Regards

MCV

TrEizE's picture

what do u mean ? by my side, i took a compound and for best visualisation i displayed every "shap" (faces, edges and vertices) in differents colors, if u'd like so..i can put the code here

MCV's picture

Hi, oh yes your code would be a wonderful help.
Thank you in advance !

MCV

MCV's picture

Hi,
how are you ?
How about your answer ? I yearn for it....!

Best Regards

MCV

MCV's picture

Hi,

do you have a code example ? Or would you advice the chapter about AIS_Shape ?

Best Regards

MCV

TrEizE's picture

hi,

sorry to be so late...

this is the code :
Quantity_NameOfColor TabOfColor[Number_of_color];
TopExp_Explorer Ex;
int cpt = 0;
for (Ex.Init(mySolid, TopAbs_FACE); Ex.More(); Ex.Next())
{

TopoDS_Face F;
F = TopoDS::Face(Ex.Current());
Handle(AIS_Shape) aisUneForme = new AIS_Shape(F);
aisUneForme->SetColor(TabOfColor[cpt%Number_of_color]);
this->GetAISContext()->Display(aisUneForme);
cpt++;
}

MCV's picture

Hi, thank you for your answer.

The code looks quite good, but maybe I was looking for somthing different:

Consider the tutorial (examples/tutorial) or the OCC-documentation.
There is this code "MakeBottle.cxx".
At the end of that program, any line/shape etc is being added to a TopoDS_Compound and returned to the OCC-viewer being implemented with the distribution.
How can I change the attributes of that lines/shapes their, so that I get a colourful picture ? How to choose the individual colour of any geometric entity within the TopoDS_Compound ?

Best Regards.

MCV