Salome HOME
Merge from rnv/geom_plugin_imp branch
[plugins/xtplugin.git] / doc / salome / examples / XTPlugindemo.py
index f223b4154a5dcfac8f5634c0f10a826ad8d6cb81..fd271259a4f88550c6cec6d2fce19189d09bb96d 100644 (file)
@@ -6,22 +6,15 @@ import GEOM
 from salome.geom import geomBuilder
 geompy = geomBuilder.New(salome.myStudy)
 
-# Example of import file in XT format
+# - path to the file
+xtFile = "/path/to/the/xt/file.x_t"
 
-print "Test Import XT ..."
+if os.path.exists(xtFile):
+    # - import shape
+    shape = geompy.ImportXT(xtFile)
+
+    # - publish in study
+    geompy.addToStudy(shape, "ImportXT")
 
-dir = "" # please define import directory here
-if dir != "":   
-    # File for Import testing
-    fileImport = dir + "" # please define file name here
-    if fileImport != dir:
-        # import shape
-        Shape1 = geompy.ImportXT(fileImport)
-        geompy.addToStudy(Shape1, "ImportXT_1")
-        # It is possible also to use next format of importing and publishing in study
-        Shape2 = geompy.ImportXT(fileImport,"ImportXT_2")
-        print "OK"
-    else:
-        print "please define file name in python file"
 else:
-    print "please define import directory in python file"
\ No newline at end of file
+    print "ERROR: File %s does not exist" % xtFile