Author Topic: more back ups... really  (Read 3158 times)

0 Members and 1 Guest are viewing this topic.

uncoolperson

  • King Gator
  • Posts: 4430
  • Doing everything in metric inches!
more back ups... really
« on: January 25, 2006, 04:19:48 PM »
so for some reason our drafters have issues with saving, really... and it doesn't get caught in time to use the back up files

so here's what i'm trying, the problem is that it keeps saving the backup of the file being closed with the filename of the drawing being opened...sometimes


Code: [Select]
(vlr-remove-all :VLR-DWG-REACTOR)
(VLR-DWG-REACTOR
  nil
  '((:VLR-BEGINCLOSE . saveacopy))
)
(DEFUN saveacopy (something somethingelse)
  (IF (NOT
(SETQ opened (OPEN (SETQ tempname (STRCAT (GETVAR "SAVEFILEPATH")
  (MENUCMD
    "M=$(edtime,$(getvar,date),mon-dd-yyyy-h-mmam/pm)"
  )
  "-"
  (GETVAR "DWGname")
  )
   )
   "r"
     )
)
      )
      (VLA-SENDCOMMAND
            (VLAX-GET (VLAX-GET-ACAD-OBJECT) "activedocument")
            (STRCAT "filedia " "0 " ".save\r" tempname "\r" "filedia " "1 ")
      )
    (CLOSE opened)
  )
)

any ideas

again i appologize this isn't the prettiest code...

when all else fails On Error Resume Next
-----------------------
Livin like I'm on borrowed time
-----------------------
Searching for the Ballmer Peak

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: more back ups... really
« Reply #1 on: January 26, 2006, 12:54:03 AM »
so for some reason our drafters have issues with saving, really... and it doesn't get caught in time to use the back up files

so here's what i'm trying, the problem is that it keeps saving the backup of the file being closed with the filename of the drawing being opened...sometimes


Code: [Select]
(vlr-remove-all :VLR-DWG-REACTOR)
(VLR-DWG-REACTOR
  nil
  '((:VLR-BEGINCLOSE . saveacopy))
)
(DEFUN saveacopy (something somethingelse)
  (IF (NOT
(SETQ opened (OPEN (SETQ tempname (STRCAT (GETVAR "SAVEFILEPATH")
  (MENUCMD
    "M=$(edtime,$(getvar,date),mon-dd-yyyy-h-mmam/pm)"
  )
  "-"
  (GETVAR "DWGname")
  )
   )
   "r"
     )
)
      )
      (VLA-SENDCOMMAND
            (VLAX-GET (VLAX-GET-ACAD-OBJECT) "activedocument")
            (STRCAT "filedia " "0 " ".save\r" tempname "\r" "filedia " "1 ")
      )
    (CLOSE opened)
  )
)

any ideas

again i appologize this isn't the prettiest code...

a couple of things ;
Code: [Select]
(vlr-remove-all :VLR-DWG-REACTOR) .... What happens if there are other DWG-REACTOR's set in the drawing by other applications ?


Code: [Select]
(MENUCMD     "M=$(edtime,$(getvar,date),mon-dd-yyyy-h-mmam/pm)"  )
This may be better as yyyy-mm-dd...etc for file sorting.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

--> Donate to theSwamp<--

uncoolperson

  • King Gator
  • Posts: 4430
  • Doing everything in metric inches!
Re: more back ups... really
« Reply #2 on: January 26, 2006, 10:02:13 AM »

Code: [Select]
(vlr-remove-all :VLR-DWG-REACTOR) .... What happens if there are other DWG-REACTOR's set in the drawing by other applications ?


thanks, i really don't know why i didn't think of that... thanks for that catch kerry.
when all else fails On Error Resume Next
-----------------------
Livin like I'm on borrowed time
-----------------------
Searching for the Ballmer Peak

uncoolperson

  • King Gator
  • Posts: 4430
  • Doing everything in metric inches!
Re: more back ups... really
« Reply #3 on: January 31, 2006, 12:06:10 PM »
so i went diging in the vlisp stuff (wow!) i'm still trying to figure all this mess out.. there's probably an easier way then 4 vlax-get's but by replacing

Code: [Select]
(GETVAR "DWGname")
with this

Code: [Select]
(STRCAT (VL-FILENAME-BASE
  (VLAX-GET (VLAX-GET (VLAX-GET (VLAX-GET (VLAX-GET-ACAD-OBJECT) "activedocument")
"views"
      )
      "document"
    )
    "fullname"
  )
)
".dwg"
)

things seem to work better.... any better ideas?
when all else fails On Error Resume Next
-----------------------
Livin like I'm on borrowed time
-----------------------
Searching for the Ballmer Peak

pmvliet

  • Guest
Re: more back ups... really
« Reply #4 on: January 31, 2006, 12:37:30 PM »
you may also want to set your Autosave to something smaller like 4 minutes as well...

Pieter

Chuck Gabriel

  • Guest
Re: more back ups... really
« Reply #5 on: January 31, 2006, 12:49:28 PM »
so i went diging in the vlisp stuff (wow!) i'm still trying to figure all this mess out.. there's probably an easier way then 4 vlax-get's but by replacing

Code: [Select]
(GETVAR "DWGname")
with this

Code: [Select]
(STRCAT (VL-FILENAME-BASE
  (VLAX-GET (VLAX-GET (VLAX-GET (VLAX-GET (VLAX-GET-ACAD-OBJECT) "activedocument")
"views"
      )
      "document"
    )
    "fullname"
  )
)
".dwg"
)

things seem to work better.... any better ideas?

could be shortened to:
Code: [Select]
(strcat (vl-filename-base
  (vla-get-fullname
    (vla-get-activedocument (vlax-get-acad-object))
  )
)
".dwg"
)

uncoolperson

  • King Gator
  • Posts: 4430
  • Doing everything in metric inches!
Re: more back ups... really
« Reply #6 on: January 31, 2006, 01:02:47 PM »
could be shortened to: ...

Thanks... that sure is prettier


you may also want to set your Autosave to something smaller like 4 minutes as well...
the reason for this is the drafters here have found so many different ways to screw a drawing up beyond anything autosave could fix... and so far have been able to screw things up so that this is only going to help about 1/3 of the time!
when all else fails On Error Resume Next
-----------------------
Livin like I'm on borrowed time
-----------------------
Searching for the Ballmer Peak