Scripting API
Huggie
from ArtisanPlugin.Scripting import HuggieApi
A huggie is the small, thick hoop earring that sits tight against the lobe rather than hanging from it. Artisan sweeps a ring profile around an oval defined by its inner width and height, splits the loop to leave the opening the ear passes through, and closes the piece with a hinge or finishes it with a post and plate.
Create
id = HuggieApi.Create(plane = ..., innerWidth = 15, innerHeight = 20,
mode = "CLOSED", aperture = 6.5,
aperturePercentage = -1, profile = None) # -> id
| Parameter | Default | Meaning |
|---|---|---|
plane | active CPlane | Placement plane; omitted or invalid falls back to the active view’s construction plane, then to Plane.WorldXY |
innerWidth | 15 | Width of the inner opening, mm |
innerHeight | 20 | Height of the inner opening, mm |
mode | "CLOSED" | "CLOSED" (hoop with hinge) or "OPENED" (partial hoop). Case-insensitive; anything else throws |
aperture | 6.5 | Closed mode only. The opening, in mm |
aperturePercentage | keep (-1) | Opened mode only. The opening as a 0-1 fraction of the hoop; default 0.25 |
profile | saved/default | A RING_PROFILE asset name, applied to all three huggie profiles |
Which parameters the mode ignores
The two modes are mutually exclusive and each reads only its own opening parameter, exactly as the panel’s Closed and Opened tabs do.
"CLOSED"sets the hoop type toMODE1and flags the hinge on. The opening is cut toaperturemillimetres.aperturePercentageis ignored."OPENED"sets the hoop type toMODE2and flags the hinge off. The opening is cut toaperturePercentageof the hoop’s length.apertureis ignored.
The fraction must fall strictly between 0 and 1 or no geometry can be cut; a value above 1 is read as a percentage and divided by 100, so 20 is accepted and means 0.2. Outside that, the call fails with “INVALID_OPERTURE”.
Only the hinge is switched by the mode. The hinge’s own dimensions - join position, hole and cut diameters, thickness, number of males, margin - and the post and plate dimensions are not exposed by this facade and keep the tool or saved defaults in both modes. Note that the geometry engine builds a post in both modes, offset by the plate thickness in closed mode; the mode does not suppress it.
Result
Create returns a single id: the merged brep of hoop, plates and post, added as an editable Artisan huggie object routed to the metal layer with the document’s metal material. The parts are packed into one brep rather than boolean-unioned, which is why coincident faces survive in the result.
Defaults resolve as in the other profiled components: the ring-profile asset is resolved first, then your saved huggie defaults replace the whole model - but only when no explicit profile was passed. Asking for a profile therefore skips your saved defaults for the dimensions too, so pass the sizes you care about alongside it.
This is a licensed mutation and needs an active document. An unrecognised mode raises “Unknown huggie mode ’…’. Valid values: CLOSED, OPENED.”; geometry that cannot be built raises “Huggie computation failed with the given parameters (…)” and nothing is added. Wrap the call in a Transaction to get one-step undo.