Freecad marlin post processor

Hey,

Just started a marlin version (or cnc version really) of the grbl post processor script for freecad. So far it can zero the x and y origin for you and I have a hard coded value to move the Z values down so the origin is the work surface, you had to have the heights set in freecad to match for now. (Assume clearance of 5mm, safe of 3mm Z)

Nothing really new about the gcodes, just added comments so I can see what is going on, for example knowing x is offset by -100 is helpful.

Cheers!

EDIT:

New Version: I can swap out gcodes for other code sequences. Don’t know if G81 is a thing, but the FreeCAD drill operation creates it, I simple swap it out for some G1’s.

marlin.zip (4.5 KB)

The reason Zmin and Zmax are high is some goof in my model where I copied and pasted it and it went on top of each other, now I can’t find where to reset it. My pad is 13.5 times 2 plus 5 for clearance = 32. I am using the app image for freecad 0.18, I un-squashed it and I am editing the marlin_post.py file from ~/Documents/squashfs-root/usr/Mod/Path/PathScripts/post

Snippet

(Exported by FreeCAD)
(Post Processor: marlin_post)
(Output Time:2020-06-27 15:18:41.706906)
(begin preamble)
G90
G92 X0 Y0 Z0
G21
(end preamble)

(Xmin is -1.5000 ==> 0.0000)
(Xmax is 321.5000 ==> 323.0000)
(Ymin is -1.5000 ==> 0.0000)
(Ymax is 261.1737 ==> 262.6737)
(Zmin is 13.5000 ==> -13.5000)
(Zmax is 32.0000 ==> 5.0000)

(GCode Commands detected:)

(M6 detected, count is 1)
(M3 detected, count is 1)
(G0 detected, count is 94)
(G90 detected, count is 4)
(G98 detected, count is 4)
(G1 detected, count is 1929)
(G3 detected, count is 146)
(G2 detected, count is 118)

(begin operation: T2: End Mill)
(Path: T2: End Mill)
(T2: End Mill)
(begin toolchange)
; M6 T2
M3 S0.0000
(finish operation: T2: End Mill)
(begin operation: Drilling)
(Path: Drilling)
(Drilling)
(Begin Drilling)
G0 Z5.0000
G90
; G98
(G81) X39.0000 Y96.5000 Z-13.5000 F0.00 R10.0000
G0 X39.0000 Y96.5000 Z5.0000
G1 X39.0000 Y96.5000 Z-5.0000
G1 X39.0000 Y96.5000 Z0.0000
G1 X39.0000 Y96.5000 Z-13.5000
G0 X39.0000 Y96.5000 Z5.0000
(finish operation: Drilling)
(begin operation: Drilling001)
(Path: Drilling001)
(Drilling001)
(Begin Drilling)
G0 Z5.0000
G90
; G98
(G81) X39.0000 Y36.5000 Z-13.5000 F0.00 R10.0000
G0 X39.0000 Y36.5000 Z5.0000
G1 X39.0000 Y36.5000 Z-5.0000
G1 X39.0000 Y36.5000 Z0.0000
G1 X39.0000 Y36.5000 Z-13.5000
G0 X39.0000 Y36.5000 Z5.0000
(finish operation: Drilling001)
(begin operation: Drilling002)
(Path: Drilling002)
(Drilling002)
(Begin Drilling)
G0 Z5.0000
G90
; G98
(G81) X134.0000 Y36.5000 Z-13.5000 F0.00 R10.0000
G0 X134.0000 Y36.5000 Z5.0000
G1 X134.0000 Y36.5000 Z-5.0000
G1 X134.0000 Y36.5000 Z0.0000
G1 X134.0000 Y36.5000 Z-13.5000
G0 X134.0000 Y36.5000 Z5.0000
(finish operation: Drilling002)
(begin operation: Drilling003)
(Path: Drilling003)
(Drilling003)
(Begin Drilling)
G0 Z5.0000
G90
; G98
(G81) X134.0000 Y96.5000 Z-13.5000 F0.00 R10.0000
G0 X134.0000 Y96.5000 Z5.0000
G1 X134.0000 Y96.5000 Z-5.0000
G1 X134.0000 Y96.5000 Z0.0000
G1 X134.0000 Y96.5000 Z-13.5000
G0 X134.0000 Y96.5000 Z5.0000
(finish operation: Drilling003)

1 Like