Mass convert SU files to different version?
-
That is actually exactly what I'd want. I'll try out that code, THANK YOU!
-
@ericschimel said:
Ok, it doesn't work on Mac but it does work on my PC.
Is there any way to remove the "V8" appended to the end of the filename?
Yes of course but, if the 'From' and 'To' folders are the same, you will have to accept the overwriting of each individual file.
Change
mod.save_copy("#{tdir}/#{m}_v#{versions[ver]}", ver);
to
mod.save_copy("#{tdir}/#{m}", ver);
-
I have source code for a command-line converter available here[1]. The documentation is not up to date - although there's no time this morning to clean it up. It should compile just by typing "make" in the root folder (where the Makefile is.)
It builds for me under Windows using MinGW-64, I can't test Macs. You would need to modify the Makefile to point to your copy of the SketchUp SDK. You will also need a c++ dev command-line dev environment setup which might be a huge hurdle by itself. There is a link in the readme to an easy to install Windows g++ compiler suite.
Batch processing can be done by specifying a sub-folder in the output file:
mkdir temp_folder
loop for each skp_file in folder:
s2s 2013 skp_file temp_folder/skp_file
end loop
[1] https://github.com/jimfoltz/jf-sketchup-c-api-sandbox/tree/master/skp2skp
-
@ericschimel said:
...to mass convert SketchUp 2017 files down to SketchUp 8 files.
just wondering for what this is required.
-
@ericschimel said:
I'm trying it and I can't get it to work for some reason (I'm on a Mac if that's helpful)
When I fire it up it asks me for the version, and then a file dialog pops up. I forces me to browse for and select an individual SketchUp model, I can't multiselect or just pick a folder. Once I do pick a file it pops up another file dialog, assumably for me to tell it where to place the converted files. I select a location and run it and nothing happens...
Perhaps I'm doing something wrong?
I confirm it does not work on Mac:
Ruby console output:
Sketchup.open_file(/Users/gilles/Downloads/@/Roller bracket.skp) mod.save_copy(/Users/gilles/Downloads/@/Roller bracket_v8, 8) Error; #<ArgumentError; Model must be saved before copying.> /Users/gilles/Library/Application Support/SketchUp 2015/SketchUp/Plugins/Bulk Copy by Version.rb;70;in `save_copy' /Users/gilles/Library/Application Support/SketchUp 2015/SketchUp/Plugins/Bulk Copy by Version.rb;70;in `block in main' /Users/gilles/Library/Application Support/SketchUp 2015/SketchUp/Plugins/Bulk Copy by Version.rb;64;in `each' /Users/gilles/Library/Application Support/SketchUp 2015/SketchUp/Plugins/Bulk Copy by Version.rb;64;in `main' /Users/gilles/Library/Application Support/SketchUp 2015/SketchUp/Plugins/Bulk Copy by Version.rb;29;in `block in <top (required)>' SketchUp;1;in `call'
-
@sketch3d.de said:
@ericschimel said:
...to mass convert SketchUp 2017 files down to SketchUp 8 files.
just wondering for what this is required.
Lot of peoples like me don't upgrade to the latest version for some (good) reason.
If you ask here some help and upload a model we can't read, we can't help you.
This may be one of the reasons why this is required for.
-
@gilles said:
If you ask here some help and upload a model we can't read, we can't help you.
batch converting instead of doing a "Save as..." is probably not required for this purpose.
-
@sdmitch said:
@ericschimel said:
I've been looking around and I'm trying to find a way to mass convert SketchUp 2017 files down to SketchUp 8 files. I've found this great plugin by Jim Foltz:
http://sketchucation.com/forums/viewtopic.php?f=323%26amp;t=33441
Unfortunately, it does it one file at a time. Ideally what I'd like to do is point SketchUp 2017 at a directory full of hundreds of SketchUp models and have it open each one and do a "Save as SketchUp 8" and overwrite the file, close, and open the next one.
I have attached a plugin that I wrote a year ago for someone that made a similar request.
Usage: Plugins>SDM Tools>Misc Tool>Bulk Copy by Version
- Select the Copy Version* Select the 'From Folder'* Select the 'To Folder'
hi. could you please make it working with the latest 2021 version?
-
Hello and thanks to the developer of this extension,
but I tried it on sketchup 2021 and it did not work ! when I click on the covert no window pop up to select the "from" folder and "To" folder and the "Version" ! it works on sketchup 2015 but on sketchup 2021 it did not work!
I wonder if the developer of this extension can check and update it to work with sketchup 2021
Thank you,
-
This plugin would be very useful if I could get it to work . Using SU version 8. Followed video instruction in this thread . Tried different folders etc.
Laptop is Win 10 64 bit.Sketchup.open_file(C:/Users/12/Downloads/Projects/SketchUp/_Models/001.skp)
mod.save_copy(C:/Users/12/Downloads/Projects/SketchUp/_Models/_SU 8/001_v8,
Error: #<NoMethodError: undefined methodsave_copy' for #<Sketchup::Model:0x11a22be4>> C:/Program Files (x86)/Google/Google SketchUp 8/Plugins/4JDu_BulkCopybyVersion.rb:70:in
main'
C:/Program Files (x86)/Google/Google SketchUp 8/Plugins/4JDu_BulkCopybyVersion.rb:64:ineach' C:/Program Files (x86)/Google/Google SketchUp 8/Plugins/4JDu_BulkCopybyVersion.rb:64:in
main'
C:/Program Files (x86)/Google/Google SketchUp 8/Plugins/4JDu_BulkCopybyVersion.rb:29For reference, this is the plugin code. Maybe there is a newer version?
#------------------------------------------------------------------------------------------------
Permission to use, copy, modify, and distribute this software for
any purpose and without fee is hereby granted.
#------------------------------------------------------------------------------------------------
THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#------------------------------------------------------------------------------------------------
THIS PLUGIN IS ANOTHER FIGMENT OF MY IMAGENATION AND IS NOT BASED ON OR COMPLY WITH ANYTHING!
#------------------------------------------------------------------------------------------------
IT WAS CREATED AND ONLY TESTED IN A WINDOWS ENVIRONMENT AND MAY NOT FUNCTION ON A MAC.
#------------------------------------------------------------------------------------------------
Name: Bulk Copy by Version
By: sdmitch
Usage: Plugins>SDM Tools>Misc Tool>Bulk Copy by Version
Note:
Date: Feb 2016
#------------------------------------------------------------------------------------------------
require 'Sketchup'------------------ MENU SETUP ----------------------
unless $sdm_tools_menu
$sdm_tools_menu = UI.menu("Plugins").add_submenu("SDM Tools")
$sdm_Edge_tools = $sdm_tools_menu.add_submenu("Edge Tool")
$sdm_Face_tools = $sdm_tools_menu.add_submenu("Face Tool")
$sdm_CorG_tools = $sdm_tools_menu.add_submenu("CorG Tool")
$sdm_Misc_tools = $sdm_tools_menu.add_submenu("Misc Tool")
end
unless file_loaded?(FILE)
$sdm_Misc_tools.add_item("Bulk Copy by Version") { SDM::Bulk_Copy_by_Version.main }
file_loaded(FILE)
end------------------------------------------------------
module SDM
module Bulk_Copy_by_Version def self.main mod = Sketchup.active_model ent = mod.active_entities sel = mod.selection # version = Sketchup.version.to_i.to_s versions = ['0','0','All','3','4','5','6','7','8','2013','2014','2015','2016','2017','2018','2019','2020'] until versions[-1].index(version) versions.pop end inp = UI.inputbox(["Save Version:"],["6"],[versions[2..-1].join("|")],"Save by Version") if inp ver = versions.index(inp[0]) path = File.dirname(mod.path) path = Dir.pwd if !path || path=="" input_folder = Sketchup.read_default("BulkCopybyVersion","InputFolder",path) from = UI.openpanel("From Folder:",input_folder,"*.skp") if from fdir = File.dirname(from).gsub("\\","/") Sketchup.write_default("BulkCopybyVersion","InputFolder",fdir) models = Dir[fdir+"/*.skp"].map{|m|File.basename(m,'.skp')} output_folder = Sketchup.read_default("BulkCopybyVersion","OutputFolder",path) to = UI.savepanel("To Folder:",output_folder,"temp.tmp") if to tdir = File.dirname(to).gsub("\\","/") Sketchup.write_default("BulkCopybyVersion","OutputFolder",tdir) Sketchup.file_new for m in models next if m=="." || m==".." puts "Sketchup.open_file(#{fdir}/#{m}.skp)" Sketchup.open_file("#{fdir}/#{m}.skp"); unless ver == 2 puts "mod.save_copy(#{tdir}/#{m}_v#{versions[ver]}, #{ver})" mod.save_copy("#{tdir}/#{m}_v#{versions[ver]}", ver); else for ver in 3...versions.length puts "mod.save_copy(#{tdir}/#{m}_v#{versions[ver]}, #{ver})" mod.save_copy("#{tdir}/#{m}_v#{versions[ver]}", ver); end end end Sketchup.file_new end end end # end end
end
-
@dahnuguy
The model.save_copy method is only available >=v2014
So it fails in v8.
Advertisement