For all issues regarding the Forums use, please, refer to the Forum Rules.

Our Solutions

Need professional assistance?
Consider our:

Support Offerings


Need to speed up your development?
Have a look at our:

Samples & Tools


Need some functionality extending standard OCCT capabilities?
Check out our:

Adv. Components

Related pages

AndroidQt viewer shows shape's color

Jiang Qicheng's picture


  I have compiled this sample and it could work now.The problem is ,all the shapes' color was Quantity_Color(1.0, 0.73, 0.2, Quantity_TOC_RGB),which set by aShapePrs in your code after I imported an iges file.

 I tried the IGESCAFControl_Reader like this:

IGESCAFControl_Reader Reader;//(XSDRAW::Session(),  Standard_False);no in the ARM's compiled result.

Standard_Integer status = Reader.ReadFile(strFile.c_str());
if (status != IFSelect_RetDone)
  return status;
WriteLog("transfer begin!");
Handle(TDocStd_Document) aDoc;//how to  initialize this document in the Qt's android platform?
Standard_Boolean ok = Reader.Transfer(aDoc);
if(ok == Standard_False)
  WriteLog("transfer failed!");
  WriteLog("transfer succeed!");
aShape = Reader.OneShape();

Then it crashed in the method "Transfer(aDoc)".

So,what's the problem? Is it related to those questions I asked in the notes? How to display the elements' color in this sample?

Need your help very badly. Thanks very much!

Jiang Qicheng's picture

Please erase the extra topic,dear administrator,it is just because the broken network between us.

Jiang Qicheng's picture

The last situation is,crash has been fixed by define doc like this:

Handle(TDocStd_Document) aDoc = new TDocStd_Document("IgesReader");

But the shapes' color was still Quantity_Color(1.0, 0.73, 0.2, Quantity_TOC_RGB),although I erased this line:

aShapePrs->SetColor (Quantity_Color(1.0, 0.73, 0.2, Quantity_TOC_RGB));

Jiang Qicheng's picture

I have solved this problem according to the chm document.The answer is like this:

      Handle(XCAFDoc_ShapeTool) myAssembly = XCAFDoc_DocumentTool::ShapeTool(aDoc->Main());
      Handle(XCAFDoc_ColorTool) myColors = XCAFDoc_DocumentTool::ColorTool(aDoc->Main());

      myContext->EraseAll (Standard_False);

      int iSize(0);
      TDF_LabelSequence cls;
      TDF_LabelSequence frshapes;
      Standard_Integer iShapesCount = frshapes.Length();
      for(Standard_Integer i = 1;i<= iShapesCount;i++)
          const TDF_Label& slabel = frshapes.Value(i);
          if (myColors->IsSet (slabel,XCAFDoc_ColorGen))
              Quantity_Color col;
              if ( !myColors->GetColor(slabel, XCAFDoc_ColorGen, col) )

              TopoDS_Shape TmpShape = myAssembly->GetShape(slabel);
              Handle(AIS_Shape) aShapePrs = new AIS_Shape (TmpShape);
              aShapePrs->SetColor (col);
              myContext->Display(aShapePrs, Standard_False);
              myContext->SetDisplayMode (aShapePrs, AIS_Shaded, Standard_False);

I must say that opencascade is great!