Skip to content

.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
CalculatePer-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).
CalculateByAreaSheet-metal style estimate (the ArtisanWeightByArea tool): total surface AREA of the given objects x thickness = volume, cast in metal.
CalculateForObjectsWeight of an arbitrary set of objects if cast in metal (the ArtisanWeightBySelection idea, scriptable).
CalculateForSelectionWeight of the current viewport selection if cast in metal.
CalculateSelectionByAreaBy-area estimate of the current viewport selection.
MetalsValid 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.

ParameterTypeDefault
objectIdsIEnumerable<Guid>required
thicknessdoublerequired
metalstringnull

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.

ParameterTypeDefault
objectIdsIEnumerable<Guid>required
metalstringrequired

Returns MetalWeightResult.

CalculateForSelection

MetalWeightResult WeightApi.CalculateForSelection(string metal)

Weight of the current viewport selection if cast in metal.

ParameterTypeDefault
metalstringrequired

Returns MetalWeightResult.

CalculateSelectionByArea

MetalWeightResult WeightApi.CalculateSelectionByArea(double thickness, string metal = null)

By-area estimate of the current viewport selection.

ParameterTypeDefault
thicknessdoublerequired
metalstringnull

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>.