G-Code Question - G0 Z0.5

Here's the place for discussion related to CAM/CNC and the development of the Path module.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
SaazyPants
Posts: 10
Joined: Wed Nov 24, 2021 4:07 pm

G-Code Question - G0 Z0.5

Post by SaazyPants »

I've been using FreeCAD for a few years as my modeling software however, just recently switched to it for my CAM needs. I'm relatively new to the CAM / CNC world and had a question regarding some G-Code at the beginning of my post file.

I'm utilizing a third party post processor for my SnapMaker 2. When the post processor outputs the gcode for the machine, it starts with the following lines first prior to any of the translated paths from FreeCAD:

G0 Z10.00 F120
G0 Z0.50 F120

I'm curious why it would be advantageous to send the tool to Z = 10mm and then to Z = 0.5mm prior to lifting up to work clearance height to translate over to the first X,Y coordinates to start the cut. This seems like it could cause issues depending on how the WCS system is setup and zeroed. Thoughts?

Code: Select all

if ($hungry) { eat(); } else { sleep(); }
chrisb
Veteran
Posts: 54150
Joined: Tue Mar 17, 2015 9:14 am

Re: G-Code Question - G0 Z0.5

Post by chrisb »

I don't think it causes issues, as there should be nothing above Z0.5.
It's probably just going to clearance height according to the "Heights and depths" section in Path Workbench.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
User avatar
sliptonic
Veteran
Posts: 3459
Joined: Tue Oct 25, 2011 10:46 pm
Location: Columbia, Missouri
Contact:

Re: G-Code Question - G0 Z0.5

Post by sliptonic »

Is that from a Path post or from your third party post?

It looks harmless but also useless. Maybe the z axis is like a 55 year old programmer and needs to limber up before doing physical work. :lol:
SaazyPants
Posts: 10
Joined: Wed Nov 24, 2021 4:07 pm

Re: G-Code Question - G0 Z0.5

Post by SaazyPants »

sliptonic wrote: Thu Jan 27, 2022 2:15 pm Is that from a Path post or from your third party post?
That is from the third party post. I dug through the code in their "_post.py" file and it's added as part of the "header" section before processing what FreeCAD has generated.

sliptonic wrote: Thu Jan 27, 2022 2:15 pm It looks harmless but also useless. Maybe the z axis is like a 55 year old programmer and needs to limber up before doing physical work. :lol:
Haha, indeed! In most cases it's probably harmless though if you were to zero the Z-Axis off the build plate, then Z = 0.5mm is technically "under" the work piece which depending on where X and Y are, could crash. I'm going to remove it from the post processor however I wanted to verify if there was a valid reason you'd want the machine to perform this step even if it was a fringe case.

Code: Select all

if ($hungry) { eat(); } else { sleep(); }
GeneFC
Veteran
Posts: 5373
Joined: Sat Mar 19, 2016 3:36 pm
Location: Punta Gorda, FL

Re: G-Code Question - G0 Z0.5

Post by GeneFC »

SaazyPants wrote: Thu Jan 27, 2022 2:42 pm Haha, indeed! In most cases it's probably harmless though if you were to zero the Z-Axis off the build plate, then Z = 0.5mm is technically "under" the work piece which depending on where X and Y are, could crash. I'm going to remove it from the post processor however I wanted to verify if there was a valid reason you'd want the machine to perform this step even if it was a fringe case.
You need to make very sure that the coordinate origins are correctly set in FreeCAD to match your shop practice. If you want to set Z = 0.0 on the build plate then make sure the FreeCAD model is completely above zero.

Anything else or adding "correction factors" in the post processor invites disaster.

Gene
Post Reply