From: jfa Date: Thu, 28 Jul 2005 07:21:47 +0000 (+0000) Subject: IPAL8796: delete the files in tmp dir after import X-Git-Tag: T2_2_5a~5 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=cd1f268489205586659c462f4effa606d0c6b848;p=modules%2Fgeom.git IPAL8796: delete the files in tmp dir after import --- diff --git a/src/GEOM_SWIG/GEOM_TestOthers.py b/src/GEOM_SWIG/GEOM_TestOthers.py index d9354e838..8129dbd94 100644 --- a/src/GEOM_SWIG/GEOM_TestOthers.py +++ b/src/GEOM_SWIG/GEOM_TestOthers.py @@ -23,6 +23,69 @@ # Author : Julia DOROVSKIKH # Module : GEOM # $Header$ +import os + +def TestExportImport (geompy, shape): + + print "Test Export/Import ...", + + # Files for Export/Import testing + fileExportImport = "/tmp/testExportImport.brep" + fileExportImportBREP = "/tmp/testExportImportBREP.brep" + fileExportImportIGES = "/tmp/testExportImportIGES.iges" + fileExportImportSTEP = "/tmp/testExportImportSTEP.step" + + if os.access(fileExportImport, os.F_OK): + if os.access(fileExportImport, os.W_OK): + os.remove(fileExportImport) + else: + fileExportImport = "/tmp/testExportImport1.brep" + + if os.access(fileExportImportBREP, os.W_OK): + os.remove(fileExportImportBREP) + else: + fileExportImportBREP = "/tmp/testExportImportBREP1.brep" + + if os.access(fileExportImportIGES, os.W_OK): + os.remove(fileExportImportIGES) + else: + fileExportImportIGES = "/tmp/testExportImportIGES1.iges" + + if os.access(fileExportImportSTEP, os.W_OK): + os.remove(fileExportImportSTEP) + else: + fileExportImportSTEP = "/tmp/testExportImportSTEP1.step" + + # Export + geompy.Export(shape, fileExportImport, "BREP") + + # ExportBREP, ExportIGES, ExportSTEP + geompy.ExportBREP(shape, fileExportImportBREP) + geompy.ExportIGES(shape, fileExportImportIGES) + geompy.ExportSTEP(shape, fileExportImportSTEP) + + # Import + Import = geompy.Import(fileExportImport, "BREP") + + id_Import = geompy.addToStudy(Import, "Import") + + # ImportBREP, ImportIGES, ImportSTEP + ImportBREP = geompy.ImportBREP(fileExportImportBREP) + ImportIGES = geompy.ImportIGES(fileExportImportIGES) + ImportSTEP = geompy.ImportSTEP(fileExportImportSTEP) + + id_ImportBREP = geompy.addToStudy(ImportBREP, "ImportBREP") + id_ImportIGES = geompy.addToStudy(ImportIGES, "ImportIGES") + id_ImportSTEP = geompy.addToStudy(ImportSTEP, "ImportSTEP") + + # Remove files for Export/Import testing + os.remove(fileExportImport) + os.remove(fileExportImportBREP) + os.remove(fileExportImportIGES) + os.remove(fileExportImportSTEP) + + print "OK" + def TestOtherOperations (geompy, math): @@ -58,6 +121,9 @@ def TestOtherOperations (geompy, math): f12 = geompy.MakeFaces([w1, w2], 0) id_f12 = geompy.addToStudy(f12, "MakeFaces WO + WI") + # Export/Import + TestExportImport(geompy, f12) + # OrientationChange Box = geompy.MakeBoxDXDYDZ(200, 200, 200) Orientation = geompy.OrientationChange(Box) @@ -119,28 +185,6 @@ def TestOtherOperations (geompy, math): [f_ind_1, f_ind_2, f_ind_3]) id_MakeChamfer = geompy.addToStudy(MakeChamfer, "MakeChamfer") - # Export - geompy.Export(f12, "/tmp/testExportImport.brep", "BREP") - - # ExportBREP, ExportIGES, ExportSTEP - geompy.ExportBREP(f12, "/tmp/testExportImportBREP.brep") - geompy.ExportIGES(f12, "/tmp/testExportImportIGES.iges") - geompy.ExportSTEP(f12, "/tmp/testExportImportSTEP.step") - - # Import - Import = geompy.Import("/tmp/testExportImport.brep", "BREP") - - id_Import = geompy.addToStudy(Import, "Import") - - # ImportBREP, ImportIGES, ImportSTEP - ImportBREP = geompy.ImportBREP("/tmp/testExportImportBREP.brep") - ImportIGES = geompy.ImportIGES("/tmp/testExportImportIGES.iges") - ImportSTEP = geompy.ImportSTEP("/tmp/testExportImportSTEP.step") - - id_ImportBREP = geompy.addToStudy(ImportBREP, "ImportBREP") - id_ImportIGES = geompy.addToStudy(ImportIGES, "ImportIGES") - id_ImportSTEP = geompy.addToStudy(ImportSTEP, "ImportSTEP") - # NumberOfFaces NumberOfFaces = geompy.NumberOfFaces(Box) if NumberOfFaces != 6: @@ -317,11 +361,11 @@ def TestOtherOperations (geompy, math): geompy.addToStudyInFather(blocksComp, chain, "propagation chain") # GetPoint(theShape, theX, theY, theZ, theEpsilon) - # + # # (-50, 50, 50) .-----. (50, 50, 50) - # pb0_top_1 | | + # pb0_top_1 | | # | . pmidle - # | | + # | | # (-50, -50, 50) '-----' (50, -50, 50) # pb0_top_1 = geompy.GetPoint(blocksComp, -50, 50, 50, 0.01)