3D printing g code generator


YouTuber develops open-source custom G-code generator for 3D printing

0Shares

Technology YouTuber Create Inc has developed an open-source 3D printing G-code generator that allows users to create custom G-code without the need for a 3D model.

Inspired by the FullControl GCODE Designer developed by Loughborough University’s Dr. Andrew Gleadall, Create Inc’s browser-based version has been implemented as a website, making it a more accessible option. The software ultimately enables users to control every aspect of an FFF build’s toolpath, line-by-line, paving the way for previously impossible geometries such as support-free string structures and highly customizable lattices.

Create Inc explains, “A typical 3D printing pipeline has four steps. You or someone else creates a model for you to export and load it into a slicer (1). The slicer will then generate the G-code for you (2). You take this G-code and you transfer it to a printer of your choice (3), and the part is printed (4). My aim is to get rid of the first two steps, and directly generate the G-code. It’s not an approach that would work for every type of print, but it’s definitely an approach that opens up new avenues for us.”

A custom multi-material Christmas tree model designed using Create Inc’s G-code generator. Photo via Create Inc.

What is G-code?

To understand the novelty of Create Inc’s G-code generator, it’s essential to understand what G-code actually is. G-code isn’t something that’s necessarily specific to 3D printing (as it’s also used in CNC machining operations), but it can be thought of as the ‘language of 3D printers’. It’s a programming language used to map out the path of a system’s toolhead over the course of a build, determining when the nozzle moves, stops, and extrudes.

The vast majority of any G-code file typically consists of two main commands: G0 and G1. The former is a very simple function that tells the printer where to move without extruding any filament, while the latter prints a straight line according to the XYZ coordinates defined in its list of parameters. Some of the other parameters associated with these commands include the travel speed, material flow rate, cooling rate, and much more.

Create Inc designing a custom G-code. Image via Create Inc.

The power of fully customizable G-code

While the combination of conventional 3D CAD software and slicing software is generally sufficient for designing most types of geometries, it still doesn’t give us full control over a printer’s movements. For example, using programs like SOLIDWORKS and Cura, it’s near impossible to 3D print pine tree-like spiny structures, a complex web-like mesh with sets of interlocking ‘strings’, or non-planar toolpaths that emulate mathematical functions like sinusoids.

For each of these parts, a custom line-by-line G-code is necessary, but commercial slicers and engineering design programs simply don’t have the functionality. Create Inc’s online G-code generator took him around two weeks to develop, and enables users to string together combinations of G0s and G1s in a programmatic manner. The website also has a graphical toolpath viewer that showcases all of the individual commands as they are added, enabling users to design geometries that would otherwise be tedious or downright impossible.

Create Inc’s open-source 3D printing G-code generator can be found here.

The open-source 3D printing community is a petri dish for innovation, delivering novel hardware and software previously unseen. Just this month, 3D printing content creator Teaching Tech 3D printed and showcased his own open-source version of a rare antique fractal vise. Unlike a standard straight vise, which is typically only capable of clamping straight objects, the 100 year old fractal design is capable of morphing to grip virtually any part, regardless of the complexity of the geometry.  

Elsewhere, an MIT student that goes by the name of Lucas VRTech has previously designed and 3D printed a pair of low-cost finger tracking gloves for use in virtual reality. Named LucidVR, the open-source gloves grant users the ability to precisely track their fingers without the use of dedicated VR controllers.

Nominations for the 2021 3D Printing Industry Awards are now open, have your say in who is leading the industry now.

Subscribe to the 3D Printing Industry newsletter for the latest news in additive manufacturing. You can also stay connected by following us on Twitter, liking us on Facebook, and tuning into the 3D Printing Industry YouTube Channel.

Looking for a career in additive manufacturing? Visit 3D Printing Jobs for a selection of roles in the industry.

Featured image shows Create Inc. Photo via Create Inc.

Tags Andrew Gleadall Create Inc cura FullControl GCODE Designer Loughborough University solidworks

Kubi Sertoglu

Kubi Sertoglu holds a degree in Mechanical Engineering, combining an affinity for writing with a technical background to deliver the latest news and reviews in additive manufacturing.

Generating G-CODE for every 3D printer

  • Home
  • Products & Solutions

The postprocessor module implemented in the SOFTSHAPER software is mostly responsible for the G-CODE generation process based on the toolpaths which are generated by the program.

Get a quote

SOFTSHAPER MACHINE INTELLIGENCE

Generating G-CODE for every 3D printer

The postprocessor module implemented in the SOFTSHAPER software is mostly responsible for the G-CODE generation process based on the toolpaths which are generated by the program.

The generation process is based on the declared parameters of the printing device. Each device can have a dedicated saving format of the interpreted code and special executive, preparation and preliminarily-terminating functions.

The module has been equipped with the possibility to parameterize the values responsible for:

  • workspace,
  • geometry of executive elements including offsetting,
  • executive heating elements including function of setting the limits as: heated plate, heated chamber and a head for each head individually,
  • parameterization of the start and end code using predefined functions with the possibility of editing,
  • function parameterization by modifying the M-CODE and G-CODE records with the option of defining a procedure.

In addition to specialized equipment and advanced users was implemented the mechanism of the program description G-CODE generation. Based on the knowledge of PYTHON user can effect on the process of indirect code interpretation, which allows having a process of G-CODE generation under control. Properly prepared API allows to modify the record of the functions and also user can add its own. Also, the implementation of the programming language allows extending the scope of generator capabilities, because the programmer can make additional conversions and modifications of the values calculated by the program in the postprocessor.

The set of postprocessor module functionality prepared in this way enables the SOFTSHAPER application to generate code for every available 3D printer, which makes it a universal program in terms of the printing device used.

SOFTSHAPER 2022

Innovative CAM software for 3d printing

Buy now

G-CODE in Russian for 3D printing (Mini-guide)

Often, for high-quality printing, and especially when selecting print parameters, it is necessary to be able to read and edit the G-code during calibration.

A commonplace example: setting your own values ​​for the "Temperature Tower" or creating start and end blocks of codes in slicers for a specific printer.

On some sites (like reprap.org/wiki/G-code) on the Russian-language pages, the commands are only partially described in Russian, and the rest in English. On some domestic sites, the commands are translated into Russian, but some are given with errors - stupidly copy-paste a clumsy translation. nine0003

Tired of searching through different sites, trying to find the CORRECT description of a particular command and its parameters.

I made myself such a mini-reference book. I'll be glad if anyone else finds it useful.

I tried to describe the maximum number of commands used, except for very specific ones.

(Yes, special commands for deltas, for example, sorry, I consider them specific and not necessary for me)

However, most commands are supported by all printers and firmware.

Attention! Compliance of commands and parameters is checked only for Marlin firmware.

G-commands

G0(G1) Xnnn Ynnn Znnn Ennn Fnnn – movement.

G0 - fast idle

G1 - linear working travel

Xnnn, Ynnn, Znnn – coordinates.

Еnnn - amount of extruded material in mm (with negative values ​​- retract).

Fnnn – travel speed in mm/min (this speed will be used until the next change). nine0003

G0 X12 (will move 12mm in X)

G0 F1500 (Set travel speed to 1500 mm/min.)

G1 X90.6 Y13.8 E22.4 (Move 90.6mm in X and 13.8mm in Y while extruding 22.4mm of material. )

G4 .

Pnnn - Timeout, in milliseconds

Snnn - Timeout in seconds.

"G4 S2" and "G4 P2000" - equivalent to

G10 - Plastic rollback (Retract)

Filament rollback according to M207 settings.

G11 - Plastic feed

Feed / reposition the head according to M208 settings.

G20 - Inch unit setting

G21 - Setting the units in millimeters nine0027

From now on, the reading will be in inches/millimeters.

G28 - Move to start ("home") until limit switches actuate

G28 – home on all axes.

G28 X Z - Move home only in X and Z axes

G29 - Create table curvature mesh (MESH_BED_LEVELING)

The command allows you to create a compensation (Z-height) grid and use it later when printing. The grid can be used repeatedly even after the printer is turned off. nine0003

After using the G28 command, the mesh created by the G29 command flies off.

It is necessary to save the rhinestone mesh after it has been created! To recall the grid from memory, use the M420 command.

Be sure to use G28 before using G29, otherwise the mesh will be incorrect.

Creating Mesh Bed Leveling manually (via commands):

1. Enter G29 S0 to start meshing.

2. Enter G29 S1 to set the first grid point. nine0003

3. Align the nozzle with paper (as usual).

4. Enter G29 S2 to save the value and jump to a new point

5. Repeat steps 3 and 4 until the creation procedure is completed.

6. Enter M500 to write the resulting mesh to EEPROM.

Creating Mesh Bed Leveling using the printer menu (the function must be active in the firmware):

1. Select Prepare followed by Auto home (aka G28 command). nine0003

2. Select Prepare and then Level Bed.

3. Wait for on-screen instructions to begin. Press the "twist" on the screen when the inscription "Click to Begin" appears. The head will go to the first grid point.

4. Use the thumbwheel to raise or lower the nozzle to align the nozzle with the paper. Same as when leveling the table. After you have achieved the desired gap between the nozzle and the piece of paper, press the "twist". The head will move to a new grid point.

5. Repeat step 4 until the program has passed all points. nine0003

6. When finished, enter the Control menu and select the Store memory item to save the created mesh to EEPROM.

To use the grid stored in EEPROM when printing, use the command

M420 S1 (See M420).

G90 - Setting absolute coordinates

All coordinates are absolute relative to the machine origin.

G91 - Set relative coordinates nine0027

All coordinates from now on become relative to the last position. Marlin translates all axes into relative coordinates, including the extruder.

G92 Xnnn Ynnn Znnn Ennn - Set position

This command can be used without any additional parameters.

G92 - reset all axis coordinates to zero.

Xnnn - new X coordinate nine0003

Ynnn - new Y coordinate

Znnn - new Z coordinate

Ennn - new extruder position

Example: G92 X10 E90

M-commands

M17 - Enable/Enable all stepper motors

M18 - Remove current from motors

Motors can be turned by hand. Command analog M84

M20 - List of files on SD card

M21 - SD card initialization

If the SD card is loaded when the printer is turned on, this will happen by default. The SD card must be initialized for other SD card functions to work.

M22 - Release SD card

The specified SD card will be released. On future (random) read attempts, a guaranteed error occurs. Useful before removing the SD card. nine0003

M23 - Select file on SD card

Example: M23 filename.gco

M24 - Start/continue printing from SD card

The printer will print from the file selected with the M23 command.

M25 - SD card print pause

M28 - Start writing to SD card

Example: M28 filename.gco.

A file is created on the SD card, designated as filename.gco (if the file exists, it is overwritten) and all subsequent commands to the printer are written to this file. nine0003

M29 - Stop writing to SD card

Example: M29 filename.gco

The file opened by the M28 command is closed and all subsequent commands are executed by the printer in normal mode.

M30 - Delete file from SD card

Example: M30 filename.gco. filename.gco will be deleted.

M32 - Select file and start printing from SD card

Example: M32 filename.gco.

Used for SD card printing and works the same as M23 and M24

M80 - Enable ATX Power Supply

Puts the ATX power supply into sleep mode. Does not work on electronics without sleep mode.

M81 - Turn off the ATX power supply

M82 - Set the extruder to absolute mode

M83 - Set extruder to relative mode

Allows extruder to be extruder in absolute/relative units

M84 SNNN X, Y, Z, E - transfer motors to the waiting mode of

SNNN - time per seconds.

If a timeout is specified with Snnn, this command simply sets the stepper motor inactivity timeout.

If no motors (X,Y,Z or E) are specified, this command immediately disables all.

If one or more axes are specified, this command disables the specified ones immediately. For example, "M84 S10" will put stepper motors into standby mode after 10 seconds of inactivity.

M92 Xnnn Ynnn Znnn Ennn - Set the number of steps per axis per unit

Ennn - steps per unit for extruder nine0003

Examples: M92 X87.489 Y87.489 Z87.489 or M92 E420

Allows you to set the number of steps per unit (usually mm) for motors. These values ​​are replaced with the values ​​from the firmware at power up unless written to the EEPROM see M500.

M104 Snnn - Set extruder temperature and DO NOT wait

Snnn - Set temperature

Example: M104 S190

Sets the temperature of the active extruder 190C and immediately returns control (that is, DOES NOT WAIT for the extruder to reach the set temperature). See also M109

M105 - Get Extruder Temperature

Gets the temperature of the active extruder and hot bed in degrees Celsius. The temperature is transmitted to the connected computer. The response sent to the computer might look like this: ok T:201 B:117

M106 Snnn - Turn on the fan blowing part

SNNN - fan rotation of fan from 0 to 255 (127 - 50% speed)

m107 - turn off the fan

m108 - cancel the heating 9000 9000 temperature set by M109 and M190, continues printing.

M109 Snnn - Set extruder temperature and wait

Sets the temperature in Celsius and waits for it to be reached. See also M104

M110 Nnnn - Set current line number

Nnnn - Line number

Example: M110 N123

In this example, the number of the current line 123 is set. Thus, it is expected that the next line after this command will be 124.

M112 - Emergency Stop

m114 - receipt of current positions 9

M115 - Get a firmware version

m119 - get the status of ends

m140 - set the temperature of the table and DO NOT wait

Example: M140 S65

Sets the table temperature to 65C and immediately returns control (ie DOES NOT WAIT for the table to reach the set temperature). See also M190

M190 - Set table temperature and wait

Sets the temperature in Celsius and WAITS to reach it. see M140

M200 Dnnn Tnnn - Set the REAL diameter of the filament rod.

Dnnn – diameter in mm.

Tnnn – extruder number. (can be omitted for single extruder printers)

Example: M200 D1.65

Used to calculate the actual extruded volume. nine0003

See M404 for rating setting.

M201 Xnnn Ynnn Znnn Ennn - Setting of the maximum accelerations (in mm/s in sq.)

for axes.

Ennn - accelerations in mm/s in sq. for the extruder.

Only one/two of the parameters can be used.

Example: M201 X1000 Y1000 Z100 E2000

Use M500 to store parameters in EEPROM

M202 - Setting the maximum acceleration for simple (idle) movement.

!Not used in Marlin! V mm/s in sq. Example: M202 X1000 Y1000

M203 Xnnn Ynnn Znnn Ennn - Setting the maximum speed (in mm/s)

Xnnn, Ynnn, Znnn - max speed for axes

Ennn - max extruder speed. nine0003

Only one/two of the parameters can be used.

Example: M203 X6000 Y6000 Z300 E10000

Use M500 to store parameters in EEPROM.

M204 Pnnn Rnnn Tnnn - Acceleration setting (in mm/sec. in sq.)

Pnnn - Printing acceleration

Rnnn – Retract Acceleration

Tnnn - Accelerations during idle movements

Only one/two of the parameters can be used. nine0003

Example: M204 P800 T3000 R9000

Use M500 to store parameters in EEPROM.

M205 Xnnn, Znnn, Ennn - Setting the maximum jerk (jerk) (mm / s)

Xnnn - jerk along the X and Y axes. (Jerks are the same along these axes)

Znnn - jerk along the Z axis.

Ennn - extruder jerk.

Only one/two of the parameters can be used.

Example: M205 X30 Z5 - Set jerk X/Y = 30, Z jerk = 5. nine0003

Use M500 to store parameters in EEPROM.

М206 Xnnn, Ynnn, Znnn - Set offsets relative to limit switches (zero)

Similar to G92 command, but these offsets can be written to EEPROM see M500.

Example: M206 X10.0 Y10.0 Z-0.4

M207 Snnn Fnnn Znnn - Set retract parameters (bar retraction)

Snnn - positive retract value in mm. nine0003

Fnnn – feedrate mm/sec.

Znnn - lift (lift) of the head along the Z axis in mm during retract. (Helps avoid hitting the model)

Example: M207 S4.0 F2400 Z0.075

Used subsequently for G10 and G11 commands.

Use M500 to store parameters in EEPROM.

M208 Snnn Fnnn – Bar feed recovery parameters after retract

Snnn – positive feed value in mm. nine0003

Fnnn – feedrate mm/sec.

Use M500 to store parameters in EEPROM.

M209 Snnn – On/off automatic retraction

Snnn – value 1 – on, 0 – off

Used if the slicer does not support the G10 and G11 commands.

Each extrusion command will be classified as a retract, depending on the value (positive or negative).

M218 Tnnn Xnnn Ynnn – head offset setting

Tnnn - head number

Xnnn, Ynnn – X,Y coordinates.

Example: M218 T0 X50 Y10.5

M301 Hnnn Pnnn Innn Dnnn — Write hotend PID parameters(!)

Hnnn – extruder number. h2 - the first exruder (hotend).

Pnnn - Proportional gain (Kp)

Innn - Integral factor (Ki) nine0003

Dnnn - Derivative coefficient (Kd)

Example: M301 h2 P1 I2 D3

Use M500 to store parameters in EEPROM.

See M304 for writing table PID.

M302 Snnn - Allow extrusion at Snnn and above.

Snnn - Set temperature

Example: M302 S170 – enable extrusion (turn on the extruder motor) at a nozzle temperature of 170C and above. M302 S0 - extrude at any temperature. nine0003

M303 Ennn Snnn Cnnn - Start PID calibration process for table/hotend

Ennn - E0 hotend, E1 table.

Snnn is the calibration temperature.

Cnnn – number of calibration cycles. More cycles - more precise parameters.

Example M303 E1 C8 S110 – table PID calibration at 110C for 8 cycles.

The PID parameters will be displayed as a string on the terminal screen of a program running in connection with the printer, such as Repetier-Host. nine0003

M304 Pnnn Innn Dnnn - Write table PID parameters(!)

Pnnn - Coefficient proportional (Kp)

Innn - Integral factor (Ki)

Dnnn - Derivative coefficient (Kd)

Example: M301 h2 P1 I2 D3

M301 - without parameters will display the current parameters.

Use M500 to store parameters in EEPROM.

For writing extruder PID see M301. nine0003

М404 Wnnn - Setting the nominal filament thickness 1.75 or 3.

Wnnn - nominal (theoretical) filament thickness in mm.

Example: M404 W1.75

M404 - without parameters, will display the current nominal value as a string.

This value is used to determine the percentage difference in the automatic rate adjustment in response to the measured filament width and must match the value used for the filament width in slicer settings. nine0003

Set actual filament thickness, see M200.

М420 Snnn – Enable/disable the use of the table curvature compensation grid (MESH_BED_LEVELING)

Snnn – S1 on, S0 off.

M420 S1 – use the table curvature compensation grid loaded from EEPROM when printing.

See G29 to get the current status and create a table curvature compensation grid.

M500 - Save data to EEPROM

M501 - Reading data from EEPROM

M600 - Command for automatic filament change

3D Printing G-code Basics: List and Guide

3DPrintStory