BrianKitts Posted May 8, 2008 Share Posted May 8, 2008 could anyone help me in making a simple script that would rename all the objects in the scene based on the material that is applied to that object? I'm testing a new workflow from Archicad11 into 3dsmax, such that you export from Archicad11 as a 3ds file seperating all objects by their assigned material. Then after import into max I am using the ml_plugins material replacer to update the newly imported model using the material library from the previous version of the model. It's great works well and is quick for updating the model, while keeping all your previously applied materials. The only thing that I don't like is that all the objects in the scene have bogus names based on the archicad export. I know there will be no duplicate names if I reassign all of the geometry named by its associated material assigned in max, so I'm trying to find a way to do it, with my zero maxscript skills. any help would be greatly appreciated. Till then.... looks like i'll be reading through maxscripting lessons! thanks- bk Link to comment Share on other sites More sharing options...
mattclinch Posted May 8, 2008 Share Posted May 8, 2008 The 'Renamer' script that is bundled in the BlurScripts has the ability to rename or add prefixes to objects that are the same material as the active MatEditor slot. http://www.neilblevins.com/blurscripts/blurscripts.htm Link to comment Share on other sites More sharing options...
Dave Buchhofer Posted May 8, 2008 Share Posted May 8, 2008 quickie.. may be errors rendering atm so can't test yet, heheh. shouldn't be much more than doing this.. sel = selection as array for obj in sel do ( if (obj.material != undefined) then obj.name = obj.material.name ) Link to comment Share on other sites More sharing options...
BrianKitts Posted May 8, 2008 Author Share Posted May 8, 2008 (edited) perfect! thanks a mil. you know the funny thing is I know enough C++ and Director Lingo for scripting that just reading your code I knew exactly how you were doing it, I just really need to start learning the syntax for maxscript so I can start making my own tools. So I made a "new script" copied in the code. Saved it out. So I can hit run script, select my saved file. and we're golden. Is there a way to assign that script to either a button on the interface or make it an option in the tools drop down? I found how to put a "run script" into the UI, but I can't figure out how to assign my specific script. Edited May 8, 2008 by BrianKitts Link to comment Share on other sites More sharing options...
RobNJ73 Posted May 8, 2008 Share Posted May 8, 2008 Just highlight the script in the listener window, and drag it to an empty toolbar... I'm assuming the prewritten scripts can work the same way as making buttons out of macros, though... Link to comment Share on other sites More sharing options...
BrianKitts Posted May 8, 2008 Author Share Posted May 8, 2008 AWESOME! that worked, thanks guys!!!! Link to comment Share on other sites More sharing options...
BrianKitts Posted May 8, 2008 Author Share Posted May 8, 2008 HAA HAAA I'm still singing! I now have a streamlined workflow for updating archicad models. I now can update my max models using revisions made in archicad. Once the material reassignment plugin is setup, I can import models, update the materials, and rename all the objects in about 20 seconds. STELLAR! again - a big THANKS for the help! 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