Skip to content

Scripting API

Rope

from ArtisanPlugin.Scripting import RopeApi

The twisted rope wire jewellers use as a bezel border, a decorative shank or the edge of a bangle: several round strands laid side by side and wound around each other. The tool builds one cross-section from threads overlapping circles, extrudes it, twists the extrusion turns complete revolutions, and then flows the whole twisted bar onto the curve you give it.

Create

id = RopeApi.Create(curveId, diameter = 1.6, width = 3, threads = 3, turns = 5)   # -> id
ParameterDefaultMeaning
curveId-The existing curve the rope runs along - it is the rail, not a plane
diameter1.6Diameter of a single strand, mm
width3Overall diameter of the finished rope - the circle the strands sit inside
threads3How many strands are wound together
turns5Complete twists over the whole length of the curve

width and diameter work together: each strand is placed at (width - diameter) / 2 from the centre, so a wide rope with thin strands leaves the strands separate. When the strands do not overlap enough to merge into one closed profile the computation stops with REDUCE_THE_WIDTH_OR_INCREASE_THREAD_DIAMETER. An open curve comes back with its two ends capped; a closed curve comes back as a continuous loop with no caps.

Returns the id of a single Rope smart component - a RopeCustomObject that remembers curveId as its mother curve, so the Outliner can still edit it afterwards. It lands on the metal layer with the document’s metal material, exactly like the panel’s Accept. The source curve is left untouched.

Every numeric parameter follows the house 0-keeps-default convention: pass 0 (or omit it) and the value comes from your saved Rope defaults, or from the tool defaults above if you have none. There is no -1 sentinel here - 0 is not a meaningful strand diameter, width, thread count or turn count, so nothing is lost.

Passing an id that is not a curve fails immediately with “Object … is not a curve.”, and a curve the rope cannot be flowed onto raises “Rope computation failed on that curve.”

This is a licensed mutation. Wrap it in a Transaction so the whole thing undoes in one step:

from ArtisanPlugin.Scripting import RopeApi, Transaction

with Transaction.Begin("Rope border"):
    RopeApi.Create(curveId, diameter = 0.9, width = 2.2, threads = 4, turns = 12)