Python package
ra.weight
Metal weights: per layer, per selection, by area.
import rhinoartisan as ra
Wraps ArtisanPlugin.Scripting.WeightApi.
Functions
| Function | |
|---|---|
calculate() | Per-metal breakdown of the whole document, mirroring ArtisanWeight: volumes come from the “Metal 01/02/03” layers and are grouped by the document’s configured number of metals (1, 2 or 3). |
calculate_by_area() | Sheet-metal style estimate (the ArtisanWeightByArea tool): total surface AREA of the given objects x thickness = volume, cast in metal. |
calculate_for_objects() | Weight of an arbitrary set of objects if cast in metal (the ArtisanWeightBySelection idea, scriptable). |
calculate_for_selection() | Weight of the current viewport selection if cast in metal. |
calculate_selection_by_area() | By-area estimate of the current viewport selection. |
metals() | Valid names for the metal argument of the ForObjects/ForSelection variants (“GOLD_YELLOW_18”, “PLATINUM”, “SILVER”, …). |
ra.weight.calculate()
ra.weight.calculate() -> List[MetalWeightResult]
Per-metal breakdown of the whole document, mirroring ArtisanWeight: volumes come from the “Metal 01/02/03” layers and are grouped by the document’s configured number of metals (1, 2 or 3). Entries whose layer has no geometry report zero weights rather than being omitted.
ra.weight.calculate_by_area()
ra.weight.calculate_by_area(object_ids: Sequence[IdLike], thickness: float, metal=None) -> MetalWeightResult
Sheet-metal style estimate (the ArtisanWeightByArea tool): total surface AREA of the given objects x thickness = volume, cast in metal. Useful for shells and pieces modeled as open surfaces. metal empty/None = the document’s primary metal.
| Parameter | Type | |
|---|---|---|
object_ids | Sequence[IdLike] | required |
thickness | float | required |
metal | str | optional — None = the tool default |
ra.weight.calculate_for_objects()
ra.weight.calculate_for_objects(object_ids: Sequence[IdLike], metal: str) -> MetalWeightResult
Weight of an arbitrary set of objects if cast in metal (the ArtisanWeightBySelection idea, scriptable). Objects must be closed solids/meshes for their volume to count.
| Parameter | Type | |
|---|---|---|
object_ids | Sequence[IdLike] | required |
metal | str | required |
ra.weight.calculate_for_selection()
ra.weight.calculate_for_selection(metal: str) -> MetalWeightResult
Weight of the current viewport selection if cast in metal.
| Parameter | Type | |
|---|---|---|
metal | str | required |
ra.weight.calculate_selection_by_area()
ra.weight.calculate_selection_by_area(thickness: float, metal=None) -> MetalWeightResult
By-area estimate of the current viewport selection.
| Parameter | Type | |
|---|---|---|
thickness | float | required |
metal | str | optional — None = the tool default |
ra.weight.metals()
ra.weight.metals() -> List[str]
Valid names for the metal argument of the ForObjects/ForSelection variants (“GOLD_YELLOW_18”, “PLATINUM”, “SILVER”, …).