Author Topic: Incremental Save As  (Read 10187 times)

0 Members and 1 Guest are viewing this topic.

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16716
  • Superior Stupidity at its best
Re: Incremental Save As
« Reply #15 on: July 12, 2007, 04:10:32 PM »
Some years ago I wrote some code that automatically saved the current drawing (whenever you hit save) in 2 locations.
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

mjfarrell

  • Seagull
  • Posts: 14441
  • Every Student their own Lesson
Re: Incremental Save As
« Reply #16 on: July 12, 2007, 04:13:51 PM »
it may look like it 'worked', the thing is it doesn't work with the first click on the button.
one must click twice or hit return.....so I added an additional RETURN at the end and now it works with a single click.  A minor quibble to be sure; but we are very gratefull and totally happy!

As now it is a simple one-click operation and much more likely to be used by the user to save them from the Recovery Manager failing to manage to recover the file.

The Civil 3D world will forever be in your debt!
Be your Best


Michael Farrell
http://primeservicesglobal.com/

T.Willey

  • Needs a day job
  • Posts: 5213
Re: Incremental Save As
« Reply #17 on: July 12, 2007, 04:15:45 PM »
it may look like it 'worked', the thing is it doesn't work with the first click on the button.
one must click twice or hit return.....so I added an additional RETURN at the end and now it works with a single click.  A minor quibble to be sure; but we are very gratefull and totally happy!

As now it is a simple one-click operation and much more likely to be used by the user to save them from the Recovery Manager failing to manage to recover the file.

The Civil 3D world will forever be in your debt!
Glad you got it to work.  I'm glad I was able to help out a couple of Civil people.  :lmao:
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10339
Re: Incremental Save As
« Reply #18 on: July 12, 2007, 04:46:57 PM »
Another variant:
<untested>
Code: [Select]
(progn
 (command "_.qsave")
 (command "_.save" (strcat (getvar "dwgprefix") (vl-filename-base (getvar "dwgname")) "-Bak.dwg"))
 (if (getvar "CMDACTIVE") 0)
  (command "_yes")
 )
 (princ)
)
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

mjfarrell

  • Seagull
  • Posts: 14441
  • Every Student their own Lesson
Re: Incremental Save As
« Reply #19 on: July 12, 2007, 04:51:54 PM »
Uh, Cabby, what would your 'variant' do differently?

Be your Best


Michael Farrell
http://primeservicesglobal.com/

CAB

  • Global Moderator
  • Seagull
  • Posts: 10339
Re: Incremental Save As
« Reply #20 on: July 12, 2007, 05:07:31 PM »
It is a variant in that the routine is not the same but the result is the same.
Just another way to "Skin the Cat".
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

mjfarrell

  • Seagull
  • Posts: 14441
  • Every Student their own Lesson
Re: Incremental Save As
« Reply #21 on: July 12, 2007, 05:09:58 PM »
Thanks Cabby, I was thinking that that "CMADACTIVE" portion was doing what Autodesk should do prior to performing an AutoSave while the user is in the middle of an active command.
Be your Best


Michael Farrell
http://primeservicesglobal.com/

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Incremental Save As
« Reply #22 on: July 12, 2007, 05:12:45 PM »
Speaking of cats ...

I'm sure I've posted this previously ..
Code - Auto/Visual Lisp: [Select]
  1. ;; ModelSave.lsp
  2. ;;
  3. (DEFUN C:MSAVE (/ *error* activedoc docfullname backuppath archivename)
  4.     ;; codehimbelonga kwb@theSwamp
  5.     ;; requires the DosLib Library.
  6.     ;;
  7.     ;; IAcadDocument Object
  8.     ;;
  9.     ;;------ Set Error Trap --------------------------
  10.     ;;
  11.     (DEFUN *error* (msg /)
  12.         (WHILE (< 0 (GETVAR "cmdactive")) (COMMAND))
  13.         (COND
  14.             ((NOT msg))                           ; no error, do nothing
  15.             ((VL-POSITION (STRCASE msg T)         ; cancel
  16.                           '("console break" "function cancelled" "quit / exit abort")
  17.              )
  18.             )
  19.             ((PRINC
  20.                  (STRCAT "\nApplication Error: "
  21.                          (getvar "errno")
  22.                          " :- "
  23.                          msg
  24.                  )
  25.              )
  26.              (IF g:debug_on
  27.                  (VL-BT)
  28.              )
  29.             )
  30.         )
  31.     )
  32.     ;;(VLA-ENDUNDOMARK activedoc)                   ; end any open undo group
  33.     ;;(VLA-STARTUNDOMARK activedoc)                 ; start new group
  34.     ;;
  35.     ;;----- Main --------------------------
  36.     ;;
  37.     (VLA-SAVE activedoc)
  38.     (IF (AND (NOT (= 0 (STRLEN (SETQ docfullname (VLA-GET-FULLNAME activedoc)))))
  39.              (SETQ backuppath (DOS_MKDIR (STRCAT (VL-FILENAME-DIRECTORY docfullname)
  40.                                                  "\\DRAWINGArchive"
  41.                                          )
  42.                               )
  43.              )
  44.              (SETQ archivename (STRCAT backuppath
  45.                                        (VL-FILENAME-BASE (VLA-GET-NAME activedoc))
  46.                                        "-"
  47.                                        (RTOS (* (GETVAR "cdate") 1000000) 2 0)
  48.                                        ".dwg"
  49.                                )
  50.              )
  51.         )
  52.         (VL-FILE-COPY docfullname archivename)
  53.         ;; else
  54.         (ALERT "Ooooops. Unable to establish ArchiveName.")
  55.     )
  56.     (PROMPT (STRCAT "\n Archived file : " archivename))
  57.     (*error* nil)
  58.     (PRINC)
  59. )
« Last Edit: October 01, 2012, 06:22:31 AM by Kerry »
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<--

DinØsaur

  • Certified Bovine Scat Distributor...I lay it on THICK
  • Needs a day job
  • Posts: 5424
  • But I don't WANT a Day Job
Re: Incremental Save As
« Reply #23 on: July 13, 2007, 09:30:49 AM »
For some reason, I could not get the script version to work on a button.  I combined the two by loading the lisp routine in that part of the cui and then just assigned the command to the button and it works perfectly through the button or the command line.
Would it be possible and / or advisable with the command thus established to include it as part of other routines that sometimes return "unexpected" results?
Stephen R. Sherrill,
The DinØsaur
Civil 3D Specialist Emeritus

YAY ME !!!  I made it out alive !

T.Willey

  • Needs a day job
  • Posts: 5213
Re: Incremental Save As
« Reply #24 on: July 13, 2007, 11:10:33 AM »
It will always return the right results, as there is very little room to mess anything up.  The problem with adding the code straight to the button is that an enter needs to be pushed, so if you add a semicolon after it, it should work, as per
it may look like it 'worked', the thing is it doesn't work with the first click on the button.
one must click twice or hit return.....so I added an additional RETURN at the end and now it works with a single click.  A minor quibble to be sure; but we are very gratefull and totally happy!

As now it is a simple one-click operation and much more likely to be used by the user to save them from the Recovery Manager failing to manage to recover the file.

The Civil 3D world will forever be in your debt!

That is if you were talking about my code.  :-)
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

John Mayo

  • Guest
Re: Incremental Save As
« Reply #25 on: July 13, 2007, 11:21:15 AM »
VERY nice work folks. I was wondering if any of you are using Vault? Any implications?

John

T.Willey

  • Needs a day job
  • Posts: 5213
Re: Incremental Save As
« Reply #26 on: July 13, 2007, 11:23:42 AM »
VERY nice work folks. I was wondering if any of you are using Vault? Any implications?

John
We don't here.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

DinØsaur

  • Certified Bovine Scat Distributor...I lay it on THICK
  • Needs a day job
  • Posts: 5424
  • But I don't WANT a Day Job
Re: Incremental Save As
« Reply #27 on: July 13, 2007, 11:25:06 AM »
Thank you, I missed that bit.  I can now work the function either way.
I am still curious if the new command defined via the lisp routine can be safely called as part of a script or in tandem with other routines to perform this save prior to executing certain Civil 3D commands that are still a bit "dicey" and tend to yield a power exit.
Stephen R. Sherrill,
The DinØsaur
Civil 3D Specialist Emeritus

YAY ME !!!  I made it out alive !

DinØsaur

  • Certified Bovine Scat Distributor...I lay it on THICK
  • Needs a day job
  • Posts: 5424
  • But I don't WANT a Day Job
Re: Incremental Save As
« Reply #28 on: July 13, 2007, 11:27:19 AM »
VERY nice work folks. I was wondering if any of you are using Vault? Any implications?

John
I don't have vault working here although I may run an experiment when / if 2008 is deployed.
Stephen R. Sherrill,
The DinØsaur
Civil 3D Specialist Emeritus

YAY ME !!!  I made it out alive !

T.Willey

  • Needs a day job
  • Posts: 5213
Re: Incremental Save As
« Reply #29 on: July 13, 2007, 11:31:31 AM »
Thank you, I missed that bit.  I can now work the function either way.
I am still curious if the new command defined via the lisp routine can be safely called as part of a script or in tandem with other routines to perform this save prior to executing certain Civil 3D commands that are still a bit "dicey" and tend to yield a power exit.
I don't see why not, because it is using basic core commands, but then again I don't use Civil 3D.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.