G-code is the common name for the widely-used computer numerical control (CNC) programming language defined in EIA-274.
Questions tagged [g-code]
117 questions
2
votes
2 answers
Python - Problem multiple "or" conditions in a if statement for gcode modifier
I am working on a script to modify some gcode for a school project. My programming skills are very poor but I am working on this with the help of the internet, but go stuck on a if statement with 3 different options.
I need for this to select the…

otto
- 23
- 2
2
votes
1 answer
Executing g-code from file within a ST-program in the software Automation Studio from B&R
I have a 3-axis system, which resembles the CNC-axis, and a PowerPanel from B&R. Now I plan to execute the g-code, which I read from a file, which is fe located in the Downloads folder. This will be done with fbs from B&R Automation Studio.
I got…

Andreas
- 89
- 1
- 11
2
votes
1 answer
Streaming python to GRBL
I have found a script to send a g-code to GRBL but, i would like this script to repeat 30 times.
how do i write this into the code?
The code i am trying to repeat is
G91Y-20X15F500
G90Y3.00F250
I have research on while and loops but i do not…

corey james
- 21
- 2
2
votes
1 answer
Python code to convert a plt file into gcode with a specific format
I'd like to convert a set of coordinates from one file format to another. It's for a drawing machine, like a plotter.
The first file is a plt file that looks like this:
PU-3410,7784;PD-3373,-2281;PU16705,7978;PD16435,5325; (continues for thousands…

Pierre P
- 21
- 2
2
votes
1 answer
Edit G code Line by Line
I want to read a g code file line by line, and based off of a comment at the end, do an action to it. The g code is coming out of Slic3r. Some example lines in no particular order look like this:
G1 Z0.242 F7800.000 ; move to next layer (0)
G1…

paperstsoap
- 335
- 4
- 13
2
votes
1 answer
G-Code - Decrypting Z-Code to G-code
I have a Zortrax m200 3d printer which you may/ may not be familiar with. It is closed source, and uses its own proprietary software to produce Z-code files which should in principal be almost identical to G-code.
My curiosity has kicked in and I'm…

Felix Fried
- 21
- 1
- 2
2
votes
2 answers
Check if regex group exists in result
I'm trying to extract data from a line of gcode which can look like ANY of the following:
G01 X10. Y20. Z3.0 F15.
G00X.500Y-10.
G01 Y10.X20.150
Now I already created my regular expression that matches this perfectly with…

Xander Luciano
- 3,753
- 7
- 32
- 53
2
votes
1 answer
DIY G-code from scratch. (in BASIC)
Does anyone know where I can find the parameters and mathematical formulas for the G-code commands if I want to program a G-code interpreter from scratch.
Been using Google but can't find anything that explains it or gives a simple list over them.…

MrZwing
- 93
- 1
- 4
2
votes
1 answer
Clearing offset numbers
Is it better to clear RCompOffset and ToolLengthOffset with G40 and G53 respectively or is it better to clear them with G42D0 and G54H0?
Would G41D0 clear an LComp too?

AppFzx
- 1,445
- 2
- 14
- 23
1
vote
0 answers
Marlin if else goto commands
I'm using marlin & gcode macros m810-m819 assigned to 2 external buttons. There is 7 positions X & Y that I want to control via the 2 buttons. I have assigned each of the 7 positions to a macro and can run the macro on its own by pressing the…

DanWil347
- 11
- 1
1
vote
0 answers
How can I open a file in the SD card of a Marlin 3d printer and read its contents to a cha*?
I need to write a custom function to add it to the Marlin (2.x.x) Firmware with the cardreader.h library (Anycubic Kobra max firmare) in order to read a gcode file and extract the comments in the beginning (thumbnail data). My code does not return…

Vasileios Antoniadis
- 79
- 1
- 12
1
vote
2 answers
pcb2gcode fails install in Arch due to gerbv version not being detected
I'm attempting install of pcb2gcode on Manjaro Arch. I have tried every PKGBUILD file I can find online, and nothing is working for me. I've explicitly installed multiple versions of gerbv package to try to fulfil the dependency, and rerun the…

frustrashinz
- 11
- 2
1
vote
1 answer
Beautiful soup parser limits
I'm trying to scrape the links to the 400 models listed on this website: https://www.printables.com/model?category=14&fileType=fff&includeUserGcodes=1, which I refer to as webpage in my code below. However, when I run my code, I get no…

ablam
- 129
- 8
1
vote
1 answer
Applying YACC to GCODE (GRBL)
GCode is language used to tell multi-axis (CNC) robots how to move.
It looks like this :
M3 S5000 (Start Spindle Clockwise at 5000 RPM)
G21 (All units in mm)
G00 Z1.000000 (lift Z axis up by 1mm)
G00 X94.720505 Y-14.904622 (Go to this XY…

Richard
- 1,070
- 9
- 22
1
vote
0 answers
TwinCAT 3 - Manage I/Os via GCode / program M Commands
What I'm trying to achieve is to switch on and off specific I/Os via gcode call.
In some motion controllers I worked before, that could be done with an M-command (i.e. M10Pn, where n indicates the pin address).
For example:
Move to position X10…

piter123
- 61
- 1
- 3