Calculating Summed-up Volumes with Ruby
June 11, 2014 in Tutorials
I received an email a few days ago by someone who needed to calculate volumes and face areas in SketchUp for the purpose of estimating. I suggested doing this in a few lines with Ruby and as it turns out, it is pretty easy as long as the objects that need to be summed up are “solid” groups in SketchUp. I thought the solution could be useful for others, too, so here it is:
Just paste the code below into the Ruby Code Editor in SketchUp. Then select the groups that you would like to sum up and press the Run button. With this version, you will get the sum of the volumes as well as the areas of the perimeter surfaces (e.g. for estimating formwork). You can use this piece of code and customize it to your liking. For example, you could export the data separately for each object to a text file (or to a multiline messagebox) for use in Excel afterwards. You might also want to use different units. For tips on how to do this in Ruby, check out chapter six in my book.