Python package
ra.gem_size
Stones by millimetre size instead of carats.
import rhinoartisan as ra
Wraps ArtisanPlugin.Scripting.GemSizeApi.
Functions
| Function | |
|---|---|
create() | Creates a gem from its dimensions in mm and adds it to the active document, returning the same Gem handle ra.gems.create returns. |
same_size() | The actual ArtisanGemBySize command: given some reference gems, finds every gem in the document with the same width (SizeX, 0.001 mm tolerance) — e.g. |
ra.gem_size.create()
ra.gem_size.create(shape: str, material: str, size_x: float, size_y=None, size_z=None, plane=None) -> Gem
Creates a gem from its dimensions in mm and adds it to the active document, returning the same Gem handle ra.gems.create returns. shape / material accept the GemApi vocabularies (ra.gems.shapes() / ra.gems.materials()). sizeX is the width (diameter for ROUND); sizeY (length) and sizeZ (depth) 0 = the shape’s standard proportions. plane is where the gem sits (default: world XY at the origin); the carat weight is derived from the mesh volume.
| Parameter | Type | |
|---|---|---|
shape | str | required |
material | str | required |
size_x | float | required |
size_y | float | optional — None = the tool default |
size_z | float | optional — None = the tool default |
plane | Optional[PlaneLike] | optional — None = the tool default |
ra.gem_size.same_size()
ra.gem_size.same_size(gem_ids=None) -> List[str]
The actual ArtisanGemBySize command: given some reference gems, finds every gem in the document with the same width (SizeX, 0.001 mm tolerance) — e.g. “all the 1.5 mm stones”. gem_ids empty/None uses the selected gems. Read-only, no license: returns the matching ids (reference gems included); pair with select_objects / ra.gems.find.
| Parameter | Type | |
|---|---|---|
gem_ids | Sequence[IdLike] | optional — None = the tool default |
Handles
Objects returned by the functions above. Assigning a settable property regenerates the object; the change is one undo step inside ra.transaction().
Gem (handle)
Public scripting view of a gem placed in the current RhinoDoc. This is intentionally narrow — it does NOT expose the underlying ShapesKernel GemObject. The LLM-generated Python scripts (and any third party) can only do what this surface allows, and every mutation passes through LicenseGate.
| Property | Type | Settable | |
|---|---|---|---|
carat_weight | float | yes | |
layer_name | str | ||
material | str | yes | compound name, e.g. “Diamond” |
plane | Plane | yes | the gem’s full placement plane (origin + orientation) |
position | Point3d | origin of the gem’s plane | |
shape | str | ”ROUND”, “PRINCESS”, “MARQUISE”, … | |
size_x | float | mm | |
size_y | float | mm | |
size_z | float | mm |
| Method | |
|---|---|
copy(translation=None) -> Gem | duplicate displaced by translation, returns the new gem |
delete() | |
flip() | turn the gem upside down (180° around its own X axis) |
move(translation: VectorLike) | |
rotate(degrees: float) | spin around the gem’s own Z axis (positive = counter-clockwise) |
scale(factor: float) | uniform scale of the current size (factor > 0) |
select(on: bool) | Selection state in the viewport. |
set_size(size_x: float, size_y: float, size_z: float) | resize to explicit mm dimensions |
Plus what every handle has: id, delete(), update(**kwargs), parameters(), equality and hashing by id, and raw (the underlying .NET object).