Scripting API
Profile sweep
from ArtisanPlugin.Scripting import ProfileSweepApi
A profile sweep is the body a jeweller builds by lofting a chain of closed sections: the waist of a shank that swells towards the head, the tapering arm of a bypass, the horn of a claw. You draw the closed profiles where you want them along the piece, and the tool sweeps through them in the order you list, with a chosen end condition and cap at each end.
Create
ids = ProfileSweepApi.Create(curveIds, startCap = "ROUND", endCap = "ROUND",
startCapHeight = 0.2, endCapHeight = 0.2,
startContinuity = -1, endContinuity = -1,
startFlip = False, endFlip = False,
symmetry = "NONE", subD = False,
subDSegments = 32, subDRailSegments = 10) # -> [ids]
| Parameter | Default | Meaning |
|---|---|---|
curveIds | required | The closed profile curves, in sweep order; at least two |
startCap / endCap | None -> ROUND | Cap on that end: NONE, FLAT or ROUND |
startCapHeight / endCapHeight | 0 -> tool default 0.2 | Height of a ROUND cap, mm |
startContinuity / endContinuity | -1 keeps -> tangency (1) | End condition: 0 G0 position, 1 G1 tangency, 2 G2 curvature, 3 G3, 4 G4 |
startFlip / endFlip | False | Flips that end condition |
symmetry | None -> NONE | NONE, VERTICAL (mirror across world YZ), HORIZONTAL (mirror across world ZX) or QUAD (both) |
subD | False | True outputs a SubD instead of a Brep; caps do not apply |
subDSegments | 0 -> tool default 32 | Cross-section samples per profile, clamped to 3..256; SubD output only |
subDRailSegments | 0 -> tool default 10 | Total rings along the rail, clamped to 1..50; SubD output only |
The continuities are the one place where the house 0-keeps-default convention would lie, because 0 is a real value here - G0, position continuity. They therefore use a -1 sentinel: pass -1 (the default) to keep the tool’s or your saved value, and 0 when you actually want position continuity. Anything outside 0..4 throws ArgumentException. Every other numeric parameter behaves as usual: 0 keeps the tool’s default or your saved profile-sweep defaults.
Create returns a list of Guids and nothing else - there is no handle interface on this facade, so keep the ids if you need to reach the result again.
What is in that list depends on subD. Brep results are baked as parametric ProfileSweep custom objects: the Outliner lists them, they can be re-edited from the panel, and their mothers are the profile curves you passed in. SubD results are added as plain SubDs, with no parameters attached and nothing to re-edit. Either way the source curves stay untouched, and - unlike most accessories - neither output is routed to the metal layer or given the metal material; they are baked where the document currently is.
Symmetry mirrors the finished sweep and then tries to join the pieces, so VERTICAL or HORIZONTAL usually still returns one id rather than two, and QUAD one rather than four. When the mirrored pieces cannot be joined you get the separate pieces back.
Defaults come from the ProfileSweep model the ArtisanProfileSweep command uses, replaced wholesale by your saved profile-sweep defaults when you have any, and then overridden by whatever you passed explicitly.
Fewer than two curves throws ArgumentException, as does an id that is not a curve, an unknown cap mode or an unknown symmetry name. Curves that are not closed planar profiles do not throw at resolution time - they fail in the kernel and raise InvalidOperationException with “Profile sweep computation failed. Check that the curves are closed planar profiles.”, adding nothing to the document. This is a licensed mutation and needs an active document; wrap it in a Transaction for one-step undo.