def load_file(self, filename): gcode = gcoder.GCode(open(filename)) model = actors.GcodeModel() model.load_data(gcode) obj = gcview.GCObject(model) obj.gcode = gcode obj.dims = [ gcode.xmin, gcode.xmax, gcode.ymin, gcode.ymax, gcode.zmin, gcode.zmax ] obj.centeroffset = [ -(obj.dims[1] + obj.dims[0]) / 2, -(obj.dims[3] + obj.dims[2]) / 2, 0 ] self.add_model(filename, obj) wx.CallAfter(self.Refresh)
def load_file(self, filename): gcode = gcoder.GCode(open(filename, "rU"), get_home_pos(self.build_dimensions)) model = actors.GcodeModel() if gcode.filament_length > 0: model.display_travels = False generator = model.load_data(gcode) generator_output = next(generator) while generator_output is not None: generator_output = next(generator) obj = gcview.GCObject(model) obj.offsets = [self.build_dimensions[3], self.build_dimensions[4], 0] obj.gcode = gcode obj.dims = [gcode.xmin, gcode.xmax, gcode.ymin, gcode.ymax, gcode.zmin, gcode.zmax] obj.centeroffset = [-(obj.dims[1] + obj.dims[0]) / 2, -(obj.dims[3] + obj.dims[2]) / 2, 0] self.add_model(filename, obj) wx.CallAfter(self.Refresh)