GcodeWriter
Package: Libraries.Fabrication.Printing · Inherits from: Libraries.Language.Object
The GcodeWriter class writes ordered toolpaths (from PathOrderer) as Marlin-flavoured G-code. - Absolute XYZ (G90), relative extrusion (M83): every G1 carries the filament length for that move alone, which keeps retraction simple. - Extrusion per move = length * lineWidth * layerHeight / filament area. - Layer p is printed at Z = (p + 1) * layerHeight (the slice plane sits in the middle of the layer, the nozzle at its top). - The model is centred on the bed. - Retracts before any travel longer than the retraction minimum and before each layer change; small layers are slowed down, and paused if needed, to get their minimum cooling time. - ;LAYER: and ;TYPE: comments use Cura's names, so G-code previewers can colour moves by feature. SetBambuExtras adds the header block and progress reports Bambu Lab printers use. The printer's own start and end G-code come from two text files (see SetStartGCodeFile). Placeholders like {BED_TEMP} in them are filled in when the G-code is written. If a file doesn't exist it is created from a generic Marlin template, with instructions at the top saying what to paste where, and a warning says so. Statistics (filament used, estimated time) and warnings are available after Write through the Get actions; nothing is printed.
Example Code
use Libraries.Containers.Array
use Libraries.Fabrication.Geometry.Contour
use Libraries.Fabrication.Printing.GcodeWriter
class Main
action Main
Array<Contour> ordered // from PathOrderer:Order
GcodeWriter gcode
gcode:SetLayerHeight(0.2)
gcode:SetLineWidth(0.4)
gcode:SetTemperatures(210, 60)
gcode:SetBed(220, 220)
gcode:SetStartGCodeFile("Templates/ender3-v2/start.gcode")
gcode:SetEndGCodeFile("Templates/ender3-v2/end.gcode")
gcode:Write(ordered, "Outputs/part.gcode")
output gcode:GetFilamentLength() + " mm of filament"
end
end
Actions
GetFilamentLength()
The filament the last Write extruded (mm).
Returns
number: The filament the last Write extruded (mm).
Example
use Libraries.Containers.Array
use Libraries.Fabrication.Geometry.Contour
use Libraries.Fabrication.Printing.GcodeWriter
Array<Contour> ordered // from PathOrderer:Order
GcodeWriter gcode
gcode:Write(ordered, "Outputs/part.gcode")
output "Uses " + gcode:GetFilamentLength() / 1000 + " m of filament"
GetMoveSeconds()
The time the last Write's moves take at their programmed speeds (s); real prints run slower, as acceleration isn't counted.
Returns
number: The time the last Write's moves take at their programmed speeds (s); real prints run slower, as acceleration isn't counted.
Example
use Libraries.Containers.Array
use Libraries.Fabrication.Geometry.Contour
use Libraries.Fabrication.Printing.GcodeWriter
Array<Contour> ordered // from PathOrderer:Order
GcodeWriter gcode
gcode:Write(ordered, "Outputs/part.gcode")
output "About " + gcode:GetMoveSeconds() / 60 + " minutes of moves"
GetPausedLayerCount()
How many layers were still too quick at the slowest speed, so the nozzle parks and waits after them.
Returns
integer: How many layers were still too quick at the slowest speed, so the nozzle parks and waits after them.
Example
use Libraries.Containers.Array
use Libraries.Fabrication.Geometry.Contour
use Libraries.Fabrication.Printing.GcodeWriter
Array<Contour> ordered // from PathOrderer:Order
GcodeWriter gcode
gcode:Write(ordered, "Outputs/part.gcode")
output gcode:GetPausedLayerCount() + " layers pause to cool"
GetSkippedRetractCount()
How many retracts the last Write skipped to avoid grinding the filament.
Returns
integer: How many retracts the last Write skipped to avoid grinding the filament.
Example
use Libraries.Containers.Array
use Libraries.Fabrication.Geometry.Contour
use Libraries.Fabrication.Printing.GcodeWriter
Array<Contour> ordered // from PathOrderer:Order
GcodeWriter gcode
gcode:Write(ordered, "Outputs/part.gcode")
output gcode:GetSkippedRetractCount() + " retracts skipped"
GetSlowedLayerCount()
How many layers the last Write slowed down to get their minimum layer time.
Returns
integer: How many layers the last Write slowed down to get their minimum layer time.
Example
use Libraries.Containers.Array
use Libraries.Fabrication.Geometry.Contour
use Libraries.Fabrication.Printing.GcodeWriter
Array<Contour> ordered // from PathOrderer:Order
GcodeWriter gcode
gcode:Write(ordered, "Outputs/part.gcode")
output gcode:GetSlowedLayerCount() + " layers slowed down to cool"
GetWarnings()
Warnings from the last Write (a model too big for the bed, unknown placeholders, a created template), as sentences.
Returns
Libraries.Containers.Array<text>: Warnings from the last Write (a model too big for the bed, unknown placeholders, a created template), as sentences.
Example
use Libraries.Containers.Array
use Libraries.Fabrication.Geometry.Contour
use Libraries.Fabrication.Printing.GcodeWriter
Array<Contour> ordered // from PathOrderer:Order
GcodeWriter gcode
gcode:Write(ordered, "Outputs/part.gcode")
Array<text> warnings = gcode:GetWarnings()
integer i = 0
repeat while i < warnings:GetSize()
output "warning: " + warnings:Get(i)
i = i + 1
end
SetAccelerations(number outerWall, number innerWall, number skin, number infill, number support, number firstLayer, number travel)
Accelerations in mm/s^2, sent with M204 when they change (0 = never sent, the printer keeps whatever the start G-code set).
Parameters
outerWallnumber: Outer walls (mm/s^2).innerWallnumber: Inner walls (mm/s^2).skinnumber: Top and bottom skin (mm/s^2).infillnumber: Sparse infill (mm/s^2).supportnumber: Support (mm/s^2).firstLayernumber: The first layer (mm/s^2).travelnumber: Moves that don't print (mm/s^2).
Example
use Libraries.Containers.Array
use Libraries.Fabrication.Geometry.Contour
use Libraries.Fabrication.Printing.GcodeWriter
Array<Contour> ordered // from PathOrderer:Order
GcodeWriter gcode
gcode:SetAccelerations(5000, 8000, 8000, 10000, 8000, 500, 10000)
gcode:Write(ordered, "Outputs/part.gcode")
SetBambuExtras(boolean toggle)
Bambu Lab printers: write the header block and the layer / progress
reports their screen, time estimate and timelapse use:
M73 P
Parameters
toggleboolean: True for a Bambu Lab printer.
Example
use Libraries.Containers.Array
use Libraries.Fabrication.Geometry.Contour
use Libraries.Fabrication.Printing.GcodeWriter
Array<Contour> ordered // from PathOrderer:Order
GcodeWriter gcode
gcode:SetBambuExtras(true)
gcode:Write(ordered, "Outputs/part.gcode")
SetBed(number sizeX, number sizeY)
The bed size (mm); the model is centred on it.
Parameters
sizeXnumber: The bed width along X (mm).sizeYnumber: The bed depth along Y (mm).
Example
use Libraries.Containers.Array
use Libraries.Fabrication.Geometry.Contour
use Libraries.Fabrication.Printing.GcodeWriter
Array<Contour> ordered // from PathOrderer:Order
GcodeWriter gcode
gcode:SetBed(220, 220) // an Ender-3
gcode:Write(ordered, "Outputs/part.gcode")
SetBedHeight(number sizeZ)
Build height in mm (Ender-3: 250, Bambu P2S: 256). Caps {PARK_Z}.
Parameters
sizeZnumber: The build height (mm).
Example
use Libraries.Containers.Array
use Libraries.Fabrication.Geometry.Contour
use Libraries.Fabrication.Printing.GcodeWriter
Array<Contour> ordered // from PathOrderer:Order
GcodeWriter gcode
gcode:SetBedHeight(250)
gcode:Write(ordered, "Outputs/part.gcode")
SetCoolingPause(number lift, number clearance)
After a layer that is still under the minimum layer time at the slowest speed, lift `lift` mm, park `clearance` mm beside the model and wait out the rest. lift 0 turns the pause off.
Parameters
liftnumber: How far to lift the nozzle (mm); 0 turns the pause off.clearancenumber: How far beside the model to park (mm).
Example
use Libraries.Containers.Array
use Libraries.Fabrication.Geometry.Contour
use Libraries.Fabrication.Printing.GcodeWriter
Array<Contour> ordered // from PathOrderer:Order
GcodeWriter gcode
gcode:SetCoolingPause(5, 10)
gcode:Write(ordered, "Outputs/part.gcode")
SetDryRun(boolean toggle, number lift)
A safe test file: the printer homes, then traces every move of the print `lift` mm above the bed with the heaters off and no extrusion. Watch it to check the print stays on the bed and nothing collides. The custom start / end G-code is NOT used in a dry run.
Parameters
toggleboolean: True for a dry run.liftnumber: How high above the bed to trace (mm).
Example
use Libraries.Containers.Array
use Libraries.Fabrication.Geometry.Contour
use Libraries.Fabrication.Printing.GcodeWriter
Array<Contour> ordered // from PathOrderer:Order
GcodeWriter gcode
gcode:SetDryRun(true, 20) // trace the print 20 mm up, heaters off
gcode:Write(ordered, "Outputs/part.gcode")
SetEndGCode(text code)
The printer's own end G-code, as text, copied in after the last layer. When set (not empty), it is used instead of the end G-code file.
Parameters
codetext: The end G-code, or "" to use the file.
Example
use Libraries.Containers.Array
use Libraries.Fabrication.Geometry.Contour
use Libraries.Fabrication.Printing.GcodeWriter
Array<Contour> ordered // from PathOrderer:Order
GcodeWriter gcode
gcode:SetEndGCode("PRINT_END")
gcode:Write(ordered, "Outputs/part.gcode")
SetEndGCodeFile(text path)
The file holding the printer's own end G-code, copied in after the last layer. An empty path uses the generic template without writing a file.
Parameters
pathtext: The end G-code file, or "" for the generic template.
Example
use Libraries.Containers.Array
use Libraries.Fabrication.Geometry.Contour
use Libraries.Fabrication.Printing.GcodeWriter
Array<Contour> ordered // from PathOrderer:Order
GcodeWriter gcode
gcode:SetEndGCodeFile("Templates/ender3-v2/end.gcode")
gcode:Write(ordered, "Outputs/part.gcode")
SetFan(integer maxSpeed, integer offLayers, integer fullLayers)
The part cooling fan: off for the first offLayers layers, then ramping up to maxSpeed (0 - 255), which it reaches on layer fullLayers.
Parameters
maxSpeedinteger: The full fan speed, 0 to 255.offLayersinteger: How many layers start with the fan off.fullLayersinteger: The layer the fan reaches maxSpeed on.
Example
use Libraries.Containers.Array
use Libraries.Fabrication.Geometry.Contour
use Libraries.Fabrication.Printing.GcodeWriter
Array<Contour> ordered // from PathOrderer:Order
GcodeWriter gcode
gcode:SetFan(255, 1, 3) // off on layer 0, full speed from layer 3
gcode:Write(ordered, "Outputs/part.gcode")
SetFilamentDiameter(number diameter)
Filament diameter (mm), usually 1.75 or 2.85.
Parameters
diameternumber: The diameter (mm), greater than 0.
Example
use Libraries.Containers.Array
use Libraries.Fabrication.Geometry.Contour
use Libraries.Fabrication.Printing.GcodeWriter
Array<Contour> ordered // from PathOrderer:Order
GcodeWriter gcode
gcode:SetFilamentDiameter(1.75)
gcode:Write(ordered, "Outputs/part.gcode")
SetFilamentType(text type)
The filament's material (PLA, PETG, ...), for {FILAMENT_TYPE} in start and end G-code. Bambu printers read it from "M1002 set_filament_type:".
Parameters
typetext: The material, such as "PLA" (written in capitals).
Example
use Libraries.Containers.Array
use Libraries.Fabrication.Geometry.Contour
use Libraries.Fabrication.Printing.GcodeWriter
Array<Contour> ordered // from PathOrderer:Order
GcodeWriter gcode
gcode:SetFilamentType("PETG")
gcode:Write(ordered, "part.gcode")
SetFirstLayerFlow(number ratio)
Extra extrusion multiplier on the first layer (default 1.15), on top of SetFlow, so the first layer squishes into the bed.
Parameters
rationumber: The first layer's extra multiplier, greater than 0.
Example
use Libraries.Containers.Array
use Libraries.Fabrication.Geometry.Contour
use Libraries.Fabrication.Printing.GcodeWriter
Array<Contour> ordered // from PathOrderer:Order
GcodeWriter gcode
gcode:SetFirstLayerFlow(1.1)
gcode:Write(ordered, "Outputs/part.gcode")
SetFlow(number ratio)
Extrusion multiplier (1 = as calculated).
Parameters
rationumber: The multiplier, greater than 0.
Example
use Libraries.Containers.Array
use Libraries.Fabrication.Geometry.Contour
use Libraries.Fabrication.Printing.GcodeWriter
Array<Contour> ordered // from PathOrderer:Order
GcodeWriter gcode
gcode:SetFlow(0.98)
gcode:Write(ordered, "Outputs/part.gcode")
SetGeneratorName(text name)
The program named in the G-code's header comments, for example "My Slicer" (default "Quorum Libraries.Fabrication").
Parameters
nametext: The name.
Example
use Libraries.Containers.Array
use Libraries.Fabrication.Geometry.Contour
use Libraries.Fabrication.Printing.GcodeWriter
Array<Contour> ordered // from PathOrderer:Order
GcodeWriter gcode
gcode:SetGeneratorName("My Slicer")
gcode:Write(ordered, "part.gcode") // starts ";Generated by My Slicer"
SetInfillTravel(number distance)
Travels between infill lines shorter than this (mm) don't retract.
Parameters
distancenumber: The distance (mm), 0 or more.
Example
use Libraries.Containers.Array
use Libraries.Fabrication.Geometry.Contour
use Libraries.Fabrication.Printing.GcodeWriter
Array<Contour> ordered // from PathOrderer:Order
GcodeWriter gcode
gcode:SetInfillTravel(2.0)
gcode:Write(ordered, "Outputs/part.gcode")
SetLayerHeight(number height)
The layer height (mm).
Parameters
heightnumber: The height (mm), greater than 0.
Example
use Libraries.Containers.Array
use Libraries.Fabrication.Geometry.Contour
use Libraries.Fabrication.Printing.GcodeWriter
Array<Contour> ordered // from PathOrderer:Order
GcodeWriter gcode
gcode:SetLayerHeight(0.2)
gcode:Write(ordered, "Outputs/part.gcode")
SetLineWidth(number width)
The extrusion width (mm).
Parameters
widthnumber: The width (mm), greater than 0.
Example
use Libraries.Containers.Array
use Libraries.Fabrication.Geometry.Contour
use Libraries.Fabrication.Printing.GcodeWriter
Array<Contour> ordered // from PathOrderer:Order
GcodeWriter gcode
gcode:SetLineWidth(0.4)
gcode:Write(ordered, "Outputs/part.gcode")
SetMaxFlow(number mm3PerSecond)
Hotend melt limit in mm^3/s (0 = none). Faster moves than the hotend can feed come out thin and weak, so every speed is capped to fit.
Parameters
mm3PerSecondnumber: The most plastic the hotend can melt (mm^3/s); 0 for no limit.
Example
use Libraries.Containers.Array
use Libraries.Fabrication.Geometry.Contour
use Libraries.Fabrication.Printing.GcodeWriter
Array<Contour> ordered // from PathOrderer:Order
GcodeWriter gcode
gcode:SetMaxFlow(12)
gcode:Write(ordered, "Outputs/part.gcode")
SetMinLayerTime(number seconds, number slowestSpeed)
Slow down layers that would print in less than `seconds`, but never below slowestSpeed (mm/s).
Parameters
secondsnumber: The shortest time a layer may take (s).slowestSpeednumber: The slowest speed allowed (mm/s).
Example
use Libraries.Containers.Array
use Libraries.Fabrication.Geometry.Contour
use Libraries.Fabrication.Printing.GcodeWriter
Array<Contour> ordered // from PathOrderer:Order
GcodeWriter gcode
gcode:SetMinLayerTime(8, 10)
gcode:Write(ordered, "Outputs/part.gcode")
SetMinTravelForRetract(number distance)
Only travels longer than `distance` mm retract (default 1.5).
Parameters
distancenumber: The shortest travel that retracts (mm).
Example
use Libraries.Containers.Array
use Libraries.Fabrication.Geometry.Contour
use Libraries.Fabrication.Printing.GcodeWriter
Array<Contour> ordered // from PathOrderer:Order
GcodeWriter gcode
gcode:SetMinTravelForRetract(1.5)
gcode:Write(ordered, "Outputs/part.gcode")
SetNozzleDiameter(number diameter)
Nozzle size in mm, for {NOZZLE_DIAMETER} in start / end G-code.
Parameters
diameternumber: The diameter (mm), greater than 0.
Example
use Libraries.Containers.Array
use Libraries.Fabrication.Geometry.Contour
use Libraries.Fabrication.Printing.GcodeWriter
Array<Contour> ordered // from PathOrderer:Order
GcodeWriter gcode
gcode:SetNozzleDiameter(0.4)
gcode:Write(ordered, "Outputs/part.gcode")
SetRetraction(number length, number speed)
Retraction length (mm: about 1 for direct drive, 4 - 6 for Bowden) and speed (mm/s). Also resets the retraction limit's window to the length, so call SetRetractionLimit after this.
Parameters
lengthnumber: How far to pull the filament back (mm).speednumber: How fast (mm/s).
Example
use Libraries.Containers.Array
use Libraries.Fabrication.Geometry.Contour
use Libraries.Fabrication.Printing.GcodeWriter
Array<Contour> ordered // from PathOrderer:Order
GcodeWriter gcode
gcode:SetRetraction(5, 45) // a Bowden extruder
gcode:Write(ordered, "Outputs/part.gcode")
SetRetractionLimit(integer count, number window)
At most `count` retracts within `window` mm of extruded filament (stops the extruder grinding the filament).
Parameters
countinteger: The most retracts allowed in the window.windownumber: The window (mm of filament).
Example
use Libraries.Containers.Array
use Libraries.Fabrication.Geometry.Contour
use Libraries.Fabrication.Printing.GcodeWriter
Array<Contour> ordered // from PathOrderer:Order
GcodeWriter gcode
gcode:SetRetraction(5, 45)
gcode:SetRetractionLimit(10, 5) // after SetRetraction
gcode:Write(ordered, "Outputs/part.gcode")
SetSpeeds(number outerWall, number innerWall, number skin, number infill, number support, number firstLayer)
Printing speeds in mm/s. The first layer uses firstLayer for everything (skirt and brim always do).
Parameters
outerWallnumber: Outer walls (mm/s).innerWallnumber: Inner walls (mm/s).skinnumber: Top and bottom skin (mm/s).infillnumber: Sparse infill (mm/s).supportnumber: Support (mm/s).firstLayernumber: Everything on the first layer (mm/s).
Example
use Libraries.Containers.Array
use Libraries.Fabrication.Geometry.Contour
use Libraries.Fabrication.Printing.GcodeWriter
Array<Contour> ordered // from PathOrderer:Order
GcodeWriter gcode
gcode:SetSpeeds(40, 60, 50, 80, 50, 20) // outer wall, inner wall, skin, infill, support, first layer
gcode:Write(ordered, "Outputs/part.gcode")
SetStartGCode(text code)
The printer's own start G-code, as text, copied in before the first layer with its placeholders filled in. When set (not empty), it is used instead of the start G-code file.
Parameters
codetext: The start G-code, or "" to use the file.
Example
use Libraries.Containers.Array
use Libraries.Fabrication.Geometry.Contour
use Libraries.Fabrication.Printing.GcodeWriter
Array<Contour> ordered // from PathOrderer:Order
GcodeWriter gcode
gcode:SetStartGCode("PRINT_START BED={BED_TEMP} EXTRUDER={NOZZLE_TEMP}")
gcode:Write(ordered, "Outputs/part.gcode")
SetStartGCodeFile(text path)
The file holding the printer's own start G-code, copied in before the first layer. A missing file is created from a generic template. An empty path uses the generic template without writing a file.
Parameters
pathtext: The start G-code file, or "" for the generic template.
Example
use Libraries.Containers.Array
use Libraries.Fabrication.Geometry.Contour
use Libraries.Fabrication.Printing.GcodeWriter
Array<Contour> ordered // from PathOrderer:Order
GcodeWriter gcode
gcode:SetStartGCodeFile("Templates/ender3-v2/start.gcode")
gcode:Write(ordered, "Outputs/part.gcode")
SetTemperatures(integer nozzle, integer bed)
Nozzle and bed temperatures (C), for the start / end G-code placeholders.
Parameters
nozzleinteger: The nozzle temperature (C).bedinteger: The bed temperature (C).
Example
use Libraries.Containers.Array
use Libraries.Fabrication.Geometry.Contour
use Libraries.Fabrication.Printing.GcodeWriter
Array<Contour> ordered // from PathOrderer:Order
GcodeWriter gcode
gcode:SetTemperatures(210, 60) // PLA
gcode:Write(ordered, "Outputs/part.gcode")
SetTravelSpeed(number mmPerSecond)
Speed of moves that don't print (mm/s).
Parameters
mmPerSecondnumber: The speed (mm/s), greater than 0.
Example
use Libraries.Containers.Array
use Libraries.Fabrication.Geometry.Contour
use Libraries.Fabrication.Printing.GcodeWriter
Array<Contour> ordered // from PathOrderer:Order
GcodeWriter gcode
gcode:SetTravelSpeed(150)
gcode:Write(ordered, "Outputs/part.gcode")
SetZHop(number height)
Lift the nozzle `height` mm on travels that retract (0 = off). 0.2 - 0.4 mm stops it scraping the bed or the top of the print.
Parameters
heightnumber: The lift (mm), 0 for none.
Example
use Libraries.Containers.Array
use Libraries.Fabrication.Geometry.Contour
use Libraries.Fabrication.Printing.GcodeWriter
Array<Contour> ordered // from PathOrderer:Order
GcodeWriter gcode
gcode:SetZHop(0.4)
gcode:Write(ordered, "Outputs/part.gcode")
SetZHopMinTravel(number distance)
Travels longer than `distance` mm hop (default 1.5, the same as retraction). Lower it (e.g. 0.8) to also lift on the short hops across already-printed lines; neighbouring skin lines (0.57 mm apart on the diagonal) stay unlifted so solid layers don't slow down. While SetZHopNeedsRetract is on (the default) a travel also has to retract to hop.
Parameters
distancenumber: The shortest travel that hops (mm).
Example
use Libraries.Containers.Array
use Libraries.Fabrication.Geometry.Contour
use Libraries.Fabrication.Printing.GcodeWriter
Array<Contour> ordered // from PathOrderer:Order
GcodeWriter gcode
gcode:SetZHopMinTravel(0.8)
gcode:Write(ordered, "Outputs/part.gcode")
SetZHopNeedsRetract(boolean toggle)
true (default): hop only on travels that retract. false: hop on every travel longer than zHopMinTravel, even without a retract.
Parameters
toggleboolean: True to hop only on travels that retract.
Example
use Libraries.Containers.Array
use Libraries.Fabrication.Geometry.Contour
use Libraries.Fabrication.Printing.GcodeWriter
Array<Contour> ordered // from PathOrderer:Order
GcodeWriter gcode
gcode:SetZHopNeedsRetract(false)
gcode:Write(ordered, "Outputs/part.gcode")
Write(Libraries.Containers.Array<Libraries.Fabrication.Geometry.Contour> paths, text filePath)
Writes the G-code file, creating its folder if needed. The path is relative to the working directory.
Parameters
pathsLibraries.Containers.Array<Libraries.Fabrication.Geometry.Contour>: The paths in printing order, with roles set (PathOrderer:Order).filePathtext: Where to write the G-code.
Example
use Libraries.Containers.Array
use Libraries.Fabrication.Geometry.Contour
use Libraries.Fabrication.Printing.GcodeWriter
Array<Contour> ordered // from PathOrderer:Order
GcodeWriter gcode
gcode:SetTemperatures(210, 60)
gcode:Write(ordered, "Outputs/part.gcode")
output gcode:GetFilamentLength() + " mm of filament"
Write(Libraries.Containers.Array<Libraries.Fabrication.Geometry.Contour> paths, Libraries.System.File file)
Writes the G-code file, creating its folder if needed.
Parameters
pathsLibraries.Containers.Array<Libraries.Fabrication.Geometry.Contour>: The paths in printing order, with roles set (PathOrderer:Order).fileLibraries.System.File: Where to write the G-code.
Example
use Libraries.Containers.Array
use Libraries.System.File
use Libraries.Fabrication.Geometry.Contour
use Libraries.Fabrication.Printing.GcodeWriter
Array<Contour> ordered // from PathOrderer:Order
File file
file:SetPath("Outputs/part.gcode")
GcodeWriter gcode
gcode:Write(ordered, file)