Skip to content

Scripting API

Bangle

from ArtisanPlugin.Scripting import BangleApi

A bangle is the rigid bracelet that slips over the hand rather than fastening around the wrist. Artisan sweeps a ring profile around an oval defined by its width and height, either as a full closed hoop or as an open one with a gap of a given aperture.

Create

id = BangleApi.Create(plane = ..., width = 50, height = 30, aperture = 10,
                      closed = False, profile = None)                     # -> id
ParameterDefaultMeaning
planeactive CPlanePlacement plane; omitted or invalid falls back to the active view’s construction plane, then to Plane.WorldXY
width50Inner width of the oval, mm
height30Inner height of the oval, mm
aperture10Opening of the open type, mm - ignored when closed is True
closedFalseTrue builds the full hoop (type CLOSED)
profilesaved/defaultA RING_PROFILE asset name, applied to all three bangle profiles

Numeric parameters follow the 0-keeps-default convention: 0 means “use the tool’s default, or my saved defaults”. There is no -1 sentinel on this facade.

Create returns the single Guid of the bangle object - a parametric Bangle custom object, added to the metal layer with the document’s metal material, exactly like the panel’s Accept.

Defaults resolve as in the tool: the ring-profile asset is resolved first (by name when profile is given), then your saved bangle defaults replace the whole model - but only when no explicit profile was passed. Requesting a profile therefore skips your saved defaults for width, height and aperture as well, so state them explicitly when you need them.

This is a licensed mutation and needs an active document. A failed computation raises “Bangle computation failed” with the kernel’s message appended, and adds nothing. Wrap the call in a Transaction for one-step undo.