Open CASCADE, the 3D modelling kernel
3D modeling & numerical simulation

Search the Forums
See All Topics
Open CASCADEShowroomGet it!Developer CornerSupport and ProductsAbout us
Technical overview
Areas of use
Advantages
FAQ
Screenshots
Shape factory
Shape gallery
Demonstrations
What's new
System requirements
Download Center
Public license
Documentation
Getting started
Forums
Open Source community
Training and e-learning
A-la Carte Support
Value-added software
Complementary Components
Customer Corner
Company Profile
Marketing Materials
Contact Us
News
Home / Developer Corner / Forums / Usage issues / WriteFile is not member of IGESCAFControl_Reader

WriteFile is not member of IGESCAFControl_Reader

WriteFile is not member of IGESCAFControl_Reader
MIke 2012/11/09 01:46
Hi,
I have problems to read and write IGES files with colors. for example this: error in vc9: WriteFile is not member of IGESCAFControl_Reader
I look in the OCCT Documentation but can not find WriteFile ...
MIke 2012/11/09 13:17
How to read a iges file:

IGESCAFControl_Reader myIgesReader;
myIgesReader.ReadFile("c:\\Develop\\Samples\\Sample_IGES_Alt.igs");
myIgesReader.SetColorMode( Standard_True );
myIgesReader.SetNameMode( Standard_True );
myIgesReader.SetLayerMode( Standard_True );

TopoDS_Shape aBottle = myIgesReader.OneShape();
James D. 2012/11/09 15:26
Hi,
now I can read one IGES file, but how to read two iges files and write this two files in one iges file?

like this?

// Read file 1
     Handle(XCAFApp_Application) anApp = XCAFApp_Application::GetApplication();
     Handle(TDocStd_Document) aDoc;
     anApp->NewDocument("XmlXCAF", aDoc);

     IGESCAFControl_Reader myIgesReader;
     Standard_Integer nIgesFaces,nTransFaces;
     IFSelect_ReturnStatus status = myIgesReader.ReadFile(argv[1]);

     if (status == IFSelect_RetDone)
     {
          Handle(TColStd_HSequenceOfTransient) myList = myIgesReader.GiveList("iges-faces");     
          
          // Übersetzt "MyList" und erhält die Ergebnisse als OpenCASCADE-Form     
          nIgesFaces = myList->Length();
          nTransFaces = myIgesReader.TransferList(myList);
          cout<<"IGES Faces: "<<nIgesFaces<<" Transferred:"<<nTransFaces<<endl;
          printf("\n\nThe file was successfully read.\n\n");
          // Wird an die Funktion vom Datentype "TopoDS_Shape" zurückgegeben
          
     }

     Standard_Boolean result = myIgesReader.Transfer(aDoc);
     Handle(XCAFDoc_ShapeTool) myShapeTool = XCAFDoc_DocumentTool::ShapeTool(aDoc->Main());
     Handle(XCAFDoc_ColorTool) myColorTool = XCAFDoc_DocumentTool::ColorTool(aDoc->Main());

     TDF_LabelSequence roots;
     myShapeTool->GetFreeShapes(roots);

     TDF_Label rootLabel;
     rootLabel = roots.Value(1);

     Quantity_Color col(0.0f,1.0f,0.0f,Quantity_TOC_RGB);

     TDF_Label aColorLabel = myColorTool->AddColor(col);
     myColorTool->SetColor(rootLabel, aColorLabel, XCAFDoc_ColorSurf);

     Quantity_Color returnCol;
     myColorTool->GetColor(rootLabel,XCAFDoc_ColorSurf,returnCol);

     TopoDS_Shape aBottle = myIgesReader.OneShape();
     

     // Read file 2
     Handle(XCAFApp_Application) anApp2 = XCAFApp_Application::GetApplication();
     Handle(TDocStd_Document) aDoc2;
     anApp->NewDocument("XmlXCAF2", aDoc2);

     myIgesReader.ReadFile(argv[2]);

     
          Handle(TColStd_HSequenceOfTransient) myList = myIgesReader.GiveList("iges-faces");     
          
          // Übersetzt "MyList" und erhält die Ergebnisse als OpenCASCADE-Form     
          nIgesFaces = myList->Length();
          nTransFaces = myIgesReader.TransferList(myList);
          cout<<"IGES Faces: "<<nIgesFaces<<" Transferred:"<<nTransFaces<<endl;
          printf("\n\nThe file was successfully read.\n\n");
          // Wird an die Funktion vom Datentype "TopoDS_Shape" zurückgegeben
          


     
     Handle(XCAFDoc_ShapeTool) myShapeTool2 = XCAFDoc_DocumentTool::ShapeTool(aDoc2->Main());
     Handle(XCAFDoc_ColorTool) myColorTool2 = XCAFDoc_DocumentTool::ColorTool(aDoc2->Main());

     TDF_LabelSequence roots2;
     myShapeTool->GetFreeShapes(roots2);

     TDF_Label rootLabel2;
     rootLabel2 = roots2.Value(1);

     Quantity_Color col2(0.0f,1.0f,0.0f,Quantity_TOC_RGB);

     TDF_Label aColorLabel2 = myColorTool2->AddColor(col2);
     myColorTool2->SetColor(rootLabel2, aColorLabel2, XCAFDoc_ColorSurf);

     Quantity_Color returnCol2;
     myColorTool2->GetColor(rootLabel2,XCAFDoc_ColorSurf,returnCol2);

     TopoDS_Shape aBottle2 = myIgesReader.OneShape();

     IGESCAFControl_Writer aWriter;
     aWriter.SetColorMode(true);
     aWriter.SetNameMode(true);
     aWriter.Transfer(aDoc);
     aWriter.Transfer(aDoc2);
     aWriter.Write(argv[3]);




}
 
 
Latest news
  • Open CASCADE Technology 6.7.1 is available for download!
  • Open CASCADE Technology 6.7.0 is available for download!
  • Open CASCADE Technology 6.6.0 is available for download!

  • © OPEN CASCADE 2000 - 2014  |  Search  |  Contacts   |  Site map