Batch Open-Process-Save
-
anyone up to make a script that opens sequentially all the skp files in a folder, sets a style, puts the model to front view, fits the model to screen, purges all unused and then saves until all files are done?
what i'm trying to do is consolidate my components library and have the thumbnails work for all files.
(i can make a reasonable paypal donation)
-
We've already had a PM exchange about this...
I'll see if I have anything 'off-the-peg' that you can modify to suit what you want...
Watch your PMs... -
Thanks TIG that would be great.. ..if i can get AE to put it together ; )
-
A simple rb solution has been PMd.
PM feedback please... -
@cadfather said:
anyone up to make a script that opens sequentially all the skp files in a folder, sets a style, puts the model to front view, fits the model to screen, purges all unused and then saves until all files are done?
what i'm trying to do is consolidate my components library and have the thumbnails work for all files.
(i can make a reasonable paypal donation)
This plugin might be helpful
http://sketchucation.com/forums/viewtopic.php?t=48215 -
thanks Giro, i know that one - this is to process sketchup files though and not images.
-
skp modification and save copy
@cadfather said:thanks Giro, i know that one - this is to process sketchup files though and not images.
I have been trying for a while to write a plugin that would do what you say
TIG's helped me with some code, and i wrote this plugin "skp_recap.rb"There is a problem, though: i don't find the way to overwrite the file with the modifications the plugin makes, so i have to save it with a different name: I added "bis" to the name of the file
nom_model = model.title #constitue le nom du modele nom_model = rep_path + "/" + nom_model + "bis"+".skp" puts nom_model #sauve model.save nom_model
maybe somebody will find a clever way to avoid the "bis" trick
-
@cadfather said:
thanks Giro, i know that one - this is to process sketchup files though and not images.
it seems i am not the only one with this problem for saving a currently opened file with the same name
http://www.smustard.com/forum/viewtopic.php?f=6&t=35
maybe a sketchup bug...
-
thanks Giro, did you see this?
http://sketchucation.com/forums/viewtopic.php?f=180&t=51357
anyways, i'm pretty sure master TIG will probably come up with something fab yet again..
-
@glro said:
[attachment=0]maybe somebody will find a clever way to avoid the "bis" trick
maybe the .save() method without a name simple saves the current model? the bug might be that calling .save() with the name causes it to assume "save as" and therefore cannot because the model is open (and a bug) causes it not to revert to "save" (like many programs like Office for example) when the current file and "new" file are the same.
of course another option is keep the name and simply place the output files into another folder so after the batch processing is completed you can simply move those files into the existing folder (overwriting) or whatever it is you're trying to achieve.
-
The issue is that
model.save(name)
will return 'true
', BUT it doesn't actually save the model if that 'name
' is an open SKP - either as another SKP or it's the current-model's SKP.
To save a model you need to use
Sketchup.send_action("saveDocument:")
Then use other API methods to open other files etc... -
@tig said:
The issue is that
model.save(name)
will return 'true
', BUT it doesn't actually save the model if that 'name
' is an open SKP - either as another SKP or it's the current-model's SKP.
To save a model you need to use
Sketchup.send_action("saveDocument:")
Then use other API methods to open other files etc...yes
i modified the previous plugin, and now the file is saved
thank you TIGstill 2 problems i can't solve:
disable perspective (Sketchup.send_action("viewPerspective:" puts it on and then off...)
wait until the file is saved (i added a messagebox, you have to click between each file)TIG gave (again) a solution for the second problem
http://sketchucation.com/forums/viewtopic.php?f=323&t=39304
but i couldn't make it work on my computer
-
Hi guys, is there a (relatively) easy way to edit a script like this to batch down-save models to a previous version (no changes made, only save)?
-
@matt.gordon320 said:
Hi guys, is there a (relatively) easy way to edit a script like this to batch down-save models to a previous version (no changes made, only save)?
The save_as_version is not accessible in the current API [it might one day happen in a newer version of SketchUp...]
Jim Foltz wrote something for PC [using a .so] which opens the save_as dialog and mimics keystrokes to change to the previous version.
You could use some of its ideas to do this for say v2013 back to v8 ?
http://sketchucation.com/forums/viewtopic.php?p=294768#p294768
Links to his site... -
@tig said:
The save_as_version is not accessible in the current API
Well that'll help to explain why I had such trouble trying to find it in the API docs! Thanks TIG, I'll look into that one!
Advertisement