Salome HOME
Merge from rnv/geom_plugin_imp branch
[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..81dbefe
--- /dev/null
@@ -0,0 +1,23 @@
+# Import/Export DXF
+
+import os
+import salome
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
+    
+# - 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, dxfFile)
+
+# - import shape
+shape = geompy.ImportDXF(dxfFile)
+
+# - publish in study
+geompy.addToStudy(shape, "ImportDXF")