[Plugin] Volume Calculator v2.0 20111004
-
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.orgVersion:
2.0 20111004 New version with fast v8 calculation.Put into the Plugins folder and restart Sketchup, read and follow the instructions... -
Cheers TIG, will give it a run.....thanks a bunch!!
Andrew
-
After many years another stupid typo is fixed http://forums.sketchucation.com/viewtopic.php?p=14555#p14555
-
TIG
Question from someone who is not ruby literate. Why hasn't any one made a volume plugin using the new method, group.volume?
Thank you in advance
Ken
-
Because it's so easy!
I did think to make a new version of this tool that does just that... watch this space... -
Here's v2.0 that is much faster if you have v8 - however the selection must be 'manifold' - i.e. 'solid' in Entity Info... http://forums.sketchucation.com/viewtopic.php?p=14555#p14555
-
TIG
It appears not to give a volume of a component.
Thank you
Ken
-
That's probably because it's not manifold ?
Revert to the previous version if you want to approximate non solids and w-a-i-t...
VolumeCalculator1-8.rb -
TIG
No, what I found is the context menu will not give the volume of a component. However, when I activated the plugin menu, I get a volume with components.
Ken
-
I'll check it out...
-
I can find nothing wrong - do you have an example of a failure ?
-
TIG
Well than it most be my Sketchup set up. Here is how I was using the program.
I have a program that will add thickness to a face. I use it to make 1/4" steel plates out of faces. When I tried the program "volume", it would not give me the volume of any of the thicken faces. The thicken faces are made as components.
So I made one box, copied the box, made one box a group and the other a component. On the entry info menu, they both had the same indicated volume.
However, right clicking on the group would give me the correct volume, right clicking on the component the program wouldn't responded. I am trying to get rid of all the unnecessary programs that use the context menu. So I opened your program for editing, disabled the context menu and activated the plugin menu. And tried again, now I could get a volume on groups and components. Now, that I had have time to think about it, I guess it is the old gray out problem. I just didn't think it would be that sensitive, to notice the difference between a group and a component. There was nothing else in the file, just the two boxes.
So now, I have the context menu disable, the plugin is activated and I have added it to my working tool bar by making a icon and adding the tool bar code.
So right now, it is working great. I guess I was just surprised that the context menu was sensitive to the type of geometry clicked on.
Sorry to have you work on something that I should of realized was a problem with my set up.
A thank you is coming your way.
Thanks again for the program and the time to look at the problem.
Ken
Advertisement