Пример #1
0
def iges2png(iges_file, png_file):
    '''usage: %prog <iges_file> <png_file>
    converts from IGES to PNG
    
    stuff it leaves behind:
        input.iges.stl
        input.iges.pov
        input.iges.pov.inc
        output.png'''

    print "iges2png: loading iges file."
    my_iges_importer = IGESImporter(iges_file)
    my_iges_importer.ReadFile()
    the_shapes = my_iges_importer.GetShapes()
    main_shape = the_shapes[0]

    print "iges2png: saving iges as stl."
    stl_exp = StlAPI()
    stl_exp.Write(main_shape, iges_file + ".stl")

    print "iges2png: converting stl to pov"
    stl2pov(iges_file + ".stl", iges_file + ".pov")

    print "iges2png: converting pov to png"
    pov2png(iges_file + ".pov", png_file)

    print "iges2png: done"
Пример #2
0
 def loadIGES(self, filename):
     from OCC.Utils.DataExchange.IGES import IGESImporter
     my_iges_importer = IGESImporter(filename)
     my_iges_importer.ReadFile()
     shapes=my_iges_importer.GetShapes()
     self.solid=BRepAlgoAPI_Fuse(shapes[0],shapes[0])
     for shape in shapes:
         self.solid=BRepAlgoAPI_Fuse(self.shape(),shape)
Пример #3
0
def build_curve_network(event=None):
    '''
    mimic the curve network surfacing command from rhino
    '''
    print 'Importing IGES file...',
    pth = os.path.dirname(os.path.abspath(__file__))
    pth = os.path.abspath(os.path.join(pth, '../../data/IGES/curve_geom_plate.igs'))
    iges = IGESImporter(pth)
    iges.read_file()
    print 'done.'
    # GetShapes returns 36 TopoDS_Shape, while the TopoDS_Compound contains
    # just the 6 curves I made in rhino... hmmm...
    print 'Building geomplate...',
    topo = Topo(iges.get_compound())
    edges_list = list(topo.edges())
    face = build_geom_plate(edges_list)
    print 'done.'
    
    print 'Cutting out of edges...',
    # Make a wire from outer edges
    _edges = [edges_list[2], edges_list[3], edges_list[4], edges_list[5]]
    outer_wire = make_wire(_edges)
Пример #4
0
def build_curve_network(event=None):
    '''
    mimic the curve network surfacing command from rhino
    '''
    print 'Importing IGES file...',
    pth = os.path.dirname(os.path.abspath(__file__))
    pth = os.path.abspath(os.path.join(pth, '../../data/IGES/curve_geom_plate.igs'))
    iges = IGESImporter(pth)
    iges.read_file()
    print 'done.'
    # GetShapes returns 36 TopoDS_Shape, while the TopoDS_Compound contains
    # just the 6 curves I made in rhino... hmmm...
    print 'Building geomplate...',
    topo = Topo(iges.get_compound())
    edges_list = list(topo.edges())
    face = build_geom_plate(edges_list)
    print 'done.'
    
    print 'Cutting out of edges...',
    # Make a wire from outer edges
    _edges = [edges_list[2], edges_list[3], edges_list[4], edges_list[5]]
    outer_wire = make_wire(_edges)
Пример #5
0
def build_curve_network(event=None):
    '''
    mimic the curve network surfacing command from rhino
    '''
    print 'Importing IGES file...',
    pth = os.path.dirname(os.path.abspath(__file__))
    pth = os.path.abspath(os.path.join(pth, '../../data/IGES/curve_geom_plate.igs'))
    iges = IGESImporter(pth)
    iges.read_file()
    print 'done.'
    
    print 'Building geomplate...',
    topo = Topo(iges.get_compound())
    edges_list = list(topo.edges())
    face = build_geom_plate(edges_list)
    print 'done.'
    display.EraseAll()
    display.DisplayShape(edges_list)
    display.FitAll()
    print 'Cutting out of edges...',
    # Make a wire from outer edges
    _edges = [edges_list[2], edges_list[3], edges_list[4], edges_list[5]]
    outer_wire = make_wire(_edges)
Пример #6
0
##Copyright 2009-2011 Thomas Paviot ([email protected])
##
##This file is part of pythonOCC.
##
##pythonOCC is free software: you can redistribute it and/or modify
##it under the terms of the GNU Lesser General Public License as published by
##the Free Software Foundation, either version 3 of the License, or
##(at your option) any later version.
##
##pythonOCC is distributed in the hope that it will be useful,
##but WITHOUT ANY WARRANTY; without even the implied warranty of
##MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
##GNU Lesser General Public License for more details.
##
##You should have received a copy of the GNU Lesser General Public License
##along with pythonOCC.  If not, see <http://www.gnu.org/licenses/>.

from OCC.Utils.DataExchange.IGES import IGESImporter
from OCC.Display.SimpleGui import *
display, start_display, add_menu, add_function_to_menu = init_display()

my_iges_importer = IGESImporter("../../data/IGES/splines.igs")
my_iges_importer.read_file()
the_shapes = my_iges_importer.get_shapes()

display.DisplayShape(the_shapes)
start_display()
Пример #7
0
##Copyright 2009-2011 Thomas Paviot ([email protected])
##
##This file is part of pythonOCC.
##
##pythonOCC is free software: you can redistribute it and/or modify
##it under the terms of the GNU Lesser General Public License as published by
##the Free Software Foundation, either version 3 of the License, or
##(at your option) any later version.
##
##pythonOCC is distributed in the hope that it will be useful,
##but WITHOUT ANY WARRANTY; without even the implied warranty of
##MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
##GNU Lesser General Public License for more details.
##
##You should have received a copy of the GNU Lesser General Public License
##along with pythonOCC.  If not, see <http://www.gnu.org/licenses/>.

from OCC.Utils.DataExchange.IGES import IGESImporter
from OCC.Display.SimpleGui import *
display, start_display, add_menu, add_function_to_menu = init_display()

my_iges_importer = IGESImporter("../../data/IGES/splines.igs")
my_iges_importer.read_file()

the_compound = my_iges_importer.get_compound()

display.DisplayShape(the_compound)
start_display()