Nice all this but, i am new in ruby, how can i retrieve the size of all component... including sub-component?

` mod = Sketchup.active_model # Open model
ent = mod.active_entities # All entities in model

message = ""
ent.each { |e|
n = e.name
scale_x = ((Geom::Vector3d.new 1,0,0).transform! e.transformation).length
scale_y = ((Geom::Vector3d.new 0,1,0).transform! e.transformation).length
scale_z = ((Geom::Vector3d.new 0,0,1).transform! e.transformation).length
bb = nil
if e.is_a? Sketchup::Group
bb = Geom::BoundingBox.new
e.entities.each {|en| bb.add(en.bounds) }
elsif e.is_a? Sketchup::ComponentInstance
bb = e.definition.bounds
end

if bb
dims = [ width = bb.depth * scale_x, height = bb.width * scale_y, depth = bb.height * scale_z ]
message = message + "Cabinet: " + n + "\nHeight: #{dims[0].to_l}\tWidth: #{dims[1].to_l}\tDepth: #{dims[2].to_l}"
end
}
UI.messagebox(message, MB_MULTILINE)`

I would like to have dimensions of all pieces of the cabinet.
I know Cutlist. But i only need name of piece and dimensions.
And Cutlist script is to complicated for me.
Someone can help me with this? PLZ