PathGenerator
Package: Libraries.Fabrication.Slicing · Inherits from: Libraries.Language.Object
The PathGenerator class turns each layer's outlines into toolpaths: walls (loops following the outline, wallIndex 0 outermost), skin (solid fill under top surfaces and over bottom surfaces) and sparse infill. Parts too thin for a wall get a single center line, and bands too thin for an inner wall get solid lines, so nothing thin prints hollow. The paths are not in printing order yet; PathOrderer does that.
Example Code
use Libraries.Containers.Array
use Libraries.Fabrication.Geometry.Contour
use Libraries.Fabrication.Slicing.PathGenerator
class Main
action Main
Array<Contour> outlines // from ContourGenerator:Build
PathGenerator paths
paths:SetLineWidth(0.4)
paths:SetWallCount(3)
paths:SetInfillDensity(0.15)
paths:Generate(outlines, 100)
Array<Contour> walls = paths:GetWalls()
end
end
Actions
Generate(Libraries.Containers.Array<Libraries.Fabrication.Geometry.Contour> contours, integer planeCount)
Makes the walls, skin and infill of every plane, replacing the results of an earlier call.
Parameters
contoursLibraries.Containers.Array<Libraries.Fabrication.Geometry.Contour>: The oriented outlines from ContourGenerator:Build.planeCountinteger: The number of planes sliced.
Example
use Libraries.Containers.Array
use Libraries.Fabrication.Geometry.Contour
use Libraries.Fabrication.Slicing.PathGenerator
Array<Contour> outlines // from ContourGenerator:Build
PathGenerator paths
paths:SetWallCount(3)
paths:SetInfillDensity(0.2)
paths:Generate(outlines, 100)
Array<Contour> walls = paths:GetWalls()
GetDroppedLoopCount()
How many inner-wall / fill loops the last Generate dropped for not fitting inside a thin part.
Returns
integer: How many inner-wall / fill loops the last Generate dropped for not fitting inside a thin part.
Example
use Libraries.Containers.Array
use Libraries.Fabrication.Geometry.Contour
use Libraries.Fabrication.Slicing.PathGenerator
Array<Contour> outlines // from ContourGenerator:Build
PathGenerator paths
paths:Generate(outlines, 100)
output paths:GetDroppedLoopCount() + " loops didn't fit inside thin parts"
GetInfill()
The sparse infill lines of every plane.
Returns
Libraries.Containers.Array<Libraries.Fabrication.Geometry.Contour>: The sparse infill lines of every plane.
Example
use Libraries.Containers.Array
use Libraries.Fabrication.Geometry.Contour
use Libraries.Fabrication.Slicing.PathGenerator
Array<Contour> outlines // from ContourGenerator:Build
PathGenerator paths
paths:Generate(outlines, 100)
Array<Contour> infill = paths:GetInfill()
output infill:GetSize() + " infill lines"
GetProgress()
How far the current or last Generate is, from 0 to 1, from the planes it has finished. The first pass (walls) takes most of the time, so it is 90% of the progress; the second (skin and infill) the last 10%. Another thread can read it while Generate works.
Returns
number: The progress, from 0 to 1.
Example
use Libraries.Fabrication.Slicing.PathGenerator
PathGenerator paths
// another thread runs paths:Generate(contours, planeCount)
output (paths:GetProgress() * 100) + "% of the walls and fill planned"
GetRebuiltIslandCount()
How many thin islands the last Generate rebuilt with the exact (slower) inset.
Returns
integer: How many thin islands the last Generate rebuilt with the exact (slower) inset.
Example
use Libraries.Containers.Array
use Libraries.Fabrication.Geometry.Contour
use Libraries.Fabrication.Slicing.PathGenerator
Array<Contour> outlines // from ContourGenerator:Build
PathGenerator paths
paths:Generate(outlines, 100)
output paths:GetRebuiltIslandCount() + " thin islands needed the exact inset"
GetSkin()
The solid fill lines (and thin-part center lines) of every plane.
Returns
Libraries.Containers.Array<Libraries.Fabrication.Geometry.Contour>: The solid fill lines (and thin-part center lines) of every plane.
Example
use Libraries.Containers.Array
use Libraries.Fabrication.Geometry.Contour
use Libraries.Fabrication.Slicing.PathGenerator
Array<Contour> outlines // from ContourGenerator:Build
PathGenerator paths
paths:Generate(outlines, 100)
Array<Contour> skin = paths:GetSkin()
output skin:GetSize() + " solid fill lines"
GetWalls()
The wall loops of every plane from the last Generate.
Returns
Libraries.Containers.Array<Libraries.Fabrication.Geometry.Contour>: The wall loops of every plane from the last Generate.
Example
use Libraries.Containers.Array
use Libraries.Fabrication.Geometry.Contour
use Libraries.Fabrication.Slicing.PathGenerator
Array<Contour> outlines // from ContourGenerator:Build
PathGenerator paths
paths:Generate(outlines, 100)
Array<Contour> walls = paths:GetWalls()
output walls:GetSize() + " wall loops"
SetBottomLayers(integer count)
Solid layers over bottom surfaces; 0 turns them off.
Parameters
countinteger: The number of layers.
Example
use Libraries.Containers.Array
use Libraries.Fabrication.Geometry.Contour
use Libraries.Fabrication.Slicing.PathGenerator
Array<Contour> outlines // from ContourGenerator:Build
PathGenerator paths
paths:SetBottomLayers(3)
paths:Generate(outlines, 100)
SetInfillDensity(number density)
The sparse infill density: 0 for none, 1 for solid (lines touching side by side).
Parameters
densitynumber: The density, 0 to 1.
Example
use Libraries.Containers.Array
use Libraries.Fabrication.Geometry.Contour
use Libraries.Fabrication.Slicing.PathGenerator
Array<Contour> outlines // from ContourGenerator:Build
PathGenerator paths
paths:SetInfillDensity(0.15) // 15% infill
paths:Generate(outlines, 100)
SetInfillOverlap(number overlap)
How far fill lines reach into the innermost wall, as a fraction of the line width.
Parameters
overlapnumber: The fraction, 0 to 1.
Example
use Libraries.Containers.Array
use Libraries.Fabrication.Geometry.Contour
use Libraries.Fabrication.Slicing.PathGenerator
Array<Contour> outlines // from ContourGenerator:Build
PathGenerator paths
paths:SetInfillOverlap(0.25) // a quarter of a line width into the wall
paths:Generate(outlines, 100)
SetJoinFirstLayer(boolean toggle)
true (the default): layer 0's solid fill is chained into continuous zigzags. false: separate straight lines, as on every other layer.
Parameters
toggleboolean: Whether to join the first layer's lines.
Example
use Libraries.Containers.Array
use Libraries.Fabrication.Geometry.Contour
use Libraries.Fabrication.Slicing.PathGenerator
Array<Contour> outlines // from ContourGenerator:Build
PathGenerator paths
paths:SetJoinFirstLayer(false) // straight lines on the first layer too
paths:Generate(outlines, 100)
SetLineWidth(number width)
The extrusion width, which is also the spacing of solid fill and the shortest fill line kept.
Parameters
widthnumber: The width (mm), greater than 0.
Example
use Libraries.Containers.Array
use Libraries.Fabrication.Geometry.Contour
use Libraries.Fabrication.Slicing.PathGenerator
Array<Contour> outlines // from ContourGenerator:Build
PathGenerator paths
paths:SetLineWidth(0.42)
paths:Generate(outlines, 100)
SetTopLayers(integer count)
Solid layers under top surfaces. Typical is 0.6 - 1.0 mm worth: 3 - 5 layers at 0.2 mm. 0 turns them off.
Parameters
countinteger: The number of layers.
Example
use Libraries.Containers.Array
use Libraries.Fabrication.Geometry.Contour
use Libraries.Fabrication.Slicing.PathGenerator
Array<Contour> outlines // from ContourGenerator:Build
PathGenerator paths
paths:SetTopLayers(4) // 0.8 mm at 0.2 mm layers
paths:Generate(outlines, 100)
SetWallCount(integer count)
The number of walls (0 for none).
Parameters
countinteger: The number of walls.
Example
use Libraries.Containers.Array
use Libraries.Fabrication.Geometry.Contour
use Libraries.Fabrication.Slicing.PathGenerator
Array<Contour> outlines // from ContourGenerator:Build
PathGenerator paths
paths:SetWallCount(2)
paths:Generate(outlines, 100)