James D. Fri, 11/09/2012 - 04:46 Forums: Other usage issuesHi, 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 ... James D. Fri, 11/09/2012 - 16: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(); Log in to post comments James D. Fri, 11/09/2012 - 18: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: "<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: "<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]); } Log in to post comments
Fri, 11/09/2012 - 16: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();
Fri, 11/09/2012 - 18: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: "<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: "<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]);
}