Script no longer working.....?

Mitch (Helvetosaur) wrote a script for me years ago and it’s never failed me until today. I keep getting the error shown below in the attached jpg file. Not sure if something with Rhino file format has changed or it’s something I did. Older files seem to work just fine but the one I’m trying to use the script on now doesn’t. The script finds all like pieces with in the file.FindSimilarVolumesPlus.py (4.6 KB)
I have attached both the file (R7 format) and the script.Emory-RRR-Interior-current-10-8-21-4TH-Revision-Interior–use-for-numbers-no-granite.3dm (8.9 MB)
Error-message

Brian

Hi,

This should fix it! It seems to run fine now. Objects for which no volume can be computed are now simply skipped.

FindSimilarVolumesPlus.py (4.7 KB)

I’ve run a couple of tests in your file.

@Helvetosaur the bug was caused by Rhino.Geometry.VolumeMassProperties.Compute(obj) on line 81, which for some corrupt objects seems to return None.

Hi Brian,

The script is actually still good, but I have located the culprit… It is a single closed polysurface for which the volume cannot be calculated (you can see something has happened to it by the curves on the side).
If you replace this with a new and improved one (or indeed delete it remorselessly), the script then works fine.

John.

OK, thanks for looking at it, I’ll fix that. :smiley:

I’ve already fixed it.

Dang Ya’ll are quick and good…I was just jumping back on the call out the same piece you already found above.

Brian

1 Like

It would be nice if it just highlighted the object without a volume…?

BTW Mitch I think you again for a great script.

Brian

Yep, thanks! For my own records, when I fix stuff, I also routinely add a comment in the header with the date that it was revised and the reason. Cheers.

i.e. you would like the script to report if it finds any bad objects? I’m not particularly fond of highlighting something that failed - you might think it is one of the matches - but it could be possible for example to create a bad object layer transfer the object to that, or perhaps a color change…

That would be sweet…Just some way to know it wasn’t being counted.