.NET API
WeightApi
Headless metal-weight facade for scripts and Flow Studio. Wraps the SAME WeightTools math the ArtisanWeight command uses (volume from the closed geometry on the “Metal 01/02/03” layers x metal density), so the grams a script reports always match the command’s dialog. Everything here is read-only: no license gate, no Transaction needed.
from ArtisanPlugin.Scripting import WeightApi
See also the guide, Analysis › Weight by area, and the Python package, ra.weight.
Methods
| Method | |
|---|---|
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). |
CalculateByArea | Sheet-metal style estimate (the ArtisanWeightByArea tool): total surface AREA of the given objects x thickness = volume, cast in metal. |
CalculateForObjects | Weight of an arbitrary set of objects if cast in metal (the ArtisanWeightBySelection idea, scriptable). |
CalculateForSelection | Weight of the current viewport selection if cast in metal. |
CalculateSelectionByArea | 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”, …). |
Calculate
IReadOnlyList<MetalWeightResult> WeightApi.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). Entries whose layer has no geometry report zero weights rather than being omitted.
Returns IReadOnlyList<MetalWeightResult>.
CalculateByArea
MetalWeightResult WeightApi.CalculateByArea(
IEnumerable<Guid> objectIds,
double thickness,
string metal = null)
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/null = the document’s primary metal.
| Parameter | Type | Default |
|---|---|---|
objectIds | IEnumerable<Guid> | required |
thickness | double | required |
metal | string | null |
Returns MetalWeightResult.
CalculateForObjects
MetalWeightResult WeightApi.CalculateForObjects(IEnumerable<Guid> objectIds, string metal)
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 | Default |
|---|---|---|
objectIds | IEnumerable<Guid> | required |
metal | string | required |
Returns MetalWeightResult.
CalculateForSelection
MetalWeightResult WeightApi.CalculateForSelection(string metal)
Weight of the current viewport selection if cast in metal.
| Parameter | Type | Default |
|---|---|---|
metal | string | required |
Returns MetalWeightResult.
CalculateSelectionByArea
MetalWeightResult WeightApi.CalculateSelectionByArea(double thickness, string metal = null)
By-area estimate of the current viewport selection.
| Parameter | Type | Default |
|---|---|---|
thickness | double | required |
metal | string | null |
Returns MetalWeightResult.
Metals
IReadOnlyList<string> WeightApi.Metals()
Valid names for the metal argument of the ForObjects/ForSelection variants (“GOLD_YELLOW_18”, “PLATINUM”, “SILVER”, …).
Returns IReadOnlyList<string>.