Copyright 2006-2011 TIG (c)
Permission to use, copy, modify, and distribute this software for
any purpose and without fee is hereby granted, provided the above
copyright notice appear in all copies.
THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
Name: VolumeCalculator.rb
Description: A tool to calculate the volume of a selected Group/Instance
Context Menu: Volume...
Menu Item: See menu-section at end on how to include: Plugins -> Volume
Usage: First select a Group or Component that has faces that form a
volume, then use the right-click Context-Menu and choose 'Volume...'.
If there is the Plugins Menu Item 'Volume' you can also pick that.
(see the end menu section on how to activate that option...)
A dialog asks for the volume units and the accuracy required.
The units can be cu.m, cc, cu.yds, cu.ft, cu.ins, litres, cl, ml,
gallons(UK), gallons(USA), quarts(USA), pints(UK) and pints(USA).
Volumes are given to varying d.p's depending on the units chosen.
IF Sketchup is <v8 you get extra options...
The accuracy can be 0.5, 1, 2, 5 or 10% - the more accurate you
make it the longer it takes to process and the more complex the new
volume-group will become.Small simple forms will report accurately
even with the 10% sampling...
IF Sketchup is <v8 you get a group made with faces.
The text-tag is added just above the the apex of the selection's
bounding-box.
It shows the volume in the required units using the current
text/font settings.
A possible new layer can be used.It is
named VOLS-nnnnnnnn (where nnnnnnnn is based on the date/time).
Alternatively you can choose to use any existing layer OR make
your own 'on the fly'.
IF Sketchup is <v8 it then calculates a series of thin horizontal
slices through the selection's faces to use to calculate the volume
enclosed. If Sketchup >=v8 then this is skipped.
There are now also new Layer, Hide/Show-Edges and Colour Options
in v1.7, see below...***
IF Sketchup is <v8...
Before ending it checks if 'Xray Mode' was already switched 'on' at
the start and if so there is no action and it exits.Otherwise the
original selection is 'Hidden' so you can clearly see the volume-group.
You are then asked in a dialog if you want to leave it 'Hidden'.
If 'Yes' then it exits leaving it 'Hidden'.If 'No' the original
selection is 'Unhidden' and 'Xray Mode' is then switched 'on' so you
can see the volume-group inside of the original selection and a dialog
asks if you want to leave 'Xray Mode' switched 'on'. If you answer
'No' the normal view is restored and it exits. If you answer 'Yes'
it exits leaving 'Xray Mode' switched 'on'.
If you don't want the slice to be visible you can edit the
volume's group and either delete all of its geometry, leaving
the text-tag in place, or just select all geometry and hide it.
'Volume' can't be expected to be 100% foolproof !It treats an open
topped object as if it were filled with water, taking volumes from the
outer 'skin' inwards to work out which are the solid and which are the
hollow volumes.With a little ingenuity you will be able to contrive
a form with complex linked holes punched in, or a vertical array of
thin volumes spaced apart so as to miss the sampling slices - which
because it uses a series of horizontal slices, can produce unexpected
results. Keep volumes simple and build them up in bits for safety...
***New Options(>=v1.7) let you choose any layer OR make a new one,
hide/show volume's edges and give faces any standard colour -
pick popout' type first letter of colour to jump down list -
e.g. W for White takes you to Wheat...:
use up/down arrow keys to move through list...
or pick any model material listed...
If Sketchup >=v8 the text-tag is colored - so avoid colours matching
the background!
If a volume-group OR text-tag is selected then there's a
right-click context-menu item to export ALL volume data into a
CSV file...
Donations:
PayPal.com - info @ revitrev.org
Version:
2.0 20111004 New version with fast v8 calculation.Put into the Plugins folder and restart Sketchup, read and follow the instructions...