Hello everyone,
I want to ask you for help. I’m using a script from Miauu from the scriptspot forum. The script works great for my needs, but…
fn RS = -- random select one node all layer
(
if selection.count != 0 then
(
hide $
selObjsArr = selection as array
if selObjsArr.count != 0 then
(
layersArr = #()
for o in selObjsArr do
(
selObjLayer = o.layer
appendIfUnique layersArr selObjLayer
)
objToSelArr = #()
for layer in layersArr do
(
layer.nodes &theNodes
append objToSelArr (theNodes[random 1 theNodes.count])
)
select objToSelArr
)
else
messagebox "Select at least one object" title:"Empty Selection"n
local hiddenObjs = for obj in objects where obj.isNodeHidden collect obj
unhide selection hiddenObjs ;
)
)
My scene: Layer1:
group name “a” (box01, box02, box03)
group name “b” (sphere01, sphere02, …)
group name “c” (…)
…
group name “r” (box91, box92, box93…)
the script was run 59 times and these are the results
a, f, h, o, r, r, b, j, r, m, a, a, r, r, r, h, h, h, m, j, r, i, h, r, r, h, r, r, h, m, r, h, p, h, h, h, r, r, r, a, r, r, n, h, r, r, a, r, r ,r, l, k, h, e, r, m, r, h, r,
“a” = 5x
“b” = 1x
“c” = 0
“d” = 0
…
“h” = 14x
…
“r” = 25x
The main problem is that some objects were not marked at all and “h” “r” were marked many times.
I would need a random selection but with some regularity so that some objects = 0x and other objects = 100x do not happen.
Thanks for your time.