Scripting API
Bail
from ArtisanPlugin.Scripting import BailApi
The bail is the loop soldered or fused to the top of a pendant so a chain can pass through it. Artisan builds it as a tapered arch swept along a ring profile - wider where it meets the pendant, narrower at the top - and can add a torus O-ring hanging from it.
Create
ids = BailApi.Create(plane = ..., diameterTop = 3, diameterBottom = 1, distance = 5,
withORing = False, name = None, profile = None) # -> [ids]
| Parameter | Default | Meaning |
|---|---|---|
plane | active CPlane | Placement plane; omitted or invalid falls back to the active view’s construction plane, then to Plane.WorldXY |
diameterTop | 3 | Diameter at the top of the arch, mm |
diameterBottom | 1 | Diameter where the bail meets the pendant, mm |
distance | 5 | Height of the bail, mm |
withORing | False | True also builds the torus O-ring |
name | "Bail" | Name stored on the component, shown in the Outliner |
profile | saved/default | A RING_PROFILE asset name |
Every numeric parameter follows the house 0-keeps-default convention: 0 means “use the tool’s default, or my saved defaults”. Bail has no -1 sentinel - none of its numbers has a meaningful zero.
Create returns the ids of the created breps: one for the bail itself, plus a second for the O-ring when withORing is True. The breps are added as Artisan brep objects with the document’s metal material and gathered into a single group carrying the serialised parameters in user data - that group is what makes the component editable in the panel afterwards. Unlike the other accessories, Bail does not route its breps to the metal layer; they take the document’s current layer and only the material comes from the metal settings.
Defaults resolve exactly as in the tool: the ring-profile asset is resolved first (by name when profile is given), then your saved bail defaults replace the whole model - but only when no explicit profile was passed. Asking for a profile therefore skips your saved defaults for the other parameters too, so pass the dimensions you care about alongside it.
This is a licensed mutation, so it needs a valid licence and it fails with “No active document.” when there is none. If the geometry cannot be computed with the given numbers it raises “Bail computation failed with the given parameters.” and nothing is added. Wrap the call in a Transaction to get one-step undo.