OBJ material names by style

 From:  Michael Gibson
5790.3 In reply to 5790.1 
Here is a function that you can add to the script that will change style names to replace spaces in any style names:

code:
function RenameStylesWithSpaces()
{
    var styles = moi.geometryDatabase.getObjectStyles();

    for ( var i = 0; i < styles.length; ++i )
    {
         var style = styles.item(i);
         style.name = style.name.replace( /\s/g, '§' );
    }
}


Paste that into that into the top of the script. Then modify the script to call that function before calling AssignObjectNamesFromStyles, like this:



RenameStylesWithSpaces();
AssignObjectNamesFromStyles();



- Michael