Possible API BUG for #save_copy and Sketchup::Model::VERSION_2019

bug
api
sketchup-2019

#1

Hi,

Can’t get the #save_copy API method to Save for SketchUp 2019
# save_copy (filename, version) ⇒ Boolean

Other SketchUp versions work fine but not 2019… Can someone verify with the code below?

module RafaelRivera
module TestScript

  model = Sketchup.active_model
  path = model.path[0...-4]
  title = model.title

  filename = File.join(path, "#{title}_v2019.skp")

  ## Model::VERSION_2018 Works but not Model::VERSION_2019
  status = model.save_copy(filename, Sketchup::Model::VERSION_2019) 

  UI.openURL(path)

end # module
end # module

Thanks in Advance!


#2

Sketchup.save doesn’t accept Sketchup::Model::VERSION_2019as argument either.

Edit: This is tracked internally as SU-41938.

For now I think you can ignore the version parameter when saving to 2019 as it defaults to the running SU version, but if this isn’t fixed in 2020 there will be problems.


#3

I hope maintenance releases haven’t totally disappeared. Especially when SketchUp aims to become rolling release.


#4

slightly off topic…

# what is this meant to be doing or what does it do on windoze...
 UI.openURL(path)
# on a mac it raises a system error trying to open a folder in the default browser...
' There is no application set to open the URL <the path was here>' 
# if you want the Folder to open in Finder, you would need a system call using one of these...
system('open', path) || `open "#{path}"` || %x(open "#{path}")

#5

I’ve made a (hopefully) working cross platform method for opening directories. If the path is a file, not a directory, it should also become selected.

Typically this is called “Show in Folder” on windows and “Reveal in Finder” on Mac in my experience. Some programs that seam to have been developed on Mac and then ported to Windows call it “Reveal in Explorer”, which makes little sense as the name of explorer.exe isn’t exposed in the UI, just a technical name. I think “Show in Folder” is used on Mac too in some programs but can’t make any promises.