PathOrderer
Package: Libraries.Fabrication.Slicing · Inherits from: Libraries.Language.Object
The PathOrderer class puts each layer's paths into printing order and sets their PathRole. Per layer: skirt / brim first, then one nearest-neighbour tour over the model's islands and the support tines together, so the nozzle always goes to whatever is closest instead of printing every tine and then crossing back over the layer for the model. Each island is finished (walls inside out, then skin, then infill) and each tine is finished (its outline, then the lines inside it) before moving on. Fewer trips across open air means fewer strings. Wall loops start at the vertex nearest the seam point, so the seams line up. Paths too short to print cleanly are dropped (see SetCleanup), except the center lines and dots PathGenerator marks keepShort.
Example Code
use Libraries.Containers.Array
use Libraries.Fabrication.Geometry.Contour
use Libraries.Fabrication.Slicing.PathGenerator
use Libraries.Fabrication.Slicing.PathOrderer
class Main
action Main
Array<Contour> outlines // from ContourGenerator:Build
PathGenerator paths // after paths:Generate(outlines, 100)
PathOrderer orderer
orderer:SetSeamPoint(0, 1000000) // seams at the back
Array<Contour> ordered = orderer:Order(outlines, paths:GetWalls(),
paths:GetSkin(), paths:GetInfill(), 100)
end
end
Actions
GetDroppedCount()
How many paths the last Order dropped as too short.
Returns
integer: How many paths the last Order dropped as too short.
Example
use Libraries.Containers.Array
use Libraries.Fabrication.Geometry.Contour
use Libraries.Fabrication.Slicing.PathOrderer
Array<Contour> outlines // from ContourGenerator:Build
Array<Contour> walls
Array<Contour> skin
Array<Contour> infill
PathOrderer orderer
Array<Contour> ordered = orderer:Order(outlines, walls, skin, infill, 100)
output orderer:GetDroppedCount() + " paths too short to print"
Order(Libraries.Containers.Array<Libraries.Fabrication.Geometry.Contour> contours, Libraries.Containers.Array<Libraries.Fabrication.Geometry.Contour> walls, Libraries.Containers.Array<Libraries.Fabrication.Geometry.Contour> skin, Libraries.Containers.Array<Libraries.Fabrication.Geometry.Contour> infill, integer planeCount)
Orders every layer's paths.
Parameters
contoursLibraries.Containers.Array<Libraries.Fabrication.Geometry.Contour>: The outlines from ContourGenerator (they define the islands).wallsLibraries.Containers.Array<Libraries.Fabrication.Geometry.Contour>: The wall loops from PathGenerator.skinLibraries.Containers.Array<Libraries.Fabrication.Geometry.Contour>: The solid lines from PathGenerator.infillLibraries.Containers.Array<Libraries.Fabrication.Geometry.Contour>: The sparse lines from PathGenerator.planeCountinteger: The number of planes.
Returns
Libraries.Containers.Array<Libraries.Fabrication.Geometry.Contour>: New paths in printing order, layer by layer, each with its role set.
Example
use Libraries.Containers.Array
use Libraries.Fabrication.Geometry.Contour
use Libraries.Fabrication.Slicing.PathGenerator
use Libraries.Fabrication.Slicing.PathOrderer
Array<Contour> outlines // from ContourGenerator:Build
PathGenerator paths
paths:Generate(outlines, 100)
PathOrderer orderer
Array<Contour> ordered = orderer:Order(outlines, paths:GetWalls(), paths:GetSkin(), paths:GetInfill(), 100)
SetCleanup(number loop, number line, number segment)
The shortest paths worth printing; shorter ones are dropped.
Parameters
loopnumber: The shortest loop (mm).linenumber: The shortest open line (mm).segmentnumber: Points closer together than this (mm) are merged.
Example
use Libraries.Fabrication.Slicing.PathOrderer
PathOrderer orderer
orderer:SetCleanup(1.0, 0.4, 0.05) // drop loops under 1 mm and lines under 0.4 mm
SetSeamPoint(number x, number y)
Wall seams are placed at the vertex nearest this point.
Parameters
xnumber: The x coordinate (mm, model coordinates).ynumber: The y coordinate (mm).
Example
use Libraries.Fabrication.Slicing.PathOrderer
PathOrderer orderer
orderer:SetSeamPoint(0, 1000000) // seams at the back of the model
SetSkirt(Libraries.Containers.Array<Libraries.Fabrication.Geometry.Contour> loops)
Skirt or brim loops (from SkirtGenerator), printed first on their layers.
Parameters
loopsLibraries.Containers.Array<Libraries.Fabrication.Geometry.Contour>: The loops.
Example
use Libraries.Containers.Array
use Libraries.Fabrication.Geometry.Contour
use Libraries.Fabrication.Slicing.PathOrderer
use Libraries.Fabrication.Slicing.SkirtGenerator
Array<Contour> outlines // from ContourGenerator:Build
SkirtGenerator skirt
skirt:SetSkirt(2, 3.0, 1)
PathOrderer orderer
orderer:SetSkirt(skirt:Generate(outlines))
SetSupport(Libraries.Containers.Array<Libraries.Fabrication.Geometry.Contour> paths)
Support paths (from TreeSupport:GetPaths): closed loops are tine outlines, open paths the lines inside them.
Parameters
pathsLibraries.Containers.Array<Libraries.Fabrication.Geometry.Contour>: The support paths.
Example
use Libraries.Containers.Array
use Libraries.Fabrication.Geometry.Contour
use Libraries.Fabrication.Slicing.PathOrderer
use Libraries.Fabrication.Slicing.TreeSupport
Array<Contour> outlines // from ContourGenerator:Build
TreeSupport trees
trees:Generate(outlines, 100)
PathOrderer orderer
orderer:SetSupport(trees:GetPaths())