Salome HOME
Implementation of DXFPLUGIN as a GEOM plugin (added files)
[plugins/dxfplugin.git] / doc / salome / examples / DXFPlugindemo.py
1 # Import/Export DXF
2
3 import salome
4 salome.salome_init()
5 import GEOM,os
6 from salome.geom import geomBuilder
7 geompy = geomBuilder.New(salome.myStudy)
8
9 # Example of import/export file in DXF format
10
11 print "Test Export/Import DXF ..."
12
13 tmpDir = os.getenv("TEMP")
14 if tmpDir == None:
15     tmpDir = "/tmp"
16     
17 # File for Export/Import testing
18 fileExportImport = tmpDir + "/testExportImportDXF.dxf"
19     
20 # create shape
21 box = geompy.MakeBoxDXDYDZ(100,100,100)
22
23 # export shape
24 geompy.ExportDXF(box,fileExportImport)
25
26 # import shape
27 Shape1 = geompy.ImportDXF(fileExportImport)
28 geompy.addToStudy(Shape1, "ImportDXF_1")
29
30 # It is possible also to use next format of importing and publishing in study
31
32 Shape2 = geompy.ImportDXF(fileExportImport,"ImportDXF_2")
33
34 print "OK"