automatically preprend config.g to the job

master
Phuck 2 years ago
parent b625df62bb
commit 0fbb5ee9e2

@ -4,10 +4,12 @@ The hacked together pipeline is as follows given an svg `$SVG`. You may use the
1. Ensure that your SVG has a size set that fits in Ooza
1. One way to ensure is by setting width & height on the root `<svg>` element
2. Covert the SVG to gcode via `cargo run --release -- $SVG -o $OUTFILE`
3. Rewrite the gcode to center where the print happens via `python rewritegcode.py $OUTFILE $UPDATEFILE`
4. Generate the final file by concatenating the header to the updated file via `cat ooza/config.g $UPDATEFILE > $FINALEFILE`
5. Upload `$FINALFILE` to Jobs in Duet and run it
1. Convert the SVG to gcode via `cargo run --release -- $SVG -o $OUTFILE`
1. Rewrite the gcode to be compatible with Ooza via `python rewritegcode.py $OUTFILE $FINALFILE`. This will do a few things:
1. Exit with an error message if the print would go outside the bounds of Ooza
1. Rewrite the coordinates to center where the print happens
1. Prepend the header in `ooza/config.g` to the rewritten gcode
1. Upload `$FINALFILE` to Jobs in Duet and run it
# svg2gcode

@ -19,6 +19,8 @@ MAXX = 650
MINY = 200
MAXY = 1000
OOZA_HEADER_PATH = "ooza/config.g"
@dataclass
class GCodeInfo:
@ -136,7 +138,10 @@ def rewrite_gcode(infile, outfile):
print(format_info_error(info))
return 1
outfile.write(lines)
with open(OOZA_HEADER_PATH) as fp:
header = fp.read()
outfile.write(header + lines)
return 0
if __name__ == "__main__":

Loading…
Cancel
Save