TreeSupport
Package: Libraries.Fabrication.Slicing · Inherits from: Libraries.Language.Object
The TreeSupport class grows tree supports under a model's overhangs. Thin tines are seeded on a triangular grid wherever the model's underside is too steep to print on its own (and along overhanging edges), then grown down layer by layer: branches lean toward each other and merge, thicken with the load they carry, keep clear of the model, and route around it toward the bed. A branch with no way down rests on the model, preferably where the model is wide enough to hold it. GetAreas returns the support's outline on each layer (for a brim to go around), and GetPaths the walls and fill lines to print, for PathOrderer:SetSupport. PolygonOffsetter's sign convention is used throughout: Offset(loops, d) grows the loops for d < 0 and shrinks them for d > 0.
Example Code
use Libraries.Containers.Array
use Libraries.Fabrication.Geometry.Contour
use Libraries.Fabrication.Slicing.TreeSupport
class Main
action Main
Array<Contour> outlines // from ContourGenerator:Build
TreeSupport trees
trees:SetLayerHeight(0.2)
trees:SetLineWidth(0.4)
trees:SetOverhangAngle(50)
trees:Generate(outlines, 100)
output trees:GetTipCount() + " tines, " + trees:GetReachedBed() + " reach the bed"
end
end
Actions
Generate(Libraries.Containers.Array<Libraries.Fabrication.Geometry.Contour> contours, integer planeCount)
Grows the supports for a sliced model, 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.TreeSupport
Array<Contour> outlines // from ContourGenerator:Build
TreeSupport trees
trees:SetLayerHeight(0.2)
trees:SetOverhangAngle(50)
trees:Generate(outlines, 100)
output trees:GetTipCount() + " tines, " + trees:GetReachedBed() + " reach the bed"
GetAreas()
The support's outline on each layer from the last Generate (for a brim to go around).
Returns
Libraries.Containers.Array<Libraries.Fabrication.Geometry.Contour>: The support's outline on each layer from the last Generate (for a brim to go around).
Example
use Libraries.Containers.Array
use Libraries.Fabrication.Geometry.Contour
use Libraries.Fabrication.Slicing.TreeSupport
Array<Contour> outlines // from ContourGenerator:Build
TreeSupport trees
trees:Generate(outlines, 100)
Array<Contour> areas = trees:GetAreas()
output areas:GetSize() + " support outlines"
GetDroppedTips()
How many tines had no room next to the model and were dropped.
Returns
integer: How many tines had no room next to the model and were dropped.
Example
use Libraries.Containers.Array
use Libraries.Fabrication.Geometry.Contour
use Libraries.Fabrication.Slicing.TreeSupport
Array<Contour> outlines // from ContourGenerator:Build
TreeSupport trees
trees:Generate(outlines, 100)
output trees:GetDroppedTips() + " tines had no room"
GetPaths()
The support walls (closed) and fill lines (open) to print, for PathOrderer:SetSupport.
Returns
Libraries.Containers.Array<Libraries.Fabrication.Geometry.Contour>: The support walls (closed) and fill lines (open) to print, for PathOrderer:SetSupport.
Example
use Libraries.Containers.Array
use Libraries.Fabrication.Geometry.Contour
use Libraries.Fabrication.Slicing.TreeSupport
Array<Contour> outlines // from ContourGenerator:Build
TreeSupport trees
trees:Generate(outlines, 100)
Array<Contour> paths = trees:GetPaths()
output paths:GetSize() + " support paths to print"
GetReachedBed()
How many trunks reached the bed.
Returns
integer: How many trunks reached the bed.
Example
use Libraries.Containers.Array
use Libraries.Fabrication.Geometry.Contour
use Libraries.Fabrication.Slicing.TreeSupport
Array<Contour> outlines // from ContourGenerator:Build
TreeSupport trees
trees:Generate(outlines, 100)
output trees:GetReachedBed() + " trunks reach the bed"
GetRestedOnModel()
How many branches came to rest on the model instead.
Returns
integer: How many branches came to rest on the model instead.
Example
use Libraries.Containers.Array
use Libraries.Fabrication.Geometry.Contour
use Libraries.Fabrication.Slicing.TreeSupport
Array<Contour> outlines // from ContourGenerator:Build
TreeSupport trees
trees:Generate(outlines, 100)
output trees:GetRestedOnModel() + " branches rest on the model"
GetSkippedBridgeCount()
How many tine spots the last Generate skipped because the overhang could bridge.
Returns
integer: How many tine spots the last Generate skipped because the overhang could bridge.
Example
use Libraries.Containers.Array
use Libraries.Fabrication.Geometry.Contour
use Libraries.Fabrication.Slicing.TreeSupport
Array<Contour> outlines // from ContourGenerator:Build
TreeSupport trees
trees:Generate(outlines, 100)
output trees:GetSkippedBridgeCount() + " spots left to bridge"
GetSkippedSmallCount()
How many tine spots the last Generate skipped for lying in a tiny overhang island.
Returns
integer: How many tine spots the last Generate skipped for lying in a tiny overhang island.
Example
use Libraries.Containers.Array
use Libraries.Fabrication.Geometry.Contour
use Libraries.Fabrication.Slicing.TreeSupport
Array<Contour> outlines // from ContourGenerator:Build
TreeSupport trees
trees:Generate(outlines, 100)
output trees:GetSkippedSmallCount() + " spots in tiny islands"
GetTipCount()
How many tines the last Generate seeded.
Returns
integer: How many tines the last Generate seeded.
Example
use Libraries.Containers.Array
use Libraries.Fabrication.Geometry.Contour
use Libraries.Fabrication.Slicing.TreeSupport
Array<Contour> outlines // from ContourGenerator:Build
TreeSupport trees
trees:Generate(outlines, 100)
output trees:GetTipCount() + " tines"
SetBase(number flare, integer layers)
Extra width where branches meet the bed.
Parameters
flarenumber: The extra radius on the first layer (mm).layersinteger: How many layers it narrows over.
Example
use Libraries.Containers.Array
use Libraries.Fabrication.Geometry.Contour
use Libraries.Fabrication.Slicing.TreeSupport
Array<Contour> outlines // from ContourGenerator:Build
TreeSupport trees
trees:SetBase(1.5, 3) // 1.5 mm wider on the bed, narrowing over 3 layers
trees:Generate(outlines, 100)
SetBedRouting(boolean enabled)
true (the default): route branches around the model to the bed where possible.
Parameters
enabledboolean: True to route branches to the bed.
Example
use Libraries.Containers.Array
use Libraries.Fabrication.Geometry.Contour
use Libraries.Fabrication.Slicing.TreeSupport
Array<Contour> outlines // from ContourGenerator:Build
TreeSupport trees
trees:SetBedRouting(false) // branches may rest on the model
trees:Generate(outlines, 100)
SetBottomGap(integer layers)
Empty layers between a branch and the model surface it rests on.
Parameters
layersinteger: The number of layers (0 or more).
Example
use Libraries.Containers.Array
use Libraries.Fabrication.Geometry.Contour
use Libraries.Fabrication.Slicing.TreeSupport
Array<Contour> outlines // from ContourGenerator:Build
TreeSupport trees
trees:SetBottomGap(1)
trees:Generate(outlines, 100)
SetBranchAngle(number degrees)
The steepest lean a branch may take from vertical (degrees, 0 to 89; default 40).
Parameters
degreesnumber: The angle (degrees, 0 to 89).
Example
use Libraries.Containers.Array
use Libraries.Fabrication.Geometry.Contour
use Libraries.Fabrication.Slicing.TreeSupport
Array<Contour> outlines // from ContourGenerator:Build
TreeSupport trees
trees:SetBranchAngle(40)
trees:Generate(outlines, 100)
SetBranchGrowth(number degrees, number maxR)
How fast branches thicken going down, and the thickest they may get.
Parameters
degreesnumber: The growth angle (degrees, 0 to 89).maxRnumber: The largest branch radius (mm).
Example
use Libraries.Containers.Array
use Libraries.Fabrication.Geometry.Contour
use Libraries.Fabrication.Slicing.TreeSupport
Array<Contour> outlines // from ContourGenerator:Build
TreeSupport trees
trees:SetBranchGrowth(5, 4.0) // thicken 5 degrees, at most 4 mm radius
trees:Generate(outlines, 100)
SetBridging(number maxLength)
The longest span (mm) left to bridge instead of supported; 0 = off.
Parameters
maxLengthnumber: The longest bridge (mm); 0 turns bridging off.
Example
use Libraries.Containers.Array
use Libraries.Fabrication.Geometry.Contour
use Libraries.Fabrication.Slicing.TreeSupport
Array<Contour> outlines // from ContourGenerator:Build
TreeSupport trees
trees:SetBridging(5.0) // spans up to 5 mm bridge unsupported
trees:Generate(outlines, 100)
SetDensity(number value)
The fill density inside branches (0 for walls only, up to 1).
Parameters
valuenumber: The density, 0 to 1.
Example
use Libraries.Containers.Array
use Libraries.Fabrication.Geometry.Contour
use Libraries.Fabrication.Slicing.TreeSupport
Array<Contour> outlines // from ContourGenerator:Build
TreeSupport trees
trees:SetDensity(0.15)
trees:Generate(outlines, 100)
SetGaps(number branchGap, number tineGap, integer topLayers)
The gaps between the support and the model.
Parameters
branchGapnumber: Sideways gap for branches (mm).tineGapnumber: Sideways gap for tines, which hold up edges (mm).topLayersinteger: Empty layers between a tip and the model above it.
Example
use Libraries.Containers.Array
use Libraries.Fabrication.Geometry.Contour
use Libraries.Fabrication.Slicing.TreeSupport
Array<Contour> outlines // from ContourGenerator:Build
TreeSupport trees
trees:SetGaps(0.8, 0.4, 1)
trees:Generate(outlines, 100)
SetLayerHeight(number height)
The layer height (mm), which turns the angles into per-layer steps.
Parameters
heightnumber: The layer height (mm), greater than 0.
Example
use Libraries.Containers.Array
use Libraries.Fabrication.Geometry.Contour
use Libraries.Fabrication.Slicing.TreeSupport
Array<Contour> outlines // from ContourGenerator:Build
TreeSupport trees
trees:SetLayerHeight(0.16)
trees:Generate(outlines, 125)
SetLineWidth(number width)
The extrusion width (mm), for the support walls and fill.
Parameters
widthnumber: The width (mm), greater than 0.
Example
use Libraries.Containers.Array
use Libraries.Fabrication.Geometry.Contour
use Libraries.Fabrication.Slicing.TreeSupport
Array<Contour> outlines // from ContourGenerator:Build
TreeSupport trees
trees:SetLineWidth(0.42)
trees:Generate(outlines, 100)
SetMinOverhangArea(number area)
Overhang islands smaller than this (mm^2) get no tines; 0 = off.
Parameters
areanumber: The smallest overhang island supported (mm^2); 0 supports all.
Example
use Libraries.Containers.Array
use Libraries.Fabrication.Geometry.Contour
use Libraries.Fabrication.Slicing.TreeSupport
Array<Contour> outlines // from ContourGenerator:Build
TreeSupport trees
trees:SetMinOverhangArea(1.0)
trees:Generate(outlines, 100)
SetOverhangAngle(number degrees)
Overhangs leaning further than this from vertical get supports (degrees, 0 to 90).
Parameters
degreesnumber: The angle (degrees, 0 to 90).
Example
use Libraries.Containers.Array
use Libraries.Fabrication.Geometry.Contour
use Libraries.Fabrication.Slicing.TreeSupport
Array<Contour> outlines // from ContourGenerator:Build
TreeSupport trees
trees:SetOverhangAngle(50)
trees:Generate(outlines, 100)
SetRestRules(number width, number lookAhead)
Branches rest on the model only where it's at least `width` mm wide under them; they look `lookAhead` mm down to steer off narrower parts in time. width 0 = rest anywhere.
Parameters
widthnumber: The narrowest place a branch may rest (mm); 0 lets it rest anywhere.lookAheadnumber: How far below to look for narrow parts (mm).
Example
use Libraries.Containers.Array
use Libraries.Fabrication.Geometry.Contour
use Libraries.Fabrication.Slicing.TreeSupport
Array<Contour> outlines // from ContourGenerator:Build
TreeSupport trees
trees:SetRestRules(3.0, 5.0)
trees:Generate(outlines, 100)
SetRoof(integer layers, number value)
Dense roof layers at the top of each tip.
Parameters
layersinteger: How many (0 for none).valuenumber: Their fill density (0 to 1).
Example
use Libraries.Containers.Array
use Libraries.Fabrication.Geometry.Contour
use Libraries.Fabrication.Slicing.TreeSupport
Array<Contour> outlines // from ContourGenerator:Build
TreeSupport trees
trees:SetRoof(2, 0.8) // two dense layers under the model
trees:Generate(outlines, 100)
SetTip(number diameter, number length)
Contact tip diameter (mm) and how far it runs straight down before it may lean (mm). Smaller tips break off cleaner and mark less.
Parameters
diameternumber: The tip diameter (mm), greater than 0.lengthnumber: The straight length (mm), 0 or more.
Example
use Libraries.Containers.Array
use Libraries.Fabrication.Geometry.Contour
use Libraries.Fabrication.Slicing.TreeSupport
Array<Contour> outlines // from ContourGenerator:Build
TreeSupport trees
trees:SetTip(0.8, 1.0)
trees:Generate(outlines, 100)
SetTipSpacing(number spacing)
The distance between neighbouring tines (mm).
Parameters
spacingnumber: The spacing (mm), greater than 0.
Example
use Libraries.Containers.Array
use Libraries.Fabrication.Geometry.Contour
use Libraries.Fabrication.Slicing.TreeSupport
Array<Contour> outlines // from ContourGenerator:Build
TreeSupport trees
trees:SetTipSpacing(4.0)
trees:Generate(outlines, 100)