I used to have a tool for randomly deselecting things. Since last using it, I’ve upgraded computers and operating systems, so I no longer have it installed… but I found this in my rhino scripts backups folder that I made for storing scripts I collect. I have no clue how to install a .dll script? ANy clues on how this works or if I even found the right thing? Thx. Also, any more modern script to randomly deselect (by percentage) would be welcome. RandomDeselect.zip
Hi Heath,
you can try below python script, it requires preselection.
UnselectRandom.py (710 Bytes)
c.
@clement
how does rs.UnselectObjects know which ones were chosen to deselect?
where is the list coming from?
random.sample?
random.sample(sequence, x)
yes, it returns a list of length x containing unique elements chosen from the sequence. Handy to generate
lottery numbers too eg. try this if you ever play “Lotto” in germany:
import random
L = random.sample(range(1,49), 7)
print "Lotto-Zahlen:",L[0:-1], "Zusatz-Zahl:",L[-1]
c.
Thanks… I’ve never used a python script in rhino. Forgive the dumb question: how does one load that script into rhino? Thanks!
Hi Heath,
there are various ways, easy is to save the script somewhere and put this in a button:
! _-RunPythonScript "C:\YourFolderPath\UnselectRandom.py"
You need to change the path above of course.
Somehow, i prefer to put all my scripts in a folder so migration and editing is easy. This folder location i´ve defined in the python editor under Tools > Options > Files tab. (use _EditPythonScript
to open this editor). If a folder has been defined this way, a script can be run from a button without defining a folder eg:
! _-RunPythonScript "UnselectRandom.py"
You can put a script directly into a button too. But i would not recommend it.
c.
Works perfectly! Thank you so much Clement.