Skip to content

Scripting API

Sprue external tree

from ArtisanPlugin.Scripting import ManufacturingApi as manufacturing

An external tree feeds the piece from outside: a tapered trunk stands next to the mesh - not through it - and branches reach across from the trunk to the outer surface, one per contact point. It suits pieces with no convenient bore to feed through, or where you want the metal entering thick outer sections directly. This is the ArtisanSprueExternalTree tool, headless - its two interactive picks become explicit arguments; the tool itself seeds the trunk beside the mesh (bounding-box Max.X + 5, centre Y, Z = 0), a sensible starting point for trunkBasePoint.

Usage

ids = manufacturing.SprueExternalTree(meshId, trunkBasePoint, contactPoints,
                                      height = 0, topDiameter = 0,
                                      bottomDiameter = 0,
                                      branchTrunkDiameter = 0,
                                      branchContactDiameter = 0)      # -> [ids]
ParameterDefaultMeaning
meshIdrequiredThe closed mesh to sprue - a mesh, or a SubD (meshed at default density)
trunkBasePointrequiredWhere the trunk stands, outside the mesh
contactPointsrequiredPoints on the mesh where the branches attach - at least one
height20Height of the trunk, mm
topDiameter3Diameter at the top of the trunk, mm
bottomDiameter5Diameter at the base of the trunk, mm (the taper)
branchTrunkDiameter2Diameter of each branch where it leaves the trunk, mm
branchContactDiameter0.8Diameter of each branch where it meets the mesh, mm

Every numeric parameter follows the house 0-keeps-default convention: 0 means “use the tool’s default, or my saved defaults” - when you have saved defaults for this tool in the panel, those are the starting point rather than the factory numbers. There is no -1 sentinel and none of the numbers has a meaningful zero.

SprueExternalTree returns the ids of the sprue meshes it adds, baked to the last user layer with the wax colour, like the tool’s Accept; the source mesh is left untouched. This is a licensed mutation and needs an active document - it throws “No active document.” otherwise. Passing something that is neither mesh nor SubD raises ArgumentException “Object {id} is not a mesh.”; an empty contactPoints raises “At least one contact point on the mesh is required.”. When the geometry cannot be built, the call raises InvalidOperationException “Sprue computation failed. Check that the contact points lie on the mesh and the trunk base point is beside it.” (or “Sprue external tree computation failed with the given parameters.” with the underlying detail when the kernel rejects the numbers) and nothing is added. Wrap the call in a Transaction so the whole sprue undoes in one step.