This is something that I have been struggling with for quite a while. I’ve seen a few posts that relate to this problem but nothing that I’ve found to be conclusive, complete or clear to implement.
Problem: The SketchUp API doesn’t seem to have a reliable method to get the volume of a group/component Instance when it is contained within another group/component instance and transformations are involved. ‘[someGroupOrComponentInstance].volume’ doesn’t reliably give the correct value if transformations have been applied to a group/component Instance or any of its container(s).
I’ve tried all sorts of things, like combining all the transformations, and read may posts here and elsewhere. One way or another nothing seems to be reliable, at least the way I’ve interpreted it, either giving wrong values or crashing Sketchup.
Does anyone have and would like to share code that will do the equivalent of [someGroupOrComponentInstance].volume but works on any group or component instance no matter what group/component container(s) it is nested within or what transformations have been applied to them?
Vol = reliableVolume([someGroupOrComponentInstance])
This isn’t my day job, I’m just a humble hobbyist, so apologies if the answer is obvious. Perhaps there is no easy solution and, if so, that is worth knowing too so I can get on with the rest of my life!