Import: BREP|IGES|STEP
-Export: BREP|IGES|STEP
+Export: BREP|IGES|IGES_5_3|STEP
BREP.Import: libBREPImport.so
BREP.Export: libBREPExport.so
IGES.Import: libIGESImport.so
IGES.Export: libIGESExport.so
IGES.Pattern: IGES Files ( *.iges *.igs )
+IGES.ExportPattern: IGES 5.1 Files ( *.iges *.igs )
+
+IGES_5_3.Export: libIGESExport.so
+IGES_5_3.Pattern: IGES 5.3 Files ( *.iges *.igs )
STEP.Import: libSTEPImport.so
STEP.Export: libSTEPExport.so
#ifdef WNT
__declspec(__dllexport)
#endif
- int Export(const TopoDS_Shape& theShape, const TCollection_AsciiString& theFileName)
+ int Export(const TopoDS_Shape& theShape,
+ const TCollection_AsciiString& theFileName,
+ const TCollection_AsciiString& /*theFormatName*/)
{
MESSAGE("Export BREP into file " << theFileName.ToCString());
__declspec(__dllexport)
#endif
TopoDS_Shape Import (const TCollection_AsciiString& theFileName,
+ const TCollection_AsciiString& /*theFormatName*/,
TCollection_AsciiString& theError)
{
MESSAGE("Import BREP from file " << theFileName);
#define UnLoadLib( handle ) dlclose( handle );
#endif
-typedef int (*funcPoint)(const TopoDS_Shape&, const TCollection_AsciiString&);
+typedef int (*funcPoint)(const TopoDS_Shape&,
+ const TCollection_AsciiString&,
+ const TCollection_AsciiString&);
//=======================================================================
//function : GetID
aFunction->SetValue(aShape);
// retrieve the file and format names
- TCollection_AsciiString aFileName = aCI.GetFileName();
- TCollection_AsciiString aLibName = aCI.GetPluginName();
- if (aFileName.IsEmpty() || aLibName.IsEmpty())
+ TCollection_AsciiString aFileName = aCI.GetFileName();
+ TCollection_AsciiString aFormatName = aCI.GetFormatName();
+ TCollection_AsciiString aLibName = aCI.GetPluginName();
+ if (aFileName.IsEmpty() || aFormatName.IsEmpty() || aLibName.IsEmpty())
return 0;
// load plugin library
return 0;
// perform the export
- int res = fp( aShape, aFileName );
+ int res = fp( aShape, aFileName, aFormatName );
// unload plugin library
UnLoadLib( anExportLib );
#define EXP_ARG_REF 1
#define EXP_ARG_FILE 2
#define EXP_ARG_PLUG 3
+#define EXP_ARG_FORM 4
class GEOMImpl_IImportExport
{
Handle(GEOM_Function) GetOriginal() { return _func->GetReference(EXP_ARG_REF); }
- void SetFileName(const TCollection_AsciiString& theFileName) { _func->SetString(EXP_ARG_FILE, theFileName); }
+ void SetFileName(const TCollection_AsciiString& theFileName)
+ { _func->SetString(EXP_ARG_FILE, theFileName); }
TCollection_AsciiString GetFileName() { return _func->GetString(EXP_ARG_FILE); }
- void SetPluginName(const TCollection_AsciiString& theFormatName)
- { _func->SetString(EXP_ARG_PLUG, theFormatName); }
+ void SetPluginName(const TCollection_AsciiString& thePluginLibName)
+ { _func->SetString(EXP_ARG_PLUG, thePluginLibName); }
TCollection_AsciiString GetPluginName() { return _func->GetString(EXP_ARG_PLUG); }
+ void SetFormatName(const TCollection_AsciiString& theFormatName)
+ { _func->SetString(EXP_ARG_FORM, theFormatName); }
+
+ TCollection_AsciiString GetFormatName() { return _func->GetString(EXP_ARG_FORM); }
+
private:
Handle(GEOM_Function) _func;
//Check if the function is set correctly
if (aFunction->GetDriverGUID() != GEOMImpl_ExportDriver::GetID()) return;
- //Set parameters
- GEOMImpl_IImportExport aCI (aFunction);
- aCI.SetOriginal(aRefFunction);
- char* aFileName = (char*)theFileName;
- aCI.SetFileName(aFileName);
-
char* aFormatName = (char*)theFormatName;
Handle(TCollection_HAsciiString) aHLibName;
if (!IsSupported(Standard_False, aFormatName, aHLibName)) {
return;
}
TCollection_AsciiString aLibName = aHLibName->String();
+
+ //Set parameters
+ GEOMImpl_IImportExport aCI (aFunction);
+ aCI.SetOriginal(aRefFunction);
+ char* aFileName = (char*)theFileName;
+ aCI.SetFileName(aFileName);
+ aCI.SetFormatName(aFormatName);
aCI.SetPluginName(aLibName);
//Perform the Export
//Check if the function is set correctly
if (aFunction->GetDriverGUID() != GEOMImpl_ImportDriver::GetID()) return result;
- //Set parameters
- GEOMImpl_IImportExport aCI (aFunction);
- char* aFileName = (char*)theFileName;
- aCI.SetFileName(aFileName);
-
char* aFormatName = (char*)theFormatName;
Handle(TCollection_HAsciiString) aHLibName;
if (!IsSupported(Standard_True, aFormatName, aHLibName)) {
return result;
}
TCollection_AsciiString aLibName = aHLibName->String();
+
+ //Set parameters
+ GEOMImpl_IImportExport aCI (aFunction);
+ char* aFileName = (char*)theFileName;
+ aCI.SetFileName(aFileName);
+ aCI.SetFormatName(aFormatName);
aCI.SetPluginName(aLibName);
//Perform the Import
// Read Patterns for each supported format
int j = 1, len = theFormats->Length();
for (; j <= len; j++) {
- TCollection_AsciiString aPattern;
- TCollection_AsciiString aKey (theFormats->Value(j));
- aKey += ".Pattern";
+ TCollection_AsciiString aKey, aPattern;
+ aKey = theFormats->Value(j) + ".ImportPattern";
if (myResMgr->Find(aKey.ToCString()))
aPattern = myResMgr->Value(aKey.ToCString());
else {
- aPattern = theFormats->Value(j);
- aPattern += " Files ( *.* )";
+ aKey = theFormats->Value(j) + ".Pattern";
+ if (myResMgr->Find(aKey.ToCString()))
+ aPattern = myResMgr->Value(aKey.ToCString());
+ else {
+ aPattern = theFormats->Value(j);
+ aPattern += " Files ( *.* )";
+ }
}
thePatterns->Append(aPattern);
}
// Read Patterns for each supported format
int j = 1, len = theFormats->Length();
for (; j <= len; j++) {
- TCollection_AsciiString aPattern;
- TCollection_AsciiString aKey (theFormats->Value(j));
- aKey += ".Pattern";
+ TCollection_AsciiString aKey, aPattern;
+ aKey = theFormats->Value(j) + ".ExportPattern";
if (myResMgr->Find(aKey.ToCString()))
aPattern = myResMgr->Value(aKey.ToCString());
else {
- aPattern = theFormats->Value(j);
- aPattern += " Files ( *.* )";
+ aKey = theFormats->Value(j) + ".Pattern";
+ if (myResMgr->Find(aKey.ToCString()))
+ aPattern = myResMgr->Value(aKey.ToCString());
+ else {
+ aPattern = theFormats->Value(j);
+ aPattern += " Files ( *.* )";
+ }
}
thePatterns->Append(aPattern);
}
#define UnLoadLib( handle ) dlclose( handle );
#endif
-typedef TopoDS_Shape (*funcPoint)(const TCollection_AsciiString&, TCollection_AsciiString&);
+typedef TopoDS_Shape (*funcPoint)(const TCollection_AsciiString&,
+ const TCollection_AsciiString&,
+ TCollection_AsciiString&);
//=======================================================================
//function : GetID
//Standard_Integer aType = aFunction->GetType();
// retrieve the file and plugin library names
- TCollection_AsciiString aFileName = aCI.GetFileName();
- TCollection_AsciiString aLibName = aCI.GetPluginName();
- if (aFileName.IsEmpty() || aLibName.IsEmpty())
+ TCollection_AsciiString aFileName = aCI.GetFileName();
+ TCollection_AsciiString aFormatName = aCI.GetFormatName();
+ TCollection_AsciiString aLibName = aCI.GetPluginName();
+ if (aFileName.IsEmpty() || aFormatName.IsEmpty() || aLibName.IsEmpty())
return 0;
// load plugin library
// perform the import
TCollection_AsciiString anError;
- TopoDS_Shape aShape = fp( aFileName, anError );
+ TopoDS_Shape aShape = fp( aFileName, aFormatName, anError );
// unload plugin library
UnLoadLib( anImportLib );
#ifdef WNT
__declspec(__dllexport)
#endif
- int Export(const TopoDS_Shape& theShape, const TCollection_AsciiString& theFileName)
+ int Export(const TopoDS_Shape& theShape,
+ const TCollection_AsciiString& theFileName,
+ const TCollection_AsciiString& theFormatName)
{
MESSAGE("Export IGES into file " << theFileName.ToCString());
try
- {
- //VRV: OCC 4.0 migration
- IGESControl_Controller::Init();
- IGESControl_Writer ICW (Interface_Static::CVal("XSTEP.iges.unit"),
- Interface_Static::IVal("XSTEP.iges.writebrep.mode"));
- //VRV: OCC 4.0 migration
+ {
+ // define, whether to write only faces (5.1 IGES format)
+ // or shells and solids also (5.3 IGES format)
+ int aBrepMode = 0;
+ if (theFormatName.IsEqual("IGES_5_3"))
+ aBrepMode = 1;
+
+ // initialize writer
+ IGESControl_Controller::Init();
+ //IGESControl_Writer ICW (Interface_Static::CVal("write.iges.unit"),
+ // Interface_Static::IVal("write.iges.brep.mode"));
+ IGESControl_Writer ICW (Interface_Static::CVal("write.iges.unit"), aBrepMode);
- ICW.AddShape( theShape );
- ICW.ComputeModel();
- if ( ICW.Write( theFileName.ToCString() ) )
- return 1;
- }
+ // perform shape writing
+ ICW.AddShape( theShape );
+ ICW.ComputeModel();
+ if ( ICW.Write( theFileName.ToCString() ) )
+ return 1;
+ }
catch(Standard_Failure)
- {
- //THROW_SALOME_CORBA_EXCEPTION("Exception catched in IGESExport", SALOME::BAD_PARAM);
- }
+ {
+ //THROW_SALOME_CORBA_EXCEPTION("Exception catched in IGESExport", SALOME::BAD_PARAM);
+ }
return 0;
}
}
__declspec(__dllexport)
#endif
TopoDS_Shape Import (const TCollection_AsciiString& theFileName,
+ const TCollection_AsciiString& /*theFormatName*/,
TCollection_AsciiString& theError)
{
IGESControl_Reader aReader;
#ifdef WNT
__declspec(__dllexport)
#endif
- int Export(const TopoDS_Shape& theShape, const TCollection_AsciiString& theFileName)
+ int Export(const TopoDS_Shape& theShape,
+ const TCollection_AsciiString& theFileName,
+ const TCollection_AsciiString& /*theFormatName*/)
{
MESSAGE("Export STEP into file " << theFileName.ToCString());
__declspec(__dllexport)
#endif
TopoDS_Shape Import (const TCollection_AsciiString& theFileName,
+ const TCollection_AsciiString& /*theFormatName*/,
TCollection_AsciiString& theError)
{
MESSAGE("Import STEP model from file " << theFileName.ToCString());