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"
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)