diff --git a/GCodeRenderer.py b/GCodeRenderer.py index 3fb3062..9db779a 100644 --- a/GCodeRenderer.py +++ b/GCodeRenderer.py @@ -78,8 +78,8 @@ class Renderer(): y = None if (prev_x != x and prev_x is not None) or (prev_y != y and prev_y is not None): - self.svg_context.line_to(prev_x - self.settings.head_x_offset, prev_y) - self.svg_context.line_to(x - self.settings.head_x_offset, y) + self.svg_context.line_to(prev_x, prev_y) + self.svg_context.line_to(x, y) self.svg_context.stroke() print("Largest X : " + str(largest_x)) @@ -88,14 +88,14 @@ class Renderer(): print("Largest Y : " + str(largest_y)) print("Smallest Y : " + str(smallest_y)) - if largest_x > self.settings.bed_max_x: + if largest_x > self.settings.canvas_x: print("X OVERFLOW") - if largest_y > self.settings.bed_max_y: + if largest_y > self.settings.canvas_y: print("Y OVERFLOW") - if smallest_x < self.settings.bed_min_x: + if smallest_x < 0: print("X_UNDERFLOW") - if smallest_y < self.settings.bed_min_y: + if smallest_y < 0: print("Y_UNDERFLOW") self.save_surfaces() @@ -108,7 +108,7 @@ class Renderer(): # Save the SVG so we can view it, then immediately reopen it so it's ready for a re-render self.svg_surface.finish() os.rename("tmp/rendered-output-t.svg", "tmp/rendered-output.svg") - self.svg_surface = cairo.SVGSurface("tmp/rendered-output-t.svg", self.settings.bed_actual_x, self.settings.bed_actual_y) + self.svg_surface = cairo.SVGSurface("tmp/rendered-output-t.svg", self.settings.canvas_x, self.settings.canvas_y) self.svg_context = cairo.Context(self.svg_surface) # def render(self): diff --git a/Svg2GcodeConverter.py b/Svg2GcodeConverter.py index 3d8ff6d..ecde906 100644 --- a/Svg2GcodeConverter.py +++ b/Svg2GcodeConverter.py @@ -14,12 +14,8 @@ class Svg2GcodeConverter: self.gcode_preamble = ''' G91 ; Set to relative mode for the initial pen lift - G1 Z20 ; Lift head by 20 + G1 Z1 ; Lift head by 1 G90 ; Set back to absolute position mode - M107 ; Fan off - M190 S0 ; Set bed temp - M104 S0 ; Set nozzle temp - G28 ; home all axes G0 F{1} ; Set the feed rate G1 Z{0} ; Move the pen to just above the paper '''.format(1, self.settings.speed) diff --git a/main.py b/main.py index 9b59d33..d0d3a1b 100644 --- a/main.py +++ b/main.py @@ -31,7 +31,7 @@ class Settings: # Whether we render lift markers self.lift_markers = False - + self.lift_counter = 0 # ============ CALCULATED VALUES =========== self.distance_between_centers = abs(self.left_pulley_xy_offset[0]) + self.canvas_x + self.right_pulley_xy_offset[0] @@ -128,7 +128,7 @@ class Tracer(Tk): self.render() def render(self): - self.image_converter.convert_image(self.filename) + self.image_converter.convert_image(self.filename, self.image_converter_settings) self.gcode_converter.convert_gcode() self.cairo_renderer.clear_screen() @@ -157,10 +157,6 @@ class Tracer(Tk): self.n.add(self.f2, text="Original") self.label1.pack(expand=True, fill="both") - - - - if __name__ == "__main__": Tracer()