# HG changeset patch # User mbayer # Date 1464941169 -7200 # Node ID 11f6d97f83b0d2e64c596f3ae0c07988bf59a367 # Parent d93a721621bd4599a133abc5a29a33281c4b9a27 forgot svg preamble & postamble diff -r d93a721621bd -r 11f6d97f83b0 printrun-src/printrun/laser.py --- a/printrun-src/printrun/laser.py Fri Jun 03 10:05:45 2016 +0200 +++ b/printrun-src/printrun/laser.py Fri Jun 03 10:06:09 2016 +0200 @@ -281,10 +281,35 @@ def svg2gcode(self, filename, bed_max_x = 200, bed_max_y = 200, smoothness = 0.2): self.log("Generating paths from SVG...") - preamble = "" + preamble = """ +; Filename: %s +; GCode generated by bitplotter one-night-quick-hack script (marlin code flavour) +; 2015/2016 by NeoSoft - Malte Bayer + +G21 ; Metric +; We assume Z is in focus height and laser head is focus at bottom left of image! +G92 X0 Y0 E0; set zero position - new origin +G90 ; absolute positioning +M82 ; Set extruder (laser) to absolute positioning +M201 X1000 Y1000 E500 ; Set acceleration +M203 X1000 Y1000 Z4 E10 ; Set max feedrate +M209 S0 ; disable firmware retraction, we dont want to burn holes... +M302 ; Allow cold extrudes - doesnt matter because we hack the extruder physically off with the M571 E mod +M571 S1 E1 ; Activate Laser output on extrusion, but block real motor movement! +G0 X0 Y0 F%d ; Set moving speed TRAVEL_SPEED +G1 X0 Y0 F%d ; Set linear engraving speed ENGRAVE_SPEED + +""" % (filename, TRAVEL_SPEED, ENGRAVE_SPEED) + self.log("Travel/Engrave speed: %d mm/sec, %d mm/sec" % ( + TRAVEL_SPEED / 60, ENGRAVE_SPEED / 60) ) + postamble = "" shape_preamble = "G92 E0\n" - shape_postamble = "" + shape_postamble = """M571 S0 E0 +M501 ; undo all settings made + +""" + """ Used to control the smoothness/sharpness of the curves.