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
12
votes
4 answers
Finding center of a circle given two points and radius
I'm writing a G-Code interpreter and am having difficulties determining the center of a circle when given (X, Y) for two Points on the circle and the radius. I can plot a circle from 2 Points when given the center coint, but if a radius value is…

ryan lindsey
- 145
- 1
- 1
- 9
7
votes
2 answers
Looking for G Code syntax specification, trying to make simple G Code parser
I'm trying to find a definitive G Code syntax specification, NOT the individual G Codes meaning, specification for this i everywhere, i mean detailed syntax specification, for the purpose of writing a parser.
I have no problem writing a parser, i'm…

staviq
- 71
- 1
- 3
6
votes
2 answers
How to send one gcode command over USB?
I am trying to write a simple python script that sends a gcode command to my wanhao D9 motherboard printer, running Marlin. I am running the python script on a raspberry pi that is connected to the printer via USB.
import serial
ser =…

C.Gibbons
- 183
- 1
- 11
4
votes
1 answer
What's a good way to display a lot of text in QT
I'm building an app that will read in a gcode file. Files range from a few KB to a few hundred MB (but that's rare). After a user selects a file, the program goes through it and reads it line by line. This doesn't take long at all.
I want to…

Memnarch1113
- 99
- 1
- 8
4
votes
1 answer
Simple python program to read . gcode file
I am completely new to Python and I wanted to create a simple script that will find me a specific value in a file and than perform some calculations with it.
So I have a .gcode file (it is a file with many thousands of lines for a 3D printer but it…

Bart
- 101
- 4
- 11
4
votes
2 answers
Algorithms and libraries for mesh slicing/outlining?
I'm looking to learn more about the process of slicing a mesh into gcode, a process that takes a 3d model and creates 2D slices of an object that a CNC machine or 3D printer can use.
What mathematical algorithms are used to perform this type of…

Tim
- 71
- 1
- 4
4
votes
1 answer
Sending the right Gcode string to a Serial Port?
I am trying to send the gcode g28 to my RepRap 3D printer through the line port.Write("g28");.
My program connects to the right serial port however when I try sending the information as string the access to the com port gets denied. This is strange…

Arthur Mamou-Mani
- 2,303
- 10
- 43
- 69
3
votes
1 answer
Using pySerial to send gcode
This may be a bit of a long shot but I can't figure out the problem here. I'm trying to build an interface on my laptop using tkinter and pySerial to control my 3D-printer. I've got a function that contains this piece of code (Yes, I imported time…

Nick
- 51
- 2
3
votes
2 answers
Replace instances of certain string in between two strings
I am trying to create a VBScript to find and replace a certain string located between two strings. Here is an example of a file that the script will be executed on:
%
N1 ( POSTED FILE NAME - WORKNC POST )
N2 ( INPUT FILE NAME -…

D.Herl
- 43
- 6
3
votes
1 answer
How can I add a custom programing language to NotepadQQ?
In NotepadQQ, I would like to add G-code and PLC (FBD, LD, ST, IL and SFC) programing language definitions/syntax code highlighting. Is this possible for a user to do this? How is it done? I found a post about how to add a language…

Geoffrey Wheeler
- 133
- 7
3
votes
3 answers
Loop and condition by g-code command
How I can make and stop loop at selected condition using G-code?
For example, I have the following G-code commands:
G10 L2 P1 X-10. Y-10. Z-10
G10 L2 P2 X-10. Y-11. Z-10
G10 L2 P3 X-10. Y-12. Z-10
I would like to create loop, which repeats my…

mark
- 139
- 1
- 1
- 8
3
votes
2 answers
Circular approximation of polygon (or its part)
SHORT DESCRIPTION OF MY PROBLEM
I need to implement GCODE autorefactoring from G1 instructions to G2 and G3 (http://www.cnccookbook.com/CCCNCGCodeArcsG02G03.htm) for 3D Printing.
G1 is a movement in straight line with printing (path is describe by…

Mr.Qbs
- 152
- 2
- 9
3
votes
1 answer
Needed tutorial on FANUC GCODE
G-code is a language for controlling CNC machines (lathes, mills).
I have a university assignment that I need conceptual help with. The part of the job that I am having problems with is writing two short programs in G-code (Fanuc corporation…

Vorac
- 8,726
- 11
- 58
- 101
2
votes
1 answer
Kate Text Editor regexp for CNC code alteration on PC
When using some CAM software, the CNC code is usually generated properly with spaces.
But for example when moved to "Citizen Cincom L20" machine via USB or network and edited there it lose spaces and also lose semicolons while preserving new lines…

PovilasCNC
- 23
- 5
2
votes
1 answer
generate G-code | decompose b-spline to circular sections
I'm trying to decompose a b-spline to a set of circle definitions.
I'm trying to generate G-code; the idea here is to segment a b-spline into a number of circular interpolations [ G02 ]. Using PythonOCC I can break up the b-spline into a number of…

Jelle
- 690
- 4
- 13