ScriptSpot is a diverse online community of artists and developers who come together to find and share scripts that empower their creativity with 3ds Max. Our users come from all parts of the world and work in everything from visual effects to gaming, architecture, students or hobbyists.
I need a piece of code that would execute random object selection among all objects belonging to a particular layer. And it's supposed to be one object. Also I need a snippet for children selection.
That's fabulous! Thank you very much, miauu!
Would be even geater if you wrote how to do the following:
1) Say, I have 5 layers each containing different objects.
2) I've selected all or a bunch of objects from each layer.
3) I want to select 5 random objects out of the current selection (one random object per each layer)
The code below works with objects. How to use it:
1- select one object that belongs to the desired layer
2- run the script - random object from that layer will be selected.
You can run the script as many times as you want and it will select random object from the same layer
If you don't know which object to which layer belong, then in layer manager select all objects from the desired layer.
1- select several(or all) objects from desired layer
2- run the script - random objects from the selected will be selected
This works with objects that belongs to different layers, so you can select onbjects from different layers and the script will wors only with the selected objects.
(ifselection.count != 0 then
(ifselection.count == 1 then
(-- "select all objects from the layer to which the selected object belong"
selObjLayer = (selection[1]).layer
selObjLayer.nodes &theNodes
select theNodes[random 1 theNodes.count])else(
selObjsArr = selection as array
select selObjsArr[random 1 selObjsArr.count]))else
messagebox "Select at least one object" title:"Empty Selection")
Comments
miauu, you've made my day!
miauu, you've made my day!
I really appreciate your effort.
Thank you very much, miauu!
That's fabulous! Thank you very much, miauu!
Would be even geater if you wrote how to do the following:
1) Say, I have 5 layers each containing different objects.
2) I've selected all or a bunch of objects from each layer.
3) I want to select 5 random objects out of the current selection (one random object per each layer)
Thanks again!
.
Tools and Scripts for Autodesk 3dsMax
.
The code below works with objects. How to use it:
1- select one object that belongs to the desired layer
2- run the script - random object from that layer will be selected.
You can run the script as many times as you want and it will select random object from the same layer
If you don't know which object to which layer belong, then in layer manager select all objects from the desired layer.
1- select several(or all) objects from desired layer
2- run the script - random objects from the selected will be selected
This works with objects that belongs to different layers, so you can select onbjects from different layers and the script will wors only with the selected objects.
Tools and Scripts for Autodesk 3dsMax