Created
June 11, 2014 16:14
-
-
Save alexschreyer/4bc33e176bcedc744523 to your computer and use it in GitHub Desktop.
A snippet that sums up volumes of groups in SketchUp. It also adds face areas.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mod = Sketchup.active_model # Open model | |
ent = mod.entities # All entities in model | |
sel = mod.selection # Current selection | |
# Zero all totals | |
t_volume = 0.0 | |
t_faces = 0.0 | |
# Calculate the conversion factors | |
cu_yd = 12**3 * 27 | |
sq_ft = 12**2 | |
# Iterate over the selection | |
sel.each { |item| | |
# First check that selected item is a group | |
if (item.typename == "Group") | |
# Now make sure it has a volume (i.e. is a manifold/solid) | |
if (item.volume != -1) | |
# Add item's volume to totals | |
t_volume = t_volume + item.volume | |
# Find faces and sum up areas | |
item.entities.each { |e| | |
if (e.typename == "Face") | |
t_faces = t_faces + e.area | |
end | |
} | |
end | |
end | |
} | |
# Finally spit out the converted results | |
t_volume = (t_volume/cu_yd).round(4) | |
t_faces = (t_faces/sq_ft).round(4) | |
UI.messagebox "TOTALS:\n\rVolume: #{t_volume} yd^3\n\rFace Area: #{t_faces} ft^2" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello Alexschreyer
But the overlap volume will not be deducted
Is there another way you can deduct overlapping volume?