Hey all,
I’ve put together the following short MaxScript to allow you to assign a random material ID to a selection in 3dsMax. I’ll update it into a full tool if I get enough comments asking for it.
Here’s how you use it
- Select an edit_poly object,
- Select the polygons you’d like to assign random IDs to,
- Copy this script into a maxscript file (MaxScript > New Script…),
- Hit Ctrl + E to run the script.
numberOfSubMaterials = 3 -- Set the number of sub-materials here!! originalSelection = polyop.getFaceSelection $ countOriginalSelection = originalSelection.count for i=1 to numberOfSubMaterials do ( antiArray = #{1..countOriginalSelection} for i=1 to antiArray.count do antiArray[i] = (random 0 1) >= 1 mergedArray = originalSelection * antiArray polyop.setFaceMatID $ mergedArray (random 1 numberOfSubMaterials) )
Also, here’s another that assigns a random material/materialID to a collection of objects.
undo on ( newMaterial = multiMaterial numsubs:32 for i = 1 to 32 do newMaterial[i].diffuse = random (color 0 0 0) (color 255 255 255) $.material = newMaterial for obj in $ do obj.material = newMaterial[random 1 32] )
By MikeZ March 12, 2011 - 10:23 am
Seems like a good idea for those cases where the MaterialByElement modifier would be overkill.
By nadjim May 14, 2011 - 2:16 pm
hi ,
thanks for the videos monday movie ,the are realy helpfull do you have a dvd with all of them or they are only available on line ,
i m new user of 3ds max and i have a project to realise and not too much monney to follow a course here in london , the best alternative for me is your video so this is the purpose of my questions , im willing to pay for it .
let me know
regards
nadjim zaidi
By Pete May 18, 2011 - 11:20 pm
I hope I don’t sound stupid but do I copy this script to notepad and give it a .ms extension and then put it in my max scripts folder?
I like the idea of this script and think it will be really helpful.
Thanks,
Pete
By Pete May 18, 2011 - 11:57 pm
I just figured it out! Sorry about that!
thanks again,
Pete
By Abdullah October 27, 2011 - 5:25 pm
Great help mate. I could not make it working for the different object collection. But it work like charm when it comes to elements
Thanks again.
By Husam May 26, 2012 - 5:58 pm
Awesome! This is exactly what I was looking for. Thank you so much Bluesummers! It’s much appreciated.