Export File

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
from salome.shaper import model
import os 

model.begin()
file_path = os.path.join(os.getenv("DATA_DIR"), "test.step")
partSet = model.moduleDocument()
Part_1 = model.addPart(partSet)
Part_1_doc = Part_1.document()
Box_1 = model.addBox(Part_1_doc, 10, 10, 10)
Export_1 = model.exportToFile(Part_1_doc, file_path,
                              [model.selection("SOLID", "Box_1_1")])
model.do()
model.end()

Download this script

Export XAO File

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
from salome.shaper import model
import os 

model.begin()
partSet = model.moduleDocument()
Part_1 = model.addPart(partSet)
Part_1_doc = Part_1.document()
Box_1 = model.addBox(Part_1_doc, 10, 10, 10)

file_xao = os.path.join(os.getenv("DATA_DIR"), "test.xao")
Export_1 = model.exportToXAO(Part_1_doc, file_xao,
                             model.selection("SOLID", "Box_1_1"), "author", "box")

file_xao = os.path.join(os.getenv("DATA_DIR"), "test1.xao")
file_brep = os.path.join(os.getenv("DATA_DIR"), "test1_shape.brep")
Export_2 = model.exportToXAO(Part_1_doc, file_xao,
                             model.selection("SOLID", "Box_1_1"), "author", "box",
                             file_brep)
model.do()
model.end()

Download this script

Export STL File

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
from salome.shaper import model
import os

model.begin()
file_path = os.path.join(os.getenv("DATA_DIR"), "test.stl")
partSet = model.moduleDocument()
Part_1 = model.addPart(partSet)
Part_1_doc = Part_1.document()
Box_1 = model.addBox(Part_1_doc, 10, 10, 10)
Export_1 = model.exportToSTL(Part_1_doc, file_path,
                              model.selection("SOLID", "Box_1_1"),0.0001,0.5,True,False)
model.do()
model.end()

Download this script