LineFill
Package: Libraries.Fabrication.Geometry · Inherits from: Libraries.Language.Object
The LineFill class fills a region with parallel straight lines (a scan-line hatch), the way infill, skin and support are printed. Lines run at 45 degrees on even planes and 135 degrees on odd ones, so neighbouring layers cross, and every other line runs backwards so the nozzle zigzags. FillJoined chains the lines into continuous zigzags instead: each line's end is linked to the next line's start along the region's edge, so the nozzle keeps extruding rather than stopping, jumping and starting again (used on the first layer, where every loose line end can lift off the bed).
Example Code
use Libraries.Containers.Array
use Libraries.Fabrication.Geometry.Contour
use Libraries.Fabrication.Geometry.LineFill
class Main
action Main
Contour square
square:AddPoint(0, 0)
square:AddPoint(20, 0)
square:AddPoint(20, 20)
square:AddPoint(0, 20)
square:closed = true
Array<Contour> region
region:Add(square)
LineFill fill
Array<Contour> lines
fill:Fill(region, 0, 2.0, 0.4, lines) // lines 2 mm apart, none shorter than 0.4 mm
output lines:GetSize() + " lines"
end
end
Actions
Fill(Libraries.Containers.Array<Libraries.Fabrication.Geometry.Contour> region, integer planeIndex, number spacing, number minLength, Libraries.Containers.Array<Libraries.Fabrication.Geometry.Contour> target)
Fills a region with separate straight lines.
Parameters
regionLibraries.Containers.Array<Libraries.Fabrication.Geometry.Contour>: Closed loops (holes included) on one plane.planeIndexinteger: The plane: sets the lines' angle and their planeIndex.spacingnumber: The distance between line centres (mm); must be greater than 0.minLengthnumber: Lines shorter than this (mm) are left out.targetLibraries.Containers.Array<Libraries.Fabrication.Geometry.Contour>: The lines are added to this list as open contours.
Example
use Libraries.Containers.Array
use Libraries.Fabrication.Geometry.Contour
use Libraries.Fabrication.Geometry.LineFill
Contour square
square:AddPoint(0, 0)
square:AddPoint(20, 0)
square:AddPoint(20, 20)
square:AddPoint(0, 20)
square:closed = true
Array<Contour> region
region:Add(square)
LineFill fill
Array<Contour> lines
fill:Fill(region, 0, 2.0, 0.4, lines) // 2 mm apart, none shorter than 0.4 mm
output lines:GetSize() + " lines"
FillJoined(Libraries.Containers.Array<Libraries.Fabrication.Geometry.Contour> region, integer planeIndex, number spacing, number minLength, Libraries.Containers.Array<Libraries.Fabrication.Geometry.Contour> target)
Fills a region with lines chained into continuous zigzags wherever the link between two neighbouring lines stays inside the region.
Parameters
regionLibraries.Containers.Array<Libraries.Fabrication.Geometry.Contour>: Closed loops (holes included) on one plane.planeIndexinteger: The plane: sets the lines' angle and their planeIndex.spacingnumber: The distance between line centres (mm); must be greater than 0.minLengthnumber: Lines shorter than this (mm) are left out.targetLibraries.Containers.Array<Libraries.Fabrication.Geometry.Contour>: The zigzags are added to this list as open contours.
Example
use Libraries.Containers.Array
use Libraries.Fabrication.Geometry.Contour
use Libraries.Fabrication.Geometry.LineFill
Contour square
square:AddPoint(0, 0)
square:AddPoint(20, 0)
square:AddPoint(20, 20)
square:AddPoint(0, 20)
square:closed = true
Array<Contour> region
region:Add(square)
LineFill fill
Array<Contour> zigzags
fill:FillJoined(region, 0, 0.4, 0.4, zigzags) // solid first-layer fill
output zigzags:GetSize() + " continuous paths"