Save a copy of file without changing name of open file?


#1

I thought there was a command to do this, but I can’t figure it out now. Is it possible? What I want to do is to create a button that I click & it creates a copy of the currently open file in a dropbox folder, so that I have a quick cloud backup. But then I expect to keep working locally, so I don’t want the file name or current path to change. I didn’t see anything in Rhinoscript or rhino to do this. Any thoughts?


(Pascal Golay) #2

Hi Peter- I guess you need to script this - Save, then SaveAs then reopen the previously Saved file…? I’ve wished/asked for a SaveACopy functionality in the past as well.

-Pascal


#3

What about a script that grabs everything (including hidden and locked stuff) and Exports it all? Would the hidden and locked stuff retain their attributes? The disadvantage of saving and reopening the file will be you lose your undo stack…

–Mitch


#4

Or wait - if the file has been saved, couldn’t you use vbscript with windows shell and file system object to copy the file to another location (without needing Rhino to SaveAs?)

–Mitch


(John Brock) #5

I think IncrementalSave will mostly do this, but the enumerated file it creates will need to be copied to the Dropbox folder. Cloud based file repositories, like NAS drives, aren’t fast enough to be used as working folders without a lot of problems and frustration.


#6

I have no idea how to do that, unfortunately.


#7

Maybe. I could make each layer visible, add some document data to each to identify the layer & other info, and then export everything. Then, if I need the backup file, I could have a button to assign everthing to the layers & states that they were in. I think that could work, but it would take me all day to write it in my half-assed scripting way.


#8

As Mitch said, that would lose my undo stack.


#9

John, I already save locally using incremental save. But I want to make something that’s semi-automatic to save a copy directly to dropbox. I’m very lazy, so to open a folder & copy a file to dropbox is a few steps too many to do each time I stop working for an hour or two, and would probably make it so that I don’t do it consistently.

Maybe this would be better as some sort of windows script/program that backs up the most recent files (of any kind) to a folder in dropbox. That would be handy, but way beyond my abilities.


#10

Pascal - maybe it could copy the current location & filename, then save a copy to dropbox, then incremental save to the local (original) folder. That would preserve the undo stack. I’m always doing incremental save anyway, so this would work for me. But a specific SaveACopy command would be more useful to more people.


(Pascal Golay) #11

I think Mitch’s file copying via Windows thought is worth a look- I bet he’s already 80% done with it but I’ll take a look as well.

-Pascal


#12

Sorry, I haven’t had much time to do this stuff lately… :disappointed: Go for it and thanks!

–Mitch


(Pascal Golay) #13

Hi Peter- here is a first shot at SaveACopy, using the Mitch method. At the moment it does not check for success, I’ll see about adding that, and it also asks for a path each time. You can edit with a hard coded destination path if you like, I’ll see if I can make it a bit more friendly if it is generally the right thing - let me know.

To use the script, extract and save the .rvb file from the attached zip archive, then drag and drop the saved rvb over an open Rhino v5 window. This will load the script, set it up to load on startup in the future and register the alias

SaveACopy

that will run the script much like a regular command. An alias can be typed or added to a toolbar button or keyboard shortcut (F-key).
NOT heavily tested but it seems to work so far here.

SaveACopy.zip(845 Bytes)

-Pascal


#14

Thanks - I’ll try that out.


#15

That’s great Pascal! It would be perfect if, instead of the dialog box, there were command-line options so that I could put the path in a script, but I guess that might be tough since paths can have spaces. Anyway, I’m happy - I put the path hard-coded into your script & it seems to do what I want (though confirmation of success would be nice…)

Thanks to both you & Mitch!

peter


(Pascal Golay) #16

Hi Peter - here is an updated version- it does not browse for a folder but asks if you want to browse or type - you can macro it by:

SaveACopy _Browse _Enter to browse

SaveACopy _Enter “C”\Test" to hard code a folder.

There is some error checking so it should tell you about success or failure or if you type an invalid path.

SaveACopy(4).zip(1.5 KB)

I should add that this Saves the current file as well as copying it to the destination folder- just in case that is not clear.

-Pascal


(Pascal Golay) #17

Added as a feature request for V6 -

http://mcneel.myjetbrains.com/youtrack/issue/RH-21059

(These bug track items are not public yet.)

-Pascal


#18

This is great! For my personal use, I changed the ‘save’ to ‘savesmall’ since I’m just creating backup snapshots. Thanks!

peter


#19

Pascal, why is the resulting file name always in all caps?

peter


(Pascal Golay) #20

Hmmm… dunno, I’ll take a look. I don’t think I did anything special to get that…

-Pascal