]> SALOME platform Git repositories - plugins/dxfplugin.git/blobdiff - doc/salome/examples/DXFPlugindemo.py
Salome HOME
Merge from rnv/geom_plugin_imp branch
[plugins/dxfplugin.git] / doc / salome / examples / DXFPlugindemo.py
index 313fb3b9e1724862fd5e1f7ad6a654f3b09c96f7..81dbefe70b4589ff88b2b9eba5834ab03715ad2e 100644 (file)
@@ -1,34 +1,23 @@
 # Import/Export DXF
 
+import os
 import salome
 salome.salome_init()
-import GEOM,os
+import GEOM
 from salome.geom import geomBuilder
 geompy = geomBuilder.New(salome.myStudy)
-
-# Example of import/export file in DXF format
-
-print "Test Export/Import DXF ..."
-
-tmpDir = os.getenv("TEMP")
-if tmpDir == None:
-    tmpDir = "/tmp"
     
-# File for Export/Import testing
-fileExportImport = tmpDir + "/testExportImportDXF.dxf"
+# - path to the file
+dxfFile = os.path.join(os.getenv("TEMP", "/tmp"), "testExportImportDXF.dxf")
     
-# create shape
-box = geompy.MakeBoxDXDYDZ(100,100,100)
-
-# export shape
-geompy.ExportDXF(box,fileExportImport)
-
-# import shape
-Shape1 = geompy.ImportDXF(fileExportImport)
-geompy.addToStudy(Shape1, "ImportDXF_1")
+# - create shape
+box = geompy.MakeBoxDXDYDZ(100, 100, 100)
 
-# It is possible also to use next format of importing and publishing in study
+# - export shape
+geompy.ExportDXF(box, dxfFile)
 
-Shape2 = geompy.ImportDXF(fileExportImport,"ImportDXF_2")
+# - import shape
+shape = geompy.ImportDXF(dxfFile)
 
-print "OK"
\ No newline at end of file
+# - publish in study
+geompy.addToStudy(shape, "ImportDXF")