Scripting API
Size run
from ArtisanPlugin.Scripting import ManufacturingApi as manufacturing
A design is modelled at one finger size, but production casts a run of them. ResizeRing is the ArtisanResizer tool run headless: it takes a closed ring mesh and produces one resized copy per target inner diameter, organised exactly like the tool’s Layers mode so each size is ready to isolate and export.
Usage
sizes = manufacturing.ResizeRing(meshId, fromDiameter, toDiameters, names = None)
| Parameter | Default | Meaning |
|---|---|---|
meshId | — | The closed ring mesh to resize |
fromDiameter | — (required) | The ring’s current inner diameter in mm; 0 = the document’s finger size |
toDiameters | — | Target inner diameters in mm, e.g. [16.5, 17.35, 18.2]. Each must be > 0 |
names | None | Optional labels, parallel to toDiameters; the default label is the diameter formatted ("17.35"). Blank entries also fall back to the diameter |
What it creates
For each target diameter the call adds a resized copy of the ring; the original mesh is left untouched where it stands. Every copy gets:
- a child layer under a “Resizer” parent layer (both in the tool’s purple), named with the tool’s ring reference followed by the size label;
- its own group, named
Resizer {label}; - a position in a row: copy i is translated along +Y by i × the tool’s ring distance, so the sizes line up beside the original.
Because it adds meshes, layers and groups, the call belongs inside a Transaction.
Returns one ResizedRing per size, in the order you asked for them:
| Field | Type | Meaning |
|---|---|---|
Name | str | The size label — also the child layer suffix and the group name |
Diameter | float | The target inner diameter (mm) |
RingId | Guid | The resized ring mesh |
Validation that throws:
meshIdis not a mesh:"Object {meshId} is not a mesh."- No targets:
"At least one target diameter is required." - A non-positive target:
"Diameters must be > 0." - A size fails to compute:
"Resize to Ø{diameter} mm failed. The mesh must be a closed ring."— sizes computed before the failure are already in the document.
from ArtisanPlugin.Scripting import ManufacturingApi as manufacturing, Transaction
with Transaction.Begin("Size run"):
sizes = manufacturing.ResizeRing(ringId, 0, # 0 = the document's finger size
[16.5, 17.35, 18.2],
names = ["S", "M", "L"])
for s in sizes:
print(f"{s.Name}: Ø{s.Diameter} mm -> {s.RingId}")