PageRenderTime 12ms CodeModel.GetById 2ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 0ms

/src/examples/Level2/DataExchange/export_multi_to_step_colors_layers_ocaf.py

http://pythonocc.googlecode.com/
Python | 33 lines | 12 code | 3 blank | 18 comment | 0 complexity | f4de499a052b3ea4016243f4940b07c3 MD5 | raw file
 1##Copyright 2009 Thomas Paviot (tpaviot@gmail.com)
 2##
 3##This file is part of pythonOCC.
 4##
 5##pythonOCC is free software: you can redistribute it and/or modify
 6##it under the terms of the GNU Lesser General Public License as published by
 7##the Free Software Foundation, either version 3 of the License, or
 8##(at your option) any later version.
 9##
10##pythonOCC is distributed in the hope that it will be useful,
11##but WITHOUT ANY WARRANTY; without even the implied warranty of
12##MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13##GNU Lesser General Public License for more details.
14##
15##You should have received a copy of the GNU Lesser General Public License
16##along with pythonOCC.  If not, see <http://www.gnu.org/licenses/>.
17
18from OCC.Utils.DataExchange.STEP import StepOCAF_Export
19from OCC.BRepPrimAPI import *
20
21# First create a simple shape to export
22my_box_shape = BRepPrimAPI_MakeBox(50,50,50).Shape()
23my_sphere_shape = BRepPrimAPI_MakeSphere(20).Shape()
24
25# Export to STEP
26my_step_exporter = StepOCAF_Export("result_export_multi.stp")
27my_step_exporter.set_color(1,0,0) # red
28my_step_exporter.set_layer('red')
29my_step_exporter.add_shape(my_box_shape)
30my_step_exporter.set_color(0,1,0) # green
31my_step_exporter.set_layer('green')
32my_step_exporter.add_shape(my_sphere_shape)
33my_step_exporter.write_file()