Skip to content

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
ParameterDefaultMeaning
planeactive CPlanePlacement plane; omitted or invalid falls back to the active view’s construction plane, then to Plane.WorldXY
innerWidth15Width of the inner opening, mm
innerHeight20Height of the inner opening, mm
mode"CLOSED""CLOSED" (hoop with hinge) or "OPENED" (partial hoop). Case-insensitive; anything else throws
aperture6.5Closed mode only. The opening, in mm
aperturePercentagekeep (-1)Opened mode only. The opening as a 0-1 fraction of the hoop; default 0.25
profilesaved/defaultA 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 to MODE1 and flags the hinge on. The opening is cut to aperture millimetres. aperturePercentage is ignored.
  • "OPENED" sets the hoop type to MODE2 and flags the hinge off. The opening is cut to aperturePercentage of the hoop’s length. aperture is 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.