Hmmm, I guess a script could start by locating stones of equal volume - that should be straightforward enough, but then refining the search, if the stones can be any which way, is a bit more of a head scratcher - it might be able to measure edges or something… not sure.
OK, here is a Python script to try… Right now limited to closed volumes: meshes or surfaces/polysurfaces. After a reference object is selected, it checks in order:
Mesh or BRep object
Number of edges
Total length of edges
Number of faces
Number of vertices
If an object does not match one of the criteria, it is excluded. The matching objects are selected at the end. The status bar shows the progress.
For a lot of objects, this can be somewhat time consuming and will vary with the different depths of checking before objects are included or excluded. I tried with 10,000 simple boxes with slightly varying volume, the time varied from about 30 seconds when only a couple of them met the volume criteria, to about 75 seconds when almost all of them did. With the same number of boxes, but half had one split edge (which will trigger a “not the same object”, despite the virtually identical criteria) it took about 60 sec.
All this stuff can be adjusted perhaps and the script could be extended to open objects etc at some point. I’ll throw it up here for testing. In your file it took about 20 seconds to find “identical” stones to a selected reference stone, usually about 7 others found besides the original.
Let me know how it works,
Edit: fixed one bug that could cause the status bar meter to stay on if no objects were found, and a couple of other cleanups.
Of course, this is no guarantee against “false positives”. In the file attached you can see how easy it still is to fool the script, the two objects are obviously not identical, but they have the same volume, area, number of edges and total edge length. They even have the same minimal bounding box.
One workaround would be to get the individual polysurface faces or edges and check for identicality - however, this can be very time consuming if they have a lot of faces, as you would have to check each face against each other - even if the object has only 10 faces, that’s about 50 checks per object.
Looking for similar objects within a group or similar groups of objects…? Right now the script checks all the “normal” (visible and unlocked) objects in the document like most of the other Rhino selection commands. I suppose it could be restricted to a group of user selected objects…
To check for similar groups of objects, it’s more complicated - there needs to be another level that first checks for same sized groups and then compares all the elements in each group… Somewhat long and complicated.
So, responding to my own post, attached is another version which has one further check - if it finds polysurface volume, area, edge numbers and lengths to be identical, it collects the distance from all the edge curve start points to the object centroid, puts them in an sorted list and compares that list to the same list from the reference object. This eliminates another class of false positives as per my previous file - although there still could be some. The time penalty for this additional check is low to moderate, as it’s mostly math operations… The more edges there are in the object, the worse it will get - but only if there are a lot of almost identical objects that have the same volume, surface area, and number/length of edges.
Weird, it doesn’t error out here, and the last line in your error report seems to indicate that it’s failing trying to import rhinoscriptsyntax or something… Do your other python scripts run OK? Are you running this from an alias, toolbar or from the script editor?
OK, sounds like you have a version conflict. Rhino installs its own IronPython, you don’t need to install another one in order for it to work. I guess I would first completely uninstall the python you installed yourself, then try running the script in Rhino again.