Is there a way to select a bunch of things and randomly delete a percentage of them? I have some ground cover, but I have way too many instances of the plants, so I want to randomly delete, let's say 20% of them.
Announcement
Collapse
No announcement yet.
Random delete
Collapse
X
-
Random delete
Bobby Parker
www.bobby-parker.com
e-mail: info@bobby-parker.com
phone: 2188206812
My current hardware setup:- Ryzen 9 5900x CPU
- 128gb Vengeance RGB Pro RAM
- NVIDIA GeForce RTX 4090
- Windows 11 Pro
Tags: None
-
Bobby Parker
www.bobby-parker.com
e-mail: info@bobby-parker.com
phone: 2188206812
My current hardware setup:- Ryzen 9 5900x CPU
- 128gb Vengeance RGB Pro RAM
- NVIDIA GeForce RTX 4090
- Windows 11 Pro
-
I wrote this to make random groups or percentages:
Code:macroScript select_percent_001 category:"JOC Tools" ( rollout SelectPercent "Select percentage of objects v0.01" ( Group "Select by percent" ( Spinner ThePercentage "Percent to select:" type:#float range:[0.0,100.0,45.0] Button DoSelect "Select Percentage" align:#right width:200 ) Group "Split into groups" ( Spinner GroupNum "How many groups?" type:#integer range:[1,5000,5] Button MakeGroups "Make Groups" align:#right width:200 ) On DoSelect pressed do ( theSel = selection as array theArray = #() theCount = (theSel.count/(100.0/ThePercentage.value)) as integer for i = 1 to theCount do ( RandomPick = (random 1 theSel.count) append theArray theSel[RandomPick] deleteItem theSel RandomPick ) select theArray ) On MakeGroups pressed do ( theSel = selection as array GroupCount = (theSel.count/GroupNum.value) as integer print ("Making " + groupCount as string + " groups") for g = 1 to GroupNum.value do ( TempArray = #() for C = 1 to GroupCount do ( RandomPick = (random 1 theSel.count) append TempArray theSel[RandomPick] deleteItem theSel RandomPick ) selectionsets[("RandomGroup" + g as string)] = TempArray ) ) ) CreateDialog selectPercent width:300 )
Comment
-
Thanks, I'll try it.Bobby Parker
www.bobby-parker.com
e-mail: info@bobby-parker.com
phone: 2188206812
My current hardware setup:- Ryzen 9 5900x CPU
- 128gb Vengeance RGB Pro RAM
- NVIDIA GeForce RTX 4090
- Windows 11 Pro
Comment
-
There is also a random selection tool in the Soulburn script pack. It works off weight, exact number or percentage.
http://www.neilblevins.com/cg_tools/...urnscripts.htm
Comment
-
worked perfectly, thanks.
Originally posted by joconnell View PostI wrote this to make random groups or percentages:
Code:macroScript select_percent_001 category:"JOC Tools" ( rollout SelectPercent "Select percentage of objects v0.01" ( Group "Select by percent" ( Spinner ThePercentage "Percent to select:" type:#float range:[0.0,100.0,45.0] Button DoSelect "Select Percentage" align:#right width:200 ) Group "Split into groups" ( Spinner GroupNum "How many groups?" type:#integer range:[1,5000,5] Button MakeGroups "Make Groups" align:#right width:200 ) On DoSelect pressed do ( theSel = selection as array theArray = #() theCount = (theSel.count/(100.0/ThePercentage.value)) as integer for i = 1 to theCount do ( RandomPick = (random 1 theSel.count) append theArray theSel[RandomPick] deleteItem theSel RandomPick ) select theArray ) On MakeGroups pressed do ( theSel = selection as array GroupCount = (theSel.count/GroupNum.value) as integer print ("Making " + groupCount as string + " groups") for g = 1 to GroupNum.value do ( TempArray = #() for C = 1 to GroupCount do ( RandomPick = (random 1 theSel.count) append TempArray theSel[RandomPick] deleteItem theSel RandomPick ) selectionsets[("RandomGroup" + g as string)] = TempArray ) ) ) CreateDialog selectPercent width:300 )
Bobby Parker
www.bobby-parker.com
e-mail: info@bobby-parker.com
phone: 2188206812
My current hardware setup:- Ryzen 9 5900x CPU
- 128gb Vengeance RGB Pro RAM
- NVIDIA GeForce RTX 4090
- Windows 11 Pro
Comment
Comment