Scripting API
Link
from ArtisanPlugin.Scripting import LinkApi
A link is one closed loop of wire - the unit a chain is made of. The tool sweeps a round wire section around a rectangular loop of the given width and height, and can twist the loop about its long axis so that consecutive links interlock the way a figure-of-eight or twisted-curb chain does. It mirrors the ArtisanLink panel’s Accept exactly.
Create
id = LinkApi.Create(plane = ..., width = 9, height = 6, diameter = 3,
twistAngle = -1) # -> id
| Parameter | Default | Meaning |
|---|---|---|
plane | omitted or invalid -> the active view’s construction plane | The plane the link is built on |
width | 0 -> tool default 9 | Length of the loop, mm |
height | 0 -> tool default 6 | Width of the loop across, mm |
diameter | 0 -> tool default 3 | Wire section diameter, mm |
twistAngle | -1 -> tool default 90 | Twist of the loop about its long axis, degrees |
All dimensions are millimetres. Every numeric parameter follows the house 0-keeps-default convention - except twistAngle, where 0 is a perfectly valid value (a flat, untwisted link). That parameter uses -1 as its keep-default sentinel: only a value of 0 or greater is applied, so pass -1, or leave it out, to keep the default twist.
Defaults resolve in two steps. Create starts from the same Link model the ArtisanLink command does, then overwrites it with the user’s saved link defaults when they have any. Whatever you pass explicitly is applied on top of that, so a saved default only shows through on parameters you left at their sentinel.
If plane is omitted or is not a valid plane, the link is built on the construction plane of the active viewport, falling back to world XY when there is no active view.
Create returns the Guid of the single baked link object. There is no handle and no query methods - a link is a plain result, not a live smart component you can interrogate later. The object lands on the metal layer with the document’s metal material, exactly as the panel’s Accept leaves it.
Create throws InvalidOperationException when the geometry fails to compute with the given parameters - a wire diameter too large for the loop is the usual cause - and when the licence is not valid. Because this is a licensed mutation of the document, wrap it in a Transaction if you want the creation to collapse into a single undo step.