Al,
There's a problem ( perhaps - please confirm )
I've been experimenting for a week-or-so regarding the problem with the Model ID being 'inherited' from a parent model, when using the 'Save as...' or 'Save copy as...' commands. As you noted, the 'cloned' file has the same 'mid' number as the parent model file. I've been testing ruby code with the ruby console.
Problem description
I discovered how to delete the 'ModelID' key, exactly the same way you coded in your ruby script. I could indeed upload the 'clone' file to the 3DWarehouse, as a 'new' model. I then completed the upload process by saving the file before closing it, as you're supposed to, in order to save the new ModelID into the 'clone' model file. When I reload the model, there is NO 'ModelID' key stored in the file.
Doing it again, I checked for a 'ModelID' key as soon as the upload was successfully completed. Again, no 'ModelID' key! In the ruby console, I am using the following to return the 'ModelID' key:
Sketchup.active_model.get_attribute('3DWarehouse','ModelID')
Experimenting further, I found that the Warehouse apparently does generate a new 'mid' number, but it either does not return it to my model in SketchUp, or the model fails to accept it. Additional testing revealed that a new 'mid' number does not get coded into the model unless the entire dictionary, '3DWarehouse' is deleted. (This deletes the 'ModelID' key, which is contained in the dictionary.) I used the following in the ruby console:
Sketchup.active_model.attribute_dictionaries.delete('3DWarehouse')
Checking afterwards, the dictionary and key are indeed deleted. Uploading to the Warehouse is accepted as a new model, and a new 'mid' number is generated, just as before. Upon completion, and checking my model for the 'ModelID' key, the correct number is, this time, returned in the ruby console (by correct, I mean it matches the URL 'mid' number.)
By using, primarily, the two ruby snippets above, I'm convinced that deleting just the key doesn't completely fix the problem - the dictionary has to be deleted, as well.
During testing, I also used these two snippets (for diagnostics):
Sketchup.active_model.attribute_dictionary('3DWarehouse').keys
Sketchup.active_model.attribute_dictionary('3DWarehouse')
Would you be so kind as to confirm this behavior? If your posted ruby script requires revision, now's the time to catch it, before many people download or reference it.
Regards,
Taff