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

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

  • loop number: The shortest loop (mm).
  • line number: The shortest open line (mm).
  • segment number: 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

  • x number: The x coordinate (mm, model coordinates).
  • y number: 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

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

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())

Inherited Actions

3 actions from Libraries.Language.Object