I’ve created a slicer and it generated G code that looks like this and has the Z axis on every line
I’d like to remove the redundancy and have the Z display once at the beginning of every layer, like this
How can it be accomplished?
I’ve created a slicer and it generated G code that looks like this and has the Z axis on every line
I’d like to remove the redundancy and have the Z display once at the beginning of every layer, like this
How can it be accomplished?
To slice or splice that is the question!
that’s what happens when I don’t have enough coffee … Thank you for pointing out my misspelling in such a polite and professional manor.
OK, so you could try the following:
If you upload a sample file, I can show you how.
Are you talking about doing this manually or format it in grasshopper?
Grasshopper.
You can use notepad or excel.
Try to import your file to notepad and delete the z axis by replace command,ctrl+h, (find Z13.350 and repace by nothing - leave the box blank) and save your edited file.
Something like that, but need it to work every time the Z changes
End Result needs to look like this
@oberbichler II know very little python … made one small edit to your code and your gocod.gh works great except for a bug or two …
Extra spaces where they are unwanted
Hi,
I am a bit busy at the moment but maybe I will find some time during the next days. Can you send me an example GH file including the gcode to reproduce this images?
BTW: What is the parentheses code doing? I only use a basic subset of gcode.
Best
I have a Friend that knows python he was able to fix it, see below …as for the Parentheses The printer doesn’t read and information within the Parentheses, that’s where notes for the user are added.
from Rhino.Geometry import *
import re
arg_pattern = re.compile(r"(?P[A-Z])\s*(?P\d*(?:.\d*)?)", re.IGNORECASE)
state = dict(
G = None, # Use G1 as default command from the beginning
M = None,
S = None,
X = None, # Outcomment attributes to disable ‘memory’
Y = None,
Z = None,
)
gcode =
def add_token(tokens, key, value):
if key in state:
if state[key] == value:
return
state[key] =value
token = str(key) + str(value)
tokens.append(token)
for line in lines:
tokens =
for t in line.split():
token_match = re.match(arg_pattern, t)
if token_match:
key, val = token_match.groups()
if key and val:
add_token(tokens, key, val)
else:
tokens.append(t)
else:
tokens.append(t)
new_line = ' '.join(tokens)
if new_line:
gcode.append(str(new_line))
#gcode.append("#")