4 salome.salome_init_without_session()
6 from salome.geom import geomBuilder
7 geompy = geomBuilder.New()
12 sphere = geompy.MakeSphereR(100)
14 tmpdir = tempfile.mkdtemp()
16 # export sphere to the BREP file
17 f_brep = os.path.join(tmpdir, "sphere.brep")
18 geompy.ExportBREP(sphere, f_brep)
20 # export sphere to the IGES v5.3 file
21 f_iges = os.path.join(tmpdir, "sphere.iges")
22 geompy.ExportIGES(sphere, f_iges, "5.3")
24 # export sphere to the STEP file, using millimeters as length units
25 f_step = os.path.join(tmpdir, "sphere.step")
26 geompy.ExportSTEP(sphere, f_step, GEOM.LU_MILLIMETER)
28 # export sphere to the binary STL file, with default deflection coefficient
29 f_stl1 = os.path.join(tmpdir, "sphere1.stl")
30 geompy.ExportSTL(sphere, f_stl1, False)
32 # export sphere to the ASCII STL file, with custom deflection coefficient
33 f_stl2 = os.path.join(tmpdir, "sphere2.stl")
34 geompy.ExportSTL(sphere, f_stl2, True, 0.1)
36 # export sphere to the VTK file, with default deflection coefficient
37 f_vtk1 = os.path.join(tmpdir, "sphere1.vtk")
38 geompy.ExportVTK(sphere, f_vtk1)
40 # export sphere to the VTK file, with custom deflection coefficient
41 f_vtk2 = os.path.join(tmpdir, "sphere2.vtk")
42 geompy.ExportVTK(sphere, f_vtk2, 0.1)
44 # export sphere to the XAO file
45 f_xao = os.path.join(tmpdir, "sphere.xao")
46 geompy.ExportXAO(sphere, [], [], "author", f_xao)
49 sphere_brep = geompy.ImportBREP(f_brep)
52 sphere_iges = geompy.ImportIGES(f_iges)
54 # import STEP file, taking units into account
55 sphere_step1 = geompy.ImportSTEP(f_step)
57 # import STEP file, ignoring units (result is scaled)
58 sphere_step2 = geompy.ImportSTEP(f_step, True)
61 sphere_stl1 = geompy.ImportSTL(f_stl1)
62 sphere_stl2 = geompy.ImportSTL(f_stl2)
65 ok, sphere_xao, sub_shapes, groups, fields = geompy.ImportXAO(f_xao)
68 for f in f_brep, f_iges, f_step, f_stl1, f_stl2, f_vtk1, f_vtk2, f_xao: