Skip to content

.NET API

SmartProfileApi

Smart Profiles: profile sections swept along a curve, varying along the way.

from ArtisanPlugin.Scripting import SmartProfileApi

See also the guide, Accessories › Smart profile, and the Python package, ra.smart_profile.

Methods

Method
AllISmartProfile handles for every object of this kind in the active document (empty when there is no document).
ByLayerISmartProfile handles on the layer with the given full path (empty when the layer does not exist).
CountNumber of objects of this kind in the active document.
CreateSweeps profile sections along existing curves (the ArtisanProfiles “Smart Profiles” tool, headless): one smart profile per curve, linked to it (editing the curve regenerates it).
FindThe handle for id, or null when the id does not belong to an object of this kind.
SelectedSmart profiles currently selected in the active doc.

All

IReadOnlyList<ISmartProfile> SmartProfileApi.All()

ISmartProfile handles for every object of this kind in the active document (empty when there is no document).

Returns IReadOnlyList<ISmartProfile>.

ByLayer

IReadOnlyList<ISmartProfile> SmartProfileApi.ByLayer(string layerName)

ISmartProfile handles on the layer with the given full path (empty when the layer does not exist).

ParameterTypeDefault
layerNamestringrequired

Returns IReadOnlyList<ISmartProfile>.

Count

int SmartProfileApi.Count()

Number of objects of this kind in the active document.

Returns int.

Create

IReadOnlyList<ISmartProfile> SmartProfileApi.Create(
    IEnumerable<Guid> curveIds,
    int count = 0,
    IEnumerable<double> positions = null,
    IEnumerable<double> widths = null,
    IEnumerable<double> heights = null,
    IEnumerable<double> rotations = null,
    IEnumerable<double> displacements = null,
    IEnumerable<string> profiles = null,
    IEnumerable<string> sectionTypes = null,
    double width = 0,
    double height = 0,
    string profile = null,
    string sectionType = null,
    double thickness = 0,
    double comfort = 0,
    double startCapDistance = double.NaN,
    double endCapDistance = double.NaN,
    int rebuildPoints = 0,
    IEnumerable<Guid> orientationIds = null,
    string element = null)

Sweeps profile sections along existing curves (the ArtisanProfiles “Smart Profiles” tool, headless): one smart profile per curve, linked to it (editing the curve regenerates it). Each section sits at a normalized position t in 0..1 along the curve and has its own RING_PROFILE asset, width, height, rotation and displacement. Sections, in priority order: positions (with optional parallel widths, heights, rotations, displacements, profiles, sectionTypes; 0 / empty = the uniform value) replace everything; else count (2+) identical sections spread evenly (closed curves skip t = 1); else the user’s saved default sections; else 2 sections at the ends. At least two sections. width / height (0 = 1 mm), profile (default RING_PROFILE, or “id:”), sectionType COMFORT (default) | SOLID | THICKNESS with thickness (0.7) and comfort (0.3) apply to every section without its own value. startCapDistance / endCapDistance dome the ends of open curves (literal mm, NaN keeps 1). rebuildPoints 0 keeps the profiles as drawn, 4+ rebuilds them. orientationIds = solids/meshes whose surface orients the sections (e.g. the ring the profile runs on). Curves with kinks give mitred pieces: fillet them first. element = name of a saved SmartProfile element (ElementsApi.List(“SmartProfile”)) to start from, in place of the saved defaults (its sections are used unless positions / count are given); explicit arguments override it. Returns one ISmartProfile handle per curve.

ParameterTypeDefault
curveIdsIEnumerable<Guid>required
countint0
positionsIEnumerable<double>null
widthsIEnumerable<double>null
heightsIEnumerable<double>null
rotationsIEnumerable<double>null
displacementsIEnumerable<double>null
profilesIEnumerable<string>null
sectionTypesIEnumerable<string>null
widthdouble0
heightdouble0
profilestringnull
sectionTypestringnull
thicknessdouble0
comfortdouble0
startCapDistancedoubledouble.NaN
endCapDistancedoubledouble.NaN
rebuildPointsint0
orientationIdsIEnumerable<Guid>null
elementstringnull

Returns IReadOnlyList<ISmartProfile>.

Find

ISmartProfile SmartProfileApi.Find(Guid id)

The handle for id, or null when the id does not belong to an object of this kind.

ParameterTypeDefault
idGuidrequired

Returns ISmartProfile.

Selected

IReadOnlyList<ISmartProfile> SmartProfileApi.Selected()

Smart profiles currently selected in the active doc.

Returns IReadOnlyList<ISmartProfile>.

Handles and sections

What the methods above hand back. A handle’s setters regenerate the object; wrap changes in a Transaction so they land as one undo step.

ISmartProfile

Handle — extends IParametricObject.

Smart profile (the ArtisanProfiles tool): a document curve swept through N RING_PROFILE sections, each placed at a normalized position t along the curve (0 = start, 1 = end). Stays linked to the curve: editing the curve regenerates it. Sections are always sorted by t, so an index refers to the n-th section along the curve.

PropertyType
CurveIdGuidgetThe document curve the profile follows.
EndCapDistancedoublegetDome height of the end cap (open curves), mm.
IdGuidget(from IParametricObject)
LayerNamestringget(from IParametricObject)
MotherGemIdGuidget(from IParametricObject)
ObjectTypestringget(from IParametricObject)
PositionPoint3dget(from IParametricObject)
RebuildPointsintget0 = profiles used as drawn; else rebuilt to this many points.
SectionCountintget
SectionHeightsIReadOnlyList<double>getmm, same order
SectionMirrorOfIReadOnlyList<int>get-1 for a normal section, else the index of the section it mirrors
SectionPositionsIReadOnlyList<double>gett of each section, sorted
SectionProfilesIReadOnlyList<string>getRING_PROFILE asset name of each section, same order
SectionRotationsIReadOnlyList<double>getdegrees, same order
SectionTypesIReadOnlyList<string>getCOMFORT | SOLID | THICKNESS, same order
SectionWidthsIReadOnlyList<double>getmm, same order
StartCapDistancedoublegetDome height of the start cap (open curves), mm.
Method
void AddSection(double t, double width = 0, double height = 0, string profile = null)Adds a section at t (0..1, at least 0.002 from the others). Width/height 0 = 1 mm; profile omitted = default RING_PROFILE.
void Delete()(from IParametricObject)
void MirrorSection(int index)Adds a section that mirrors index across the curve (t = 1 - t, rotation negated) and follows it from then on.
void Move(Vector3d translation)(from IParametricObject)
void RemoveSection(int index)
void SetAllSections(double width, double height)
void SetElement(string element)Applies a saved SmartProfile element (ElementsApi.List(“SmartProfile”)): its sections and settings replace the current ones; the curve and the orientation objects stay. Regenerates in place (same id).
void SetEndCapDistance(double distance)literal mm (0 = flat)
void SetHeight(double height)every section
void SetProfile(string profile)every section: RING_PROFILE asset name or “id:“
void SetRebuildPoints(int points)0 = off; else 4+ points
void SetSection(int index, double width = 0, double height = 0)Mutations regenerate the profile in place (same Guid) and call LicenseGate.RequireValid() first. Millimetres; 0 keeps the value. A mirrored section follows its source: edit the source instead.
void SetSectionDisplacement(int index, double displacement)sideways offset of the section, mm (literal: 0 = centered)
void SetSectionPosition(int index, double t)
void SetSectionProfile(int index, string profile)RING_PROFILE asset name or “id:“
void SetSectionReversed(int index, bool reversed)true = profile drawn reversed
void SetSectionRotation(int index, double degrees)
void SetSectionType(int index, string sectionType, double thickness = 0, double comfort = 0)COMFORT | SOLID | THICKNESS; thickness/comfort mm, 0 keeps
void SetSections(string sectionsJson)Replaces every section from a JSON array, the same shape create_smart_profile takes: [{“t”: 0, “width”: 2, “height”: 1, “rotation”: 0, “displacement”: 0, “profile”: ”…”, “type”: “COMFORT”}, …] (only t is required; 2+ entries). Thickness and comfort carry over from the current first section; mirrors are dropped.
void SetStartCapDistance(double distance)literal mm (0 = flat)
void SetWidth(double width)every section