Author Topic: save dwg as backup on open before its modified  (Read 5989 times)

0 Members and 1 Guest are viewing this topic.

ronjonp

  • Needs a day job
  • Posts: 7529
Re: save dwg as backup on open before its modified
« Reply #15 on: September 11, 2014, 03:29:55 PM »
I was not sure how Andrew was going to implement the solution just throwing ideas out there. My backup saves files in 15 minute increments while working. Has worked well for me.


Then there was THIS lisp I wrote way back when that created a folder called 'SUPERSCEDE' and copied the current drawing and xrefs into it.


Have fun !

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

BlackBox

  • King Gator
  • Posts: 3770
Re: save dwg as backup on open before its modified
« Reply #16 on: September 11, 2014, 03:48:28 PM »
... and you will need to verify that the drawing is not a new drawing that has never been saved to disk.

Perhaps I've misunderstood the thread title, but the OP seems to be attempting to create a backup immediately after opening an existing drawing (not creating a new drawing).

My $0.02

You are correct, however, the solution was proposed to be added to the startup lisp ... the same startup lisp that runs regardless of whether you are opening a drawing or starting a new blank drawing ...

this is why I get paid the big bucks ;-)

Big bucks you may be paid, but where I previously state that need not be considered, you cannot cite. :angel:

"How we think determines what we do, and what we do determines what we get."

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
Re: save dwg as backup on open before its modified
« Reply #17 on: September 11, 2014, 03:52:04 PM »
... and you will need to verify that the drawing is not a new drawing that has never been saved to disk.

Perhaps I've misunderstood the thread title, but the OP seems to be attempting to create a backup immediately after opening an existing drawing (not creating a new drawing).

My $0.02

You are correct, however, the solution was proposed to be added to the startup lisp ... the same startup lisp that runs regardless of whether you are opening a drawing or starting a new blank drawing ...

this is why I get paid the big bucks ;-)

Big bucks you may be paid, but where I previously state that need not be considered, you cannot cite. :angel:



WUT?

Who said anything about you? I was referring to the very first solution where it plainly says to add it to the startup. If you misunderstood, I cannot help that.
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

Matt__W

  • Seagull
  • Posts: 12955
  • I like my water diluted.
Re: save dwg as backup on open before its modified
« Reply #18 on: September 11, 2014, 03:56:45 PM »
Why not simply use Ron's code to make a copy each time the DWG is saved??  It's essentially the same as making a copy of it before it's modified, isn't it??  I mean, the file that is copied (whether it's after a save or before an open) is the same thing.
Autodesk Expert Elite
Revit Subject Matter Expert (SME)
Owner/FAA sUAS Pilot @ http://skyviz.io

BlackBox

  • King Gator
  • Posts: 3770
Re: save dwg as backup on open before its modified
« Reply #19 on: September 11, 2014, 04:02:36 PM »
... and you will need to verify that the drawing is not a new drawing that has never been saved to disk.

Perhaps I've misunderstood the thread title, but the OP seems to be attempting to create a backup immediately after opening an existing drawing (not creating a new drawing).

My $0.02

You are correct, however, the solution was proposed to be added to the startup lisp ... the same startup lisp that runs regardless of whether you are opening a drawing or starting a new blank drawing ...

this is why I get paid the big bucks ;-)

Big bucks you may be paid, but where I previously state that need not be considered, you cannot cite. :angel:



WUT?

Who said anything about you? I was referring to the very first solution where it plainly says to add it to the startup. If you misunderstood, I cannot help that.

You did. :wink:
"How we think determines what we do, and what we do determines what we get."

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: save dwg as backup on open before its modified
« Reply #20 on: September 11, 2014, 05:57:06 PM »
Here's a simple one I keep in my startup. If the file already exists (for the current day), it will not be copied over again, which is what I wanted.
I should change it to use a copy method other than vl-file-copy, just so I the original file edit date won't be changed, but it's never been a big deal for what this has been there for.

Code: [Select]
((lambda (/ path)
   (if (not (wcmatch (strcase (getvar 'DWGNAME)) "DRAWING*"))
     (progn
       (vl-mkdir (setq path "c:\\dwgBackup"))
       (vl-mkdir (setq path (strcat path "\\" (menucmd "M=$(edtime,$(getvar,date),YYYY.M.DD)") "\\")))
       (vl-file-copy (strcat (getvar 'DWGPREFIX) (getvar 'DWGNAME)) (strcat path (getvar 'DWGNAME)))
     )
   )
 )
)
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

BlackBox

  • King Gator
  • Posts: 3770
Re: save dwg as backup on open before its modified
« Reply #21 on: September 11, 2014, 06:49:59 PM »
I do something very similar in my VOID routine, which I used to make a dated copy of a drawing prior to making major design changes. I also have a routine which allows me to quickly 'step' through one or more previously created void copies (which are relative pathed).

Also, always good to see you in the forums AT. :beer:
"How we think determines what we do, and what we do determines what we get."

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
Re: save dwg as backup on open before its modified
« Reply #22 on: September 12, 2014, 12:03:55 PM »
... and you will need to verify that the drawing is not a new drawing that has never been saved to disk.

Perhaps I've misunderstood the thread title, but the OP seems to be attempting to create a backup immediately after opening an existing drawing (not creating a new drawing).

My $0.02

You are correct, however, the solution was proposed to be added to the startup lisp ... the same startup lisp that runs regardless of whether you are opening a drawing or starting a new blank drawing ...

this is why I get paid the big bucks ;-)

Big bucks you may be paid, but where I previously state that need not be considered, you cannot cite. :angel:



WUT?

Who said anything about you? I was referring to the very first solution where it plainly says to add it to the startup. If you misunderstood, I cannot help that.

You did. :wink:

WUT? X2
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: save dwg as backup on open before its modified
« Reply #23 on: September 13, 2014, 09:27:35 AM »
Code: [Select]
(if (not (wcmatch (strcase (getvar 'DWGNAME)) "DRAWING*"))

FWIW, the above could be:
Code: [Select]
(if (= 1 (getvar 'dwgtitled))
To account for the possibility that a saved drawing starts with 'DRAWING...'

ChrisCarlson

  • Guest
Re: save dwg as backup on open before its modified
« Reply #24 on: September 15, 2014, 08:29:14 AM »
Edited

« Last Edit: September 15, 2014, 01:15:02 PM by ChrisCarlson »

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: save dwg as backup on open before its modified
« Reply #25 on: September 15, 2014, 08:38:25 AM »
Code: [Select]
(if (not (wcmatch (strcase (getvar 'DWGNAME)) "DRAWING*"))

FWIW, the above could be:
Code: [Select]
(if (= 1 (getvar 'dwgtitled))
To account for the possibility that a saved drawing starts with 'DRAWING...'
I always forget about that variable. Thanks.
Granted, I seriously hope people aren't naming files starting with "Drawing".
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

andrew_nao

  • Guest
Re: save dwg as backup on open before its modified
« Reply #26 on: September 15, 2014, 09:45:17 AM »
wow some good ideas in here.
the thought i was having was just to have a backup of a dwg like alajt's suggestion.
just 1 copy no overwrite, no delete and recopy. just 1 copy as "original".
that is very simple code too, i thought it would be a bit more complicated to implement.

appreciate everyones feedback

ChrisCarlson

  • Guest
Re: save dwg as backup on open before its modified
« Reply #27 on: September 15, 2014, 01:18:38 PM »
Corrected the batch file

Code: [Select]
@ECHO OFF
SET _params=%*
CALL :sub "%_params%" 
:sub
ECHO %~nx1
set folder=C:\AutoCAD_Originals
set odate=%date:~4,2%_%date:~7,2%_%date:~10,4%
copy %~nx1 "%FOLDER%\%~n1-%ODATE%.dwg"
start %~nx1
exit

Code: [Select]
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\*\shell\Drawing Backup]
"Position"="Top"
"Extended"=""
[HKEY_CLASSES_ROOT\*\shell\Drawing Backup\command]
@="cmd.exe /T:17 /K C:\\AutoCAD_Originals "%1""

Simply right click and open the file you want with Drawing Backup.

Does time stamps matter? I know going through lisp changes the last edit time stamp within the file.