Skip to content

Scripting API

Sprue tree

from ArtisanPlugin.Scripting import ManufacturingApi as manufacturing

The radial tree is the classic production casting setup: a rubber-base disc, a conical central trunk, and rings of angled branches around it — the wax “Christmas tree” a foundry invests and burns out to cast dozens of pieces in one pour. This is the ArtisanSprueTree tool run headless: it builds the tree and hangs a copy of each given mesh from the branches.

Usage

ids = manufacturing.SprueTree(meshIds = None, basePoint = Point3d.Origin,
                              copiesPerMesh = 0, height = 0,
                              bottomDiameter = 0, topDiameter = 0,
                              floors = 0, piecesPerFloor = 0,
                              branchDiameter = 0)      # -> [ids]
ParameterDefaultMeaning
meshIdscurrent selectionThe model meshes to distribute; None or empty uses whatever is selected
basePointworld originWhere the base disc sits
copiesPerMesh0 = automaticCopies of each mesh; 0 fills the free branches, the tool’s automatic mode
height150Trunk height, mm
bottomDiameter10Trunk diameter at the base, mm
topDiameter10Trunk diameter at the top, mm
floors7Number of branch floors up the trunk
piecesPerFloor8Branches per floor
branchDiameter1.5Branch (connector) diameter, mm

Numeric parameters follow the 0-keeps-default convention, but note this tool has no saved defaults0 always means the tool’s factory default, never your settings. copiesPerMesh = 0 is a meaningful zero: it switches to automatic fill rather than keeping a default count.

Copies are distributed over the branches in round-robin and each hangs from its branch by the bottom-centre of its bounding box (the tool’s default anchor), with the default branch length 8.5 mm at 15°.

It returns an IReadOnlyList<Guid> — the ids of all the meshes added: base, trunk, connectors and every model copy, in bake order. They are not grouped. The first object routes through the layer service to the last user layer and the rest follow it; the structure takes the wax preview colour and the model copies keep their own model colour. The source meshes are only read (copies are duplicates), never modified. This is a long operation — one collision-tested placement per copy.

It needs a valid licence and fails with “No active document.” when there is none. If nothing resolves to a mesh it raises “No meshes to work with: select (or pass) at least one mesh.”; if the tree cannot be built it raises “Sprue tree computation failed.”, or “Sprue tree computation failed with the given parameters (…).” when the kernel rejects the numbers, and nothing is added. Wrap the call in a Transaction to get one-step undo.