Tue, 10/16/2007 - 19:48
Forums:
Hi,
I am new to Open Cascade but am trying to use it to convert IGES data to STEP format, transfering also entity colors from the IGES data.
Would anyone have any experience of this and, if so, could you provide some initial direction to how I would achieve this.
Ideally I would like the process to be run from a command line (windows or unix) to run in a batch mode.
Thanks
Martin
Thu, 10/18/2007 - 11:29
Hi Martin,
Here is some code I have not tested neither compiled, give it a try if you still don't figure out how to do what you want with OpenCascade :
#include
#include
#include
#include
#include
void exportIgesFileToStepFile(const char* igesFilePath,
const char* stepFilePath)
{
Handle_TDocStd_Document document;
Handle_XCAFApp_Application app = XCAFApp_Application::GetApplication();
app->NewDocument("MDTV-XCAF", document);
IGESCAFControl_Reader reader;
reader.ReadFile(filePath);
bool readOk = reader.Transfer(document);
if (readOk)
{
STEPCAFControl_Writer writer;
bool writeOk = writer.Perform(document, stepFilePath);
if (!writeOk)
std::cerr << "Could not write : " << stepFilePath << std::endl;
}
else
std::cerr << "Could not read : " << igesFilePath << std::endl;
}
Hope this will help you.