Terri Brown Posted December 4, 2017 Share Posted December 4, 2017 Hi guys, I've got a Railclone system set up and I want to control objects placed on the spline by mat ids. Simple enough to do in RC itself, but the manual randomisation of the spline itself is what's getting to me. I have a complex spline with many many segments so it's taking time. Surely there must be a script out there to randomly assign mat ids to the segments of a spline. I looked on ScriptSpot but no luck. Downloaded spline-toolbox_v1.1 to just select random segments, but alas it works not. I have RandomMatIds for POLYs but Splines...nudda. Any suggestions? Or am I missing a button somewhere within max itself that does that? 13 years of using max and I don't know if there's that functionality. Thanks guys Link to comment Share on other sites More sharing options...
Nicolai Bongard Posted December 4, 2017 Share Posted December 4, 2017 Ive not tried this, but a suggestion might be to select all the verteces, split them, then apply a material modifier to randomize by element as you would an editable poly, the add an edit spline modifer on top and weld all the verteces again? Link to comment Share on other sites More sharing options...
Simon Moir Posted December 4, 2017 Share Posted December 4, 2017 (edited) I think splines are tricky in Maxscript... You could use this script (edit: different to the one you tried, works for me in 2016) to randomly select segments and then assign IDs manually. Can you not do it in Railclone with the Random Node? Edited December 4, 2017 by sjmoir Link to comment Share on other sites More sharing options...
jackbird Posted December 4, 2017 Share Posted December 4, 2017 This will randomize the material IDs on whatever shapes you currently have selected. Change the number in the first line of the script to set the number of material IDs. This will work only on Editable Spline objects (not Lines or any other shapes). highestMatID = 3 --change to set nmumber of random Material IDs to use myShapes = for obj in selection where classof obj == SplineShape collect obj for sh in myShapes do ( for sp in 1 to (numsplines sh) do ( for sg in 1 to (numsegments sh sp) do ( setMaterialID sh sp sg (random 1 highestMatID) )--end segment )--end spline )--end shape Link to comment Share on other sites More sharing options...
Terri Brown Posted December 5, 2017 Author Share Posted December 5, 2017 Thanks so much guys. I will definitely give that script a go Jon. Thanks too Simon (I downloaded the script), but I think Jon's script will be far more automatic. Link to comment Share on other sites More sharing options...
Simon Moir Posted December 6, 2017 Share Posted December 6, 2017 Works great... Thanks Jon. Link to comment Share on other sites More sharing options...
Hernan Rodenstein Posted November 20, 2018 Share Posted November 20, 2018 I know this is an old post but this can help others from now on: Here's a great free 3dsMax script tool to randomize the material IDs in the selected splines. Randomize Spline Material IDs - by SplineDynamics.com Link to comment Share on other sites More sharing options...
Terri Brown Posted February 18, 2019 Author Share Posted February 18, 2019 Stumbled apon this again after a year...script works a charm - thanks Hernan! Link to comment Share on other sites More sharing options...
Hernan Rodenstein Posted February 19, 2019 Share Posted February 19, 2019 We have launched a new 3dsMax plugin that is a great complement for all RailClone users. SubSpline is an Advanced Subobject Selector & Material IDs Editor for spline shapes. Website: http://www.splinedynamics.com/subspline/ Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now