Clearing 3D Warehouse information saved in a SKP file
-
I have attached a ruby script which will add a command to the Tools menu to clear 3D Warehouse data for the current model.
Place this ruby file in SketchUp\Plugins
The command "Reset 3D Warehouse Info" will be placed under "Tools"
When executed, the 3D Warehouse information (but not any previously uploaded 3D Warehouse models) will be removed for this model.
The next time you "share" the model, it will create a new 3D Warehouse entry.
@unknownuser said:
I uploaded a model to the 3D Warehouse, then made a change to the .SKP file, saved it with a different name and uploaded a new version of the model.
When I clicked "Share" it remembered the information about the first model. I changed the information and uploaded it, but it "replaced" the original model rather than creating a new one.
Is there a way to "fool" the 3D Warehouse into realizing that the new model is not the same as the old model. (I am guessing that the model information is saved in the .SKP file)
-
That's great, Al,
I also remember posts like this in the Groups Forums. Not being a programmer at all, I usually suggest people to copy the model and paste it into a new file which doesn't bear the WH info. With this script it is easier now.
-
Why...that's a REALLY good idea! P.S. I saw your lamp model in the Warehouse!
[Invader ZIM]
-
I actually wrote the script to help with four wine bottle models.
-
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
Advertisement