From: jfa Date: Thu, 28 Jul 2005 07:31:11 +0000 (+0000) Subject: IPAL8796: delete the files in tmp dir after import X-Git-Tag: V3_0_1~3 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=9d528b057488713dd6eac29b6d6d789492091e82;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..bb3d94f63 100644 --- a/src/GEOM_SWIG/GEOM_TestOthers.py +++ b/src/GEOM_SWIG/GEOM_TestOthers.py @@ -24,6 +24,70 @@ # 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): # MakeFaces @@ -58,6 +122,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 +186,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 +362,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)