http://www.scriptspot.com/3ds-max/scripts/detach-by-material-id http://www.scriptspot.com/3ds-max/scripts/detach-by-material-id-0 http://emrahgunduz.com/categories/development/maxscript/detach-using-material-ids/ You can attach all your objects, then use Detach By Material using any of the scripts above.
If you know scriptspot.com search there it is highly possible someone already made it. Otherwise just create Multi/Subobject material of sufficient length and assign your materials to it. Personally I don't see a point here cause eve if you export this it will not help you in engine cause same object would need to be drawn…