Loop that select biggest Mesh and Nurbs object

I have a model in NURBS on layer1 and mesh version of the same thing on layer2 and I need to
select part as a nurbs and then the same part as mesh a then perform an specific action on each pair (NURBS+mesh).

My idea is to create a loop that will find two biggest - in terms of volume or area, geometries, then two second biggest and so on… till it ends with the smallest pair.

I have found some interesting scripts when it comes to selecting geometry by volume but I am getting an error

  • Message: ObjectsByType() got an unexpected keyword argument ‘state’

line 6, in SelSrfsByArea, “C:\Users\Dell\Downloads\SelSrfsByArea.py”
line 77, in , “C:\Users\Dell\Downloads\SelSrfsByArea.py”
"SelSrfsByArea.py (2.6 KB)

That’s actually my script… I am wondering if you have an old version of Rhino (Mac?) in which the state argument has not yet been implemented in ObjectsByType()…? There are some workarounds, but it’s better to update your Rhino…

That script will only work on surfaces/polysurfaces, there is another one for meshes… I don’t know where you found the original.

Thanks, I will try to reinstall/update.
I have found it here in some very old topic ;).
Anyway do you have any idea how to solve my problem? Maybe I could select these pair by finding objects with
the same postion of gumball.

Well, if you don’t know which goes with which, yes, you could try to select with a number of criteria to be reasonably sure. Fastest I guess will be to find which objects have the same bounding box size and location (within tolerance), then if a match is found, do further checking by area/volume (within tolerance) etc…

Of course, another way to always know what NURBS part goes with what mesh part is to create the mesh directly from the NURBS model in the script, then it’s trivial…

hmm… that not so trivial for me but I manged to come up with something.
I am giving names to NURBS from 1 to total amount and then changing layer to meshes and giving names from 101 to total amount of meshes. Then selecting NURBS - 1 and MESH - 101. It kind of works but sometimes it selects randomly for example 14 - nurbs and 154 - mesh. Pair300_cmd.py (9.9 KB)

Please post the script for selecting meshes by area. Thanks.


SelMeshesByArea.py (2.5 KB)

1 Like