Save a model in sketchup 8

Hi,

is there a way to save an untitled model with a name in sketchup 8 using the API? In later versions I am using the command

Sketchup.active_model.save("MyPath\MyFileName.skp")

and it works fine, but in SketchUp 8 I am getting this bug splat

I can trigger the save command as follows

Sketchup.send_action( 57603 )

but then save panel opens and the user needs to navigate to the appropriate folder and input the model name manually which is not nice. Is there a way to incorporate the filename in this send_action command so the save panel opens in a given folder and uses a default filename?

Thanks for the help!
Regards, Carlos

That is strange. It should work same since version 6. Could be that the installation of the SketchUp 8 is somehow corrupted.
However the version 8 is very old. Is there a specific reason to use this more than 10 years old software?

:thinking:What happens if you try to use the format of #save instance_method like:

Sketchup.active_model.save("MyPath\MyFileName.skp", Sketchup::Model::VERSION_8)

I guess you can use the savepanel class method instead.

NO. Send actions are clones of menu commands meant for making custom toolbars.

What is your full version number ? And on what OS version are you running SU8 ?

Hi dezmo, thanks for your reply!

well this is part of a plug-in I am working on, It would be great if SketchUp 8 is supported.
I tried adding the second argument with the sketchup version, this time the bug splat message is not happening but it just crashes after the saving order.

I am using savepanel in newer versions to get the filename from the user. It is very useful because I can input a default folder and filename. But it doesn’t save the model by itself, one has to save the model afterwards

Sketchup.active_model.save(filepath_output_by_savepanel)

savepanel can be used in SU8, but then I am failing to save the model with the output name…

Hi DanRathbun

ok, I tried adding a second argument to the send_actions at it didn’t work out. I am working on Windows 10 and here is my SU8 full version

image

Thanks, Carlos

Extremely few users use such an ancient SU versions. Personally I never on purpose support anything older than SU 2017, which was the last free version for hobbyists. Supporting older versions adds a bunch of extra work.

2 Likes

My shot-in-the-dark guess (I don’t have a running copy of SU 8 to try) is that the backslash in the file path is causing an issue. In Ruby it acts as an escape character so the effective path is “MyPathMyFilename.skp”, which probably doesn’t exist or runs into a permissions issue that trips a bug in SU 8. Try either using a forward slash or doubling up the backslash and see if that helps.

3 Likes

I wouldn’t want to feed them…
It was the last free version that could be used commercially.

If I remember right, only the initial release - the EULA was updated with the first maintenance version.

FYI, … there is one newer maintenance release 8.0 M5 with a Windows build number of: 8.0.16846

All SketchUp versions at or below 2013 use Ruby 1.8.x and did not ship with the Ruby Standard Library.

Also these old versions of Ruby did not support Unicode text strings on Windows, which was a major reason for the upgrade to Ruby 2.0.0 with the SketchUp 2014 release (with the Ruby Standard Library.)

There are also a myriad of other problems that the upgrade to Ruby 2.0.0 fixed.
(And there is no way to “shoehorn” Ruby 2.x into older versions.)

Regarding errors running SUv8 on Windows 10, I am not surprised.

Your version (8 M4) was released when Windows 7 was the current release, and many users did not like it and still ran Windows XP or Vista.

The final release (8 M5) came out just after Windows 8.0 was released. That version had some issues and a full year later (Oct 2013) MS released Windows 8.1.

Windows 10 was not announced until late 2014 and not released publicly until July 2015, which happened after all SketchUp 2015 releases.

So it wasn’t until the initial release of SketchUp 2016 (Nov 2015) that Windows 10 is supported.


Besides the problems with Ruby, and the OS quirks, the SketchUp API has undergone so many bugs fixes it makes it next to impossible to write workarounds and have an extension code that works in all SketchUp versions, with all Ruby versions, on all OS platforms and versions. (Unless the extension is the simplest of tasks.)

Thanks, I will check if that is the problem

Thanks for the info, I am aware of some of the problematic you mention. I will search for an installer of 8.0 M5 and test the plugin there

regards

I revisited this problem recently and kind of found a solution that works.

@slbaumgartner you were right about replacing backslashes for forward ones, doing that I am being able to save the model in SU8 as follows:

filePath = 'Mypath\MyFile.skp'
revisedFilePath = filepath.gsub("\\") {"/"}
Sketchup.active_model.save(revisedFilePath)  

I can see this generates a new .skp file with the desired name at the desired location but the current model is still untittled.skp. This is different for later versions of SU where the current model gets the name when you save it.

a work around could be just open the saved file immediately after saving

Sketchup.open_file(revisedFilePath)