SKP 2017 - saving component to file via ruby

SKP 2017 - saving component to file via ruby

Postby artmusicstudio » Fri Apr 28, 2017 2:13 pm

hi,
is there any hidden parameter in the api (now in skp 2017), that would alow me to save a compo-definition to a file (name.skp) in version 2015 instead of the version of the opened skp-session?
the reason is, that i have a version of a vis-program, which does not import version 2017-files.
(at the moment i have to re-open them in a new skp-session and save_as....)

or is there a converter, which could be launched from ruby-api to batch-convert the saved compos in a selected folder?

than in advance.

stan
0
User avatar
artmusicstudio 
PluginStore Author
PluginStore Author
 

Re: SKP 2017 - saving component to file via ruby

Postby TIG » Fri Apr 28, 2017 4:33 pm

Look at
https://sketchucation.com/pluginstore?p ... components
which saves all components out as the current SUp version.

You then need to process the folder of SKP's and change the SUp version.
Try the attached RB - put it in your Plugins folder
[open that using this in the Ruby Console
UI.openURL("file:///#{Sketchup.find_support_file('Plugins')}")
]
Usage:
Open a new empty SKP.
Run the tool from its File menu item:
"TIG-batchSKPversion"
In the dialog that appears navigate to the required folder of SKP files to be processed and pick any one SKP file.
Press OK.
ALL SKP files in that folder will be processed as new version SKP files in turn.
The new SKP files share the SKP files names, and go into a '2015' subfolder.
If the Ruby Console is open the SKP names are shown in turn.
Change version = in the RB file if saving to another version as desired...
0
TIG
User avatar
TIG 
Global Moderator
 

Re: SKP 2017 - saving component to file via ruby

Postby artmusicstudio » Fri Apr 28, 2017 6:37 pm

hi tig,
thanx for replying,
i just red your code and suppose, that every skp-file, you call, will be opened in the viewport and resaved as another version - correct? so it cannot be used as a background task within (under) a running sketchup session (maybe a parallel skp-session opens..... :-)),
have to try it out later this evening.
what is a big help for me, is the declaration <<ver=Sketchup::Model::VERSION_2016>>,
i must have missed it in the api-doc.
the rest is clear.

but: so there is no way to declare the skp-version when saving a compo to a file, i guess...
thanx
stan
0
User avatar
artmusicstudio 
PluginStore Author
PluginStore Author
 

SketchUcation One-Liner Adverts

by Ad Machine » 5 minutes ago



Ad Machine 
Robot
 



 

Return to Developers' Forum

Who is online

Users browsing this forum: flavipinis1959 and 8 guests

Visit our sponsors: