solid.Shape.volume
solid.Shape: V = volume (S)
solid.Shape: V = volume (S, 'RelTol', TOL)
The volume of a shape in cubic millimetres.
The volume is computed from the exact surfaces, not from facets, by an
integration that aims at a relative error of TOL on every face,
1e-9 unless 'RelTol' sets it. TOL must be positive and
no larger than 1e-3. The empty shape has volume zero.
Multiplied by a density it gives the mass of a part. Most shapes take
milliseconds. The spline surfaces of a shape made by
solid.surface take seconds, and there a 'RelTol' of 1e-6
is about three times faster, at an error of up to about 1e-7 on spline
faces. TOL is a target, not a guarantee: on the hardest faces the
integration may stop short of it.
## The mass in grams of a steel block with a bore, steel weighing
## 7.85e-3 grams per cubic millimetre
S = subtract (solid.box (80, 40, 12), ...
translate (solid.cylinder (4, 12), [20, 20, 0]));
mass = volume (S) * 7.85e-3
⇒ mass = 296.70
|
See also: solid.Shape.area, solid.Shape.centroid
Source Code: solid.Shape