Skip to content

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
ParameterDefaultMeaning
gemId-The mother gem. Any gem shape works
prongCount0 -> 4Number of petals. Only 4 or 6 are accepted
pipeDiameter0 -> 1.15Petal pipe diameter, mm
height0 -> 1.7Vertical scale factor of the whole setting - not millimetres
bulgeWidth0 -> 1.5Multiplier on the reference tangential bow of the petals
modeNone -> ROUNDROUND or CLAW
ornamentNone -> NONENONE, 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:

SetterWhat 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).