Skip to content

Scripting API

Sprue external frames

from ArtisanPlugin.Scripting import ManufacturingApi as manufacturing

The external frame is the sprue for elongated work laid flat in a row - chains, bracelets, tennis-style links: a rounded-rectangle runner surrounds the pieces and pairs of thin stubs reach inward from the long sides (plus, optionally, one from each short end) to feed them. The frame doubles as a handling rail: the whole row stays rigid through investing and comes out of the flask as one piece. This is the ArtisanSprueExternalFrames tool, headless.

Usage

ids = manufacturing.SprueExternalFrames(meshIds = None, margin = 0,
                                        cornerRadius = 0, frameDiameter = 0,
                                        connectorCount = 0,
                                        connectorSeparation = 0,
                                        connectorLength = 0,
                                        endConnectors = True)      # -> [ids]
ParameterDefaultMeaning
meshIdsselectionThe pieces the frame is built around; None or empty = the current selection
margin3Gap between the pieces’ combined bounding box and the frame, mm
cornerRadius3Radius of the frame’s rounded corners, mm
frameDiameter2Diameter of the frame wire, mm
connectorCountper objectNumber of stub pairs along the long sides; 0 = one pair per given object, what the tool seeds on selection
connectorSeparation5Separation between the two stubs of a pair, mm
connectorLength4Length of each stub, mm
endConnectorsTrueTrue also adds the two short-side stubs (the tool’s default)

The numeric parameters follow the house 0-keeps-default convention, with one twist: connectorCount = 0 is not a fixed tool number but one stub pair per object found, recomputed from what you pass or select. There is no -1 sentinel. Note this tool does not read saved panel defaults - 0 always means the factory values above.

The frame is built around the combined world bounding box of the pieces, grown by margin - the same box the tool’s selector shows - so the objects need not be meshes: anything with a valid bounding box counts, and objects that cannot be found or have no valid box are silently skipped.

SprueExternalFrames returns the ids of the frame meshes it adds, baked to the last user layer with the wax colour, like the tool’s Accept; the pieces themselves are left untouched. This is a licensed mutation and needs an active document - it throws “No active document.” otherwise. When nothing usable is passed or selected, it raises ArgumentException “Nothing to frame: select (or pass) at least one object.”. When the geometry cannot be built, the call raises InvalidOperationException “Sprue computation failed. Check that the pieces span a valid box.” (or “Sprue external frames 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 frame undoes in one step.