Python package
ra.smart_profile
Smart Profiles: profile sections swept along a curve, varying along the way.
import rhinoartisan as ra
Wraps ArtisanPlugin.Scripting.SmartProfileApi.
Functions
| Function | |
|---|---|
all() | SmartProfile handles for every object of this kind in the active document (empty when there is no document). |
by_layer() | SmartProfile handles on the layer with the given full path (empty when the layer does not exist). |
count() | Number of objects of this kind in the active document. |
create() | 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). |
find() | The handle for id, or None when the id does not belong to an object of this kind. |
selected() | Smart profiles currently selected in the active doc. |
ra.smart_profile.all()
ra.smart_profile.all() -> List[SmartProfile]
SmartProfile handles for every object of this kind in the active document (empty when there is no document).
ra.smart_profile.by_layer()
ra.smart_profile.by_layer(layer_name: str) -> List[SmartProfile]
SmartProfile handles on the layer with the given full path (empty when the layer does not exist).
| Parameter | Type | |
|---|---|---|
layer_name | str | required |
ra.smart_profile.count()
ra.smart_profile.count() -> int
Number of objects of this kind in the active document.
ra.smart_profile.create()
ra.smart_profile.create(curve_ids: Sequence[IdLike], count=None, positions=None, widths=None, heights=None, rotations=None, displacements=None, profiles=None, section_types=None, width=None, height=None, profile=None, section_type=None, thickness=None, comfort=None, start_cap_distance=None, end_cap_distance=None, rebuild_points=None, orientation_ids=None, element=None) -> List[SmartProfile]
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, section_types; 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:section_type COMFORT (default) | SOLID | THICKNESS with thickness (0.7) and comfort (0.3) apply to every section without its own value. start_cap_distance / end_cap_distance dome the ends of open curves (literal mm, NaN keeps 1). rebuild_points 0 keeps the profiles as drawn, 4+ rebuilds them. orientation_ids = solids/meshes whose surface orients the sections (e.g. the ring the profile runs on). Curves with kinks give mitred pieces: fillet them first. Returns one SmartProfile handle per curve. element = name of a saved element (ra.elements.list) to start from; explicit arguments override it.
| Parameter | Type | |
|---|---|---|
curve_ids | Sequence[IdLike] | required |
count | int | optional — None = the tool default |
positions | Sequence[float] | optional — None = the tool default |
widths | Sequence[float] | optional — None = the tool default |
heights | Sequence[float] | optional — None = the tool default |
rotations | Sequence[float] | optional — None = the tool default |
displacements | Sequence[float] | optional — None = the tool default |
profiles | Sequence[str] | optional — None = the tool default |
section_types | Sequence[str] | optional — None = the tool default |
width | float | optional — None = the tool default |
height | float | optional — None = the tool default |
profile | str | optional — None = the tool default |
section_type | str | optional — None = the tool default |
thickness | float | optional — None = the tool default |
comfort | float | optional — None = the tool default |
start_cap_distance | float | optional — None = the tool default |
end_cap_distance | float | optional — None = the tool default |
rebuild_points | int | optional — None = the tool default |
orientation_ids | Sequence[IdLike] | optional — None = the tool default |
element | str | optional — None = the tool default |
ra.smart_profile.find()
ra.smart_profile.find(id: IdLike) -> SmartProfile
The handle for id, or None when the id does not belong to an object of this kind.
| Parameter | Type | |
|---|---|---|
id | IdLike | required |
ra.smart_profile.selected()
ra.smart_profile.selected() -> List[SmartProfile]
Smart profiles currently selected in the active doc.
Handles
Objects returned by the functions above. Assigning a settable property regenerates the object; the change is one undo step inside ra.transaction().
SmartProfile (handle)
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.
| Property | Type | Settable | |
|---|---|---|---|
curve_id | str | The document curve the profile follows. | |
end_cap_distance | float | yes | Dome height of the end cap (open curves), mm. |
layer_name | str | ||
mother_gem_id | str | ||
object_type | str | ||
position | Point3d | ||
rebuild_points | int | yes | 0 = profiles used as drawn; else rebuilt to this many points. |
section_count | int | ||
section_heights | List[float] | mm, same order | |
section_mirror_of | List[int] | -1 for a normal section, else the index of the section it mirrors | |
section_positions | List[float] | t of each section, sorted | |
section_profiles | List[str] | RING_PROFILE asset name of each section, same order | |
section_rotations | List[float] | degrees, same order | |
section_types | List[str] | COMFORT | SOLID | THICKNESS, same order | |
section_widths | List[float] | mm, same order | |
start_cap_distance | float | yes | Dome height of the start cap (open curves), mm. |
| Method | |
|---|---|
add_section(t: float, width=None, height=None, profile=None) | Adds a section at t (0..1, at least 0.002 from the others). |
delete() | |
mirror_section(index: int) | Adds a section that mirrors index across the curve (t = 1 - t, rotation negated) and follows it from then on. |
move(translation: VectorLike) | |
remove_section(index: int) | |
set_all_sections(width: float, height: float) | |
set_element(element: str) | Applies a saved SmartProfile element (ra.elements.list(“SmartProfile”)): its sections and settings replace the current ones; the curve and the orientation objects stay. |
set_height(height: float) | every section |
set_profile(profile: str) | every section: RING_PROFILE asset name or “id: |
set_section(index: int, width=None, height=None) | Mutations regenerate the profile in place (same Guid) and call LicenseGate.RequireValid() first. |
set_section_displacement(index: int, displacement: float) | sideways offset of the section, mm (literal: 0 = centered) |
set_section_position(index: int, t: float) | |
set_section_profile(index: int, profile: str) | RING_PROFILE asset name or “id: |
set_section_reversed(index: int, reversed: bool) | True = profile drawn reversed |
set_section_rotation(index: int, degrees: float) | |
set_section_type(index: int, section_type: str, thickness=None, comfort=None) | COMFORT | SOLID | THICKNESS; thickness/comfort mm, 0 keeps |
set_sections(sections_json: str) | 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). |
set_width(width: float) | every section |
Plus what every handle has: id, delete(), update(**kwargs), parameters(), equality and hashing by id, and raw (the underlying .NET object).