Salome HOME
Implementation of DXFPLUGIN as a GEOM plugin (added files)
[plugins/dxfplugin.git] / doc / salome / examples / DXFPlugindemo.py
diff --git a/doc/salome/examples/DXFPlugindemo.py b/doc/salome/examples/DXFPlugindemo.py
new file mode 100644 (file)
index 0000000..313fb3b
--- /dev/null
@@ -0,0 +1,34 @@
+# Import/Export DXF
+
+import salome
+salome.salome_init()
+import GEOM,os
+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"
+    
+# 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")
+
+# It is possible also to use next format of importing and publishing in study
+
+Shape2 = geompy.ImportDXF(fileExportImport,"ImportDXF_2")
+
+print "OK"
\ No newline at end of file