Thanks, I knew there was something somewhere - but it was six and a half years ago !
To prรฉcis a version of AdamB's [much cleverer] code:
The 'mat' must be a reference to a model.material [or nil]...
The 'context' must be either the model or a group or a definition [i.e. something that will have 'entities']
The transformation 'tr' must be a 'Geom::Transformation' - even it's 'blank', so the arguments are:
(material, model, Geom::Transformation.new()) (material, group, group.transformation) (material, instance.definition, instance.transformation)
The method returns the area of all faces within the context, included nested containers, and adjusts them to allow for any scaling of those containers...
To apply transformations of nested containers which themselves are within transformed containers etc, you need to iterate the method within itself, passing/reapplying transformations [similar to the earlier example 'sum_area' method] which I have botched in here... Note how its 'self.' assumes it's called as a method within a module.