Scripting API
Smart profile
from ArtisanPlugin.Scripting import SmartProfileApi
A smart profile is the Smart Profiles tool of the Solid tab (ArtisanProfiles) without its panel. It sweeps RING_PROFILE sections along an existing curve to make bands, wires, frames and free-form rims whose section can change along the way. Each section sits at a normalized position t along the curve (0 = start, 1 = end) and has its own profile asset, width, height, rotation and sideways displacement.
The result stays linked to the curve: when you edit the curve, the profile regenerates. It differs from Profile sweep in what it sweeps through. Profile sweep lofts through closed curves that you draw in place, while a smart profile places profile assets parametrically along one rail.
Create
profiles = SmartProfileApi.Create(curveIds, count = 0, positions = None,
widths = None, heights = None, rotations = None,
displacements = None, profiles = None, sectionTypes = None,
width = 0, height = 0, profile = None, sectionType = None,
thickness = 0, comfort = 0,
startCapDistance = None, endCapDistance = None,
rebuildPoints = 0, orientationIds = None,
element = None) # -> [ISmartProfile]
You get one smart profile per curve, as one ISmartProfile handle each. The sections are decided in priority order:
positions: one section pert. The parallel listswidths,heights,rotations,displacements,profilesandsectionTypesare optional; a0or an empty entry takes the uniform value.count(2 or more): identical sections spread evenly. Closed curves skipt = 1.element: the sections of a saved SmartProfile element.- Your saved default sections.
- Otherwise, two sections, one at each end.
A smart profile always has at least two sections.
| Parameter | Default | Meaning |
|---|---|---|
width / height | 0 -> 1 | Section size in mm, for sections without their own |
profile | default RING_PROFILE | Asset name or "id:<n>", for sections without their own |
sectionType | COMFORT | COMFORT, SOLID or THICKNESS |
thickness | 0.7 | Wall thickness of THICKNESS sections, mm |
comfort | 0.3 | Comfort-fit depth of COMFORT sections, mm |
startCapDistance / endCapDistance | 1 | Dome height of the ends of open curves, literal mm (0 = flat) |
rebuildPoints | 0 | 0 keeps the profiles as drawn. 4 or more rebuilds each profile to that many points for a smoother loft |
orientationIds | curve frame | Solids or meshes whose surface orients the sections, such as the ring the profile runs on |
element | — | A saved SmartProfile element to start from. Its sections are used unless you pass positions or count, and explicit arguments override it |
from ArtisanPlugin.Scripting import SmartProfileApi, Transaction
with Transaction.Begin("Tapered rim"):
p = SmartProfileApi.Create([railId],
positions = [0, 0.5, 1],
widths = [1.2, 2.4, 1.2],
heights = [1.0, 1.6, 1.0],
profile = "Knife Edge")[0]
Edit
ISmartProfile exposes the curve (CurveId) and the sections as parallel read-only lists: SectionPositions, SectionWidths, SectionHeights, SectionRotations, SectionProfiles, SectionTypes and SectionMirrorOf (-1, or the index of the section it mirrors). Sections are always sorted by t, so an index refers to the n-th section along the curve. Every change regenerates the profile in place, keeping the same id:
| Method | Does |
|---|---|
SetSection(index, width = 0, height = 0) | Resizes one section. 0 keeps the value, so you can change only the width |
SetSectionPosition / SetSectionRotation / SetSectionDisplacement / SetSectionProfile / SetSectionReversed | Edit one section |
SetSectionType(index, type, thickness = 0, comfort = 0) | COMFORT, SOLID or THICKNESS |
AddSection(t, width = 0, height = 0, profile = None) | Inserts a section. It must be at least 0.002 away from the others |
RemoveSection(index) | Removes one |
MirrorSection(index) | Adds a section at 1 - t, with the rotation negated, that keeps following its source |
SetSections(json) | Replaces every section from a JSON array: [{"t": 0, "width": 2, "height": 1, "rotation": 0, "displacement": 0, "profile": "…", "type": "COMFORT"}, …]. Only t is required, and at least 2 entries |
SetAllSections(width, height) / SetWidth / SetHeight / SetProfile | Apply to every section |
SetStartCapDistance / SetEndCapDistance / SetRebuildPoints | Global settings |
SetElement(name) | Applies a saved SmartProfile element. The curve and the orientation objects stay |
A mirrored section follows its source, so edit the source instead.
Queries
All(), Find(id), Count(), Selected(), ByLayer(name).
From the MCP
create_smart_profile takes the sections as an array of objects ({"t": 0.5, "width": 2.4, …}). edit_object reaches every method above by its snake_case name:
{"set_section": {"index": 1, "width": 1.6}}
{"add_section": {"t": 0.25, "width": 1.8}}
{"sections": [{"t": 0, "width": 1}, {"t": 1, "width": 2}]}
In the Python package, this page corresponds to ra.smart_profile.