When running the “Select by object name” command, a pop-up window appears where the user is allowed to pick the object name(s) that he or she would like to select eventually. When the user pre-selects one or more objects and run the “Select by object name” command, once again Rhino will bring the same window. This is good and useful, because it lets you add more objects to the current selection.
It would be even better to have an alternative command which allows to directly select all the objects of the same name in the scene when at least one *named object is already selected. Lets say the user selects objects named “RH-1-NO” and “RH-1-YES”. Pressing the “Select by object name” icon with the LMB will bring the classic selection window. However, pressing the same icon with the RMB could run “Select by same object name” command to select the remaining objects that share the same name as the pre-selected ones. This is especially helpful in scenes with hundreds or thousands of named objects where the user would spend way too much time in browsing across the long list inside the regular selection window to find out the desired object names.
P.S.: *If the selected object has no name, then the “Select by same object name” command could select all unnamed objects in the scene.
If you want it to select objects without a name as well as with if both are included in initial selection, just add a True argument to the last line - i.e. SelSameName(True). Otherwise unnamed objects included in the initial selection with some named objects will be ignored.
I just found that I already have one script (not sure who of this forum made it) called “Select unnamed”. Using the “SelSameName.py” script only for selecting named objects (ignoring the unnamed ones) makes sense. I applied it to the RMB of the “Select by object name” button and named it “Select objects with same name”.
P.S.: I can’t believe that Rhino does not have a native option to quickly select objects with same name or unnamed objects. The only way to do so in the default program is to evoke the “Select by object name” window, which, as I mentioned in my OP, could become very long and difficult to work with. Your script solves that. Thanks!
But right before that quote in your post I wrote the following:
“I can’t believe that Rhino does not have a native option to quickly select objects with same name or unnamed objects.”
Also, since Rhino is an engineering program primarily targeted for free-form product design and structural design (including boats, jeverly, architecture, furniture, vehicles, toys, electronics devices etc), it’s a strange decision to not provide a basic weight measurement tool, despite being on the market for decades. Weight reduction is a crucial part of both the product and structural design. That shortcoming was somehow fixed by someone who wrote the SolidWeight.rvb script for Rhino 5, though. It also works in Rhino 6, but is limited to just one selected object. There is also a “Real materials” script, which also works with both Rhino 5 and 6. However, it requires a separate program such as Apache OpenOffice to be able to see the combined weight of the selected objects in Rhino (Apache OpenOffice: Edit > Paste, then Data > Subtotals > Weight).
That being said, there is a certain effort to be made (in my case anyway) to get over initial “hump” before it finally clicks and makes sense. But when it does, oh, boy, it unlocks a whole new dimension of tools you can create to customize your workflow in Rhino and do stuff you would never tackle “manually”.
Also, being capable of doing it and actually enjoying doing it are two different things. Some people are just not coding-oriented, so while it’s probably not impossible for them to learn/do, it’s just not a fun thing for them. OTOH, I was convinced that that was my case before I got over that famous hump, but now I do actually like doing it. It’s an intellectual challenge and it’s fun when you actually can design a tool and develop it to your satisfaction.
If it has to be quick, you can make an alias or button for the _-SelName "" macro.
The same goes for selecting all objects of a given name and bypassing the cumbersome pop-up window.
(I understand that this doesn’t solve the “same name as preselected object” question, but that’s what scripts are for).
@Rhino_Bulgaria, I recently decided to challenge myself and see if I can create airplane fuselage without having any prior-knowledge, other than creating ship hulls.
How are cars any different? Gimme a challenge.
A single car body panel or headlight back panel is more complex to design with NURBS than the entire airplane fuselage. One of the reasons why I like that kind of work is because it’s a good challenge for me.