Scripting API
Tulip
from ArtisanPlugin.Scripting import TulipApi as tulip
The tulip head: four or six petal-shaped prongs that rise from under the girdle and fold over the stone, so the setting reads as an opening flower rather than a bare claw. RhinoArtisan builds it as SubD petals - the ArtisanTulip tool, headless - and bakes them as plain SubD objects with the metal material.
A tulip is built around a mother gem and stays its parametric child: the group records the gem’s Guid, and the petals are regenerated from it on every edit.
Create
t = tulip.Create(gemId, prongCount = 0, pipeDiameter = 0, height = 0,
bulgeWidth = 0, mode = None, ornament = None) # -> ITulip
| Parameter | Default | Meaning |
|---|---|---|
gemId | - | The mother gem. Any gem shape works |
prongCount | 0 -> 4 | Number of petals. Only 4 or 6 are accepted |
pipeDiameter | 0 -> 1.15 | Petal pipe diameter, mm |
height | 0 -> 1.7 | Vertical scale factor of the whole setting - not millimetres |
bulgeWidth | 0 -> 1.5 | Multiplier on the reference tangential bow of the petals |
mode | None -> ROUND | ROUND or CLAW |
ornament | None -> NONE | NONE, UNION or LEAF |
0 (or None) keeps the tool default, or your saved Tulip defaults when you have some - the same starting model the panel opens with. Passing a prongCount other than 4 or 6, an unknown mode, or an unknown ornament raises straight away; a gemId that is not a gem is rejected too.
On an asymmetric stone - oval, marquise, anything where the X and Y sizes differ by more than 0.01 mm - the ornament placement defaults to the X axis with per-axis leaf editing, exactly as the panel does. Symmetric stones keep a single shared set of leaves.
Edit
Create, Find and All return an ITulip handle. It exposes two setters; each regenerates the tulip in place, keeping its Guid and undo intact:
| Setter | What it changes |
|---|---|
SetPipeDiameter(d) | Petal pipe diameter in mm. Must be > 0 |
SetHeight(h) | Vertical scale factor of the setting, not mm. Must be > 0 |
Everything else the handle carries is read-only after creation: ProngCount, PipeDiameter, Height, Mode, Ornament, plus the gem properties GemShape, GemMaterial and GemCaratWeight and the structural Id, MotherGemId, LayerName, Position, Move(vector) and Delete(). To change the prong count, mode or ornament, delete and recreate.
from ArtisanPlugin.Scripting import TulipApi as tulip, Transaction
t = tulip.Selected()[0]
with Transaction.Begin("Taller tulip"):
t.SetPipeDiameter(1.3)
t.SetHeight(2.0)
Queries
All(), Find(id), Count(), Selected(), ByLayer(name), ForGem(gemId).