Help with GCode

I am trying to figure out a way to adjust gcode generated in another slicer software.
What I am trying to do is select all of the points close to a surface and re-project them to another surface (basically a displace) and re-adjust the Extrude value, then stitch the result back with the rest of the points that weren’t touched by the displacement.

I don’t just want to displace prior to slicing because I would like to also move them in z direction and maybe change the Extrude amount.

What would be the basic building blocks of that setup?

This is risky business, so you’ll definitely need a way to preview.

I’m not sure what of gcode you’re using or machine, but since you say slicer, I’ll assume it 3d printing.

Steps would be:

  1. Read gcode file
  2. Parse gcode into moves with speed and extruder value. There are probably modal values which you’ll need to be aware of. Depending on the flavour of gcode this could be highly varied.
  3. Modify moves with your surface logic. Modify corresponding speeds or extruder speed correspondingly
  4. Format moves back to original format
  5. Preview somehow
  6. Cross your fingers and hope for the best
1 Like