mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2024-12-27 09:50:34 +05:00
IPAL8796: delete the files in tmp dir after import
This commit is contained in:
parent
df8fe594e1
commit
9d528b0574
@ -24,6 +24,70 @@
|
|||||||
# Module : GEOM
|
# Module : GEOM
|
||||||
# $Header$
|
# $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):
|
def TestOtherOperations (geompy, math):
|
||||||
|
|
||||||
# MakeFaces
|
# MakeFaces
|
||||||
@ -58,6 +122,9 @@ def TestOtherOperations (geompy, math):
|
|||||||
f12 = geompy.MakeFaces([w1, w2], 0)
|
f12 = geompy.MakeFaces([w1, w2], 0)
|
||||||
id_f12 = geompy.addToStudy(f12, "MakeFaces WO + WI")
|
id_f12 = geompy.addToStudy(f12, "MakeFaces WO + WI")
|
||||||
|
|
||||||
|
# Export/Import
|
||||||
|
TestExportImport(geompy, f12)
|
||||||
|
|
||||||
# OrientationChange
|
# OrientationChange
|
||||||
Box = geompy.MakeBoxDXDYDZ(200, 200, 200)
|
Box = geompy.MakeBoxDXDYDZ(200, 200, 200)
|
||||||
Orientation = geompy.OrientationChange(Box)
|
Orientation = geompy.OrientationChange(Box)
|
||||||
@ -119,28 +186,6 @@ def TestOtherOperations (geompy, math):
|
|||||||
[f_ind_1, f_ind_2, f_ind_3])
|
[f_ind_1, f_ind_2, f_ind_3])
|
||||||
id_MakeChamfer = geompy.addToStudy(MakeChamfer, "MakeChamfer")
|
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
|
||||||
NumberOfFaces = geompy.NumberOfFaces(Box)
|
NumberOfFaces = geompy.NumberOfFaces(Box)
|
||||||
if NumberOfFaces != 6:
|
if NumberOfFaces != 6:
|
||||||
|
Loading…
Reference in New Issue
Block a user