TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: mjfarrell on July 12, 2007, 03:27:14 PM

Title: Incremental Save As
Post by: mjfarrell on July 12, 2007, 03:27:14 PM
What I have been attempting to do with little success is to create a Toolbar button to do the following:

Save the current drawing; then perform a Save As to the current drawing name +BAK.dwg.

The reason for this curious function is that despite the Recovery Manager, or perhaps because of it Civil 3D has the annoying habit of reporting that the recovery file is INVALID.
As a workaround to this annoyance I have adopted the habit of performing a save as to a DWGNAMEBAK.dwg, and then as save as back the original filename. In this manner I can depend on MY saved as file to be complete when C3D, and Recovery manager decides to munch my design file.

i would like to add this to a button to make it easier, and thus more likely to be used by other users; so that they too will stop losing work to this feature.

Title: Re: Incremental Save As
Post by: Arizona on July 12, 2007, 03:30:23 PM
Could an alternate method be to wblock all to that filename?
Title: Re: Incremental Save As
Post by: mjfarrell on July 12, 2007, 03:35:48 PM
anything will be acceptable as long as A) it can be on a button menu and B) it results in kepping both files in same folder with a slightly different name, i.e.  DWGNAMEBAK, or DWGNAME01, etc.
Title: Re: Incremental Save As
Post by: T.Willey on July 12, 2007, 03:39:19 PM
You can do it this way.
Code: [Select]
(progn
 (command "_.qsave")
 (command "_.save" (strcat (getvar "dwgprefix") (vl-filename-base (getvar "dwgname")) "-Bak.dwg"))
)
This will save the current file, both to the name you want, and a back up one, and will leave you in the real drawing.
Title: Re: Incremental Save As
Post by: Arizona on July 12, 2007, 03:44:58 PM
Nice one! ^^ :-)
Title: Re: Incremental Save As
Post by: T.Willey on July 12, 2007, 03:46:50 PM
Nice one! ^^ :-)
Thanks!  Learned that trick (using the save command that way) over on the Adesk Ng awhile back, and never have forgotten it.
Title: Re: Incremental Save As
Post by: Dinosaur on July 12, 2007, 03:47:46 PM
I thank you Tim . . . I am thinking about naming thebutton SaveMyA**
Title: Re: Incremental Save As
Post by: mjfarrell on July 12, 2007, 03:52:32 PM
Perfectly marvelous....except upon the second use the user is promted y/n to overwrite the DWGNAMEBAK file. Can this be set to Yes, to work without the user being prompted?
Title: Re: Incremental Save As
Post by: T.Willey on July 12, 2007, 03:55:28 PM
Perfectly marvelous....except upon the second use the user is promted y/n to overwrite the DWGNAMEBAK file. Can this be set to Yes, to work without the user being prompted?
I just saw that, so I think we should make it it's own function.
Code: [Select]
(defun c:SaveMyA** (/ NewPath)

(setq NewPath (strcat (getvar "dwgprefix") (vl-filename-base (getvar "dwgname")) "-Bak.dwg"))
(command "_.qsave")
(if (findfile NewPath)
 (command "_.save" NewPath "_yes")
 (command "_.save" NewPath)
)
(princ)
)

I thank you Tim . . . I am thinking about naming thebutton SaveMyA**
You're very much welcomed, and thanks for a name for the function. :-D
Title: Re: Incremental Save As
Post by: LE on July 12, 2007, 03:57:00 PM
if I remember use (setvar "expert" 2) - but wait for master Tim....
Title: Re: Incremental Save As
Post by: mjfarrell on July 12, 2007, 03:58:36 PM
ok, the official name is SaveMyA**,

only now that code doesn't work in the button....what did we break?
Title: Re: Incremental Save As
Post by: T.Willey on July 12, 2007, 03:58:53 PM
if I remember use (setvar "expert" 2) - but wait for master Tim....
Looks around..... No master Tim I see...  :-)

I don't mess with "expert" variable, but from the help you are correct master Luis.
Title: Re: Incremental Save As
Post by: T.Willey on July 12, 2007, 04:00:16 PM
ok, the official name is SaveMyA**,

only now that code doesn't work in the button....what did we break?
If you just want it in a button, then no need to name it, but use this code instead.
Code: [Select]
(progn
 (setq NewPath (strcat (getvar "dwgprefix") (vl-filename-base (getvar "dwgname")) "-Bak.dwg"))
 (command "_.qsave")
 (if (findfile NewPath)
  (command "_.save" NewPath "_yes")
  (command "_.save" NewPath)
 )
 (setq NewPath nil)
)
Title: Re: Incremental Save As
Post by: mjfarrell on July 12, 2007, 04:05:50 PM
ok, i think we broke something in there...??

the first piece of code, when pasted to the button worked on the first click...
 the revised code does not function on the first click and appears to stick in a loop:

from ACAD Text Window:

Command: (progn
(_>  (setq NewPath (strcat (getvar "dwgprefix") (vl-filename-base (getvar
"dwgname")) "-Bak.dwg"))
(_>  (command "_.qsave")
(_>  (if (findfile NewPath)
((_>   (command "_.save" NewPath "_yes")
((_>   (command "_.save" NewPath)
((_>  )
(_>  (setq NewPath nil)
(_> )
_.qsave
Command: _.save Save drawing as <C:\Civil 3D Projects\UEP SW 6 and 7\Sample
Surface Model.dwg>: C:\Civil 3D Projects\UEP SW 6 and 7\Sample Surface
Model-Bak.dwg A drawing with this name already exists.
Do you want to replace it? <N> _yes
Command: nil
Title: Re: Incremental Save As
Post by: T.Willey on July 12, 2007, 04:08:22 PM
_.qsave
Command: _.save Save drawing as <C:\Civil 3D Projects\UEP SW 6 and 7\Sample
Surface Model.dwg>: C:\Civil 3D Projects\UEP SW 6 and 7\Sample Surface
Model-Bak.dwg A drawing with this name already exists.
Do you want to replace it? <N> _yes
Command: nil
Looks like it worked to me?  Did it not save it?

nil is returned because the last line of the code sets the path to nil, so that it can't be used in another lisp you use.  This is a precaution.

If you don't like the nil, then place (princ) after the line (setq NewPath nil).
Title: Re: Incremental Save As
Post by: Keith™ 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.
Title: Re: Incremental Save As
Post by: mjfarrell 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!
Title: Re: Incremental Save As
Post by: T.Willey 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:
Title: Re: Incremental Save As
Post by: CAB 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)
)
Title: Re: Incremental Save As
Post by: mjfarrell on July 12, 2007, 04:51:54 PM
Uh, Cabby, what would your 'variant' do differently?

Title: Re: Incremental Save As
Post by: CAB 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".
Title: Re: Incremental Save As
Post by: mjfarrell 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.
Title: Re: Incremental Save As
Post by: Kerry 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. )
Title: Re: Incremental Save As
Post by: Dinosaur 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?
Title: Re: Incremental Save As
Post by: T.Willey 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.  :-)
Title: Re: Incremental Save As
Post by: John Mayo 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
Title: Re: Incremental Save As
Post by: T.Willey 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.
Title: Re: Incremental Save As
Post by: Dinosaur 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.
Title: Re: Incremental Save As
Post by: Dinosaur 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.
Title: Re: Incremental Save As
Post by: T.Willey 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.
Title: Re: Incremental Save As
Post by: Dinosaur on July 13, 2007, 11:41:42 AM
. . . but then again I don't use Civil 3D.
You can take great comfort in that.  Using Civil 3D is kind of like working with a 14 year old son . . . it has incredible power and can make the task at hand much easier and sometimes even possible, but this potential is evenly matched with a full measure of stubbornness, attitude and immaturity that taxes one's patience to its limits.
I will try adding the command to a few of the more volatile routines and see what happens.
Title: Re: Incremental Save As
Post by: T.Willey on July 13, 2007, 11:46:03 AM
Well Din0, all I can say is that I hope you are pleasantly surprised.
Title: Re: Incremental Save As
Post by: mjfarrell on July 13, 2007, 11:55:47 AM
At this point I am still averse to using Vault.  Mostly due to it being more or less about version control than project management as in Land Desktop. Secondly due to the additional administrative overhead. See threads regarding needing to 'migrate' 2007 Vault into 2008 Vault headaches in this and other Forums.


I sorely wish that Autodesk would NOT have made it an either nor option to use Vault OR the Native Project mgt functions as they existed in earlier versions of C3D.  I can understand them trying to get the most out of their investment in creating Vault, only the original functionality was fine and with far less overhead to implement and administer than Vault ever will be.
Title: Re: Incremental Save As
Post by: mjfarrell on July 13, 2007, 11:57:49 AM
Speaking of cats ...


Say Kerry, how about a brief overview of the who, what, when, where of the code that you posted?
Title: Re: Incremental Save As
Post by: John Mayo on July 13, 2007, 12:06:18 PM
What's that smell, did I step in something?

Thank you all for the replies. I understand the concerns with Vault. I too have many wishes & I have had my patience pushed in all kinds of directions... ;)

John
Title: Re: Incremental Save As
Post by: mjfarrell on July 13, 2007, 02:06:24 PM
What's that smell, did I step in something?

Thank you all for the replies. I understand the concerns with Vault. I too have many wishes & I have had my patience pushed in all kinds of directions... ;)

John


Care to share what your issues both good and bad are with Vault?  C'mon we can handle the truth. :evil:
Title: Re: Incremental Save As
Post by: Kerry on July 13, 2007, 09:51:39 PM
Speaking of cats ...


Say Kerry, how about a brief overview of the who, what, when, where of the code that you posted?

It's nothing special Michael.
Just Saves the File then copies the file to a folder \\DRAWINGArchive\\.. under the current location, appending the file name with a datestamp. We use it for archiving our model drawings. Also handy when you need to demonstrate to 'someone' that the details they are trying to change were incorporated and finalised at a specific time .. also great for before and after snapshots.

It could easily be modified to dump the archive into the same folder as the original if that was ayour preference.

The when and where, if important, is here a couple of times and at CadVault a couple of times.

The Archive folder looks something like this :-
Title: Re: Incremental Save As
Post by: andrew_nao on July 16, 2007, 08:39:00 AM
I use this maybe you can modify it to suit you needs

Code: [Select]
(DEFUN c:nsave ( / dname dpref bdir dbac)

(setq dname (getvar "DWGNAME"))
(setq dpref (getvar "DWGPREFIX"))
(setq bdir (strcat "C:/ACADBACK/" dname))
(command "Qsave")
(setq dbac (vl-file-copy (getvar "savename") bdir))
(if (= dbac nil)
(progn
(vl-file-delete bdir)
(vl-file-copy (getvar "savename") bdir)
)
)
(setq sname (strcat "File Saved To "dpref dname))
(setq sname1 (strcat  sname "\nFile Saved To "bdir))
(ALERT sname1 )

;(prompt "\n\nFile Saved...")
;(princ bdir)
;(prompt "\n\nFile Saved...")
;(princ dpref)
;(princ dname)
(princ)
);END QSAVE
Title: Re: Incremental Save As
Post by: mjfarrell on July 16, 2007, 11:03:19 AM
Andrew, same questions, how about a brief overview of the who, what, when, where of the code that you posted?
So that someone might know what it could do for them to decide if it is suitable for their needs.
Title: Re: Incremental Save As
Post by: andrew_nao on July 17, 2007, 01:31:37 PM
it saves the current drawing you are in and then it also makes a backup to another directory
Title: Re: Incremental Save As
Post by: RickO on July 23, 2007, 01:53:12 PM
Invalid dwg error disaster Protection.
Thanks for the Save your BUTTon, I wrote it up for mass consumption, with screen shots, etc.
Title: Re: Incremental Save As
Post by: dfarris75 on December 13, 2007, 09:48:18 AM
ok, the official name is SaveMyA**,

only now that code doesn't work in the button....what did we break?
If you just want it in a button, then no need to name it, but use this code instead.
Code: [Select]
(progn
 (setq NewPath (strcat (getvar "dwgprefix") (vl-filename-base (getvar "dwgname")) "-Bak.dwg"))
 (command "_.qsave")
 (if (findfile NewPath)
  (command "_.save" NewPath "_yes")
  (command "_.save" NewPath)
 )
 (setq NewPath nil)
)
I am using this now and it works, however I've noticed on multiple occasions after a save that while I am in the original *.dwg the toolspace shows that the *BAK.dwg file is the one opened. Has anyone else noticed such a glitch?
Title: Re: Incremental Save As
Post by: deegeecees on December 13, 2007, 10:40:59 AM
Thats because thats the name it was saved as LAST.

If you extend the function to save it back to its original name as the last save, that wouldn't happen.
Title: Re: Incremental Save As
Post by: T.Willey on December 13, 2007, 11:12:34 AM
ok, the official name is SaveMyA**,

only now that code doesn't work in the button....what did we break?
If you just want it in a button, then no need to name it, but use this code instead.
Code: [Select]
(progn
 (setq NewPath (strcat (getvar "dwgprefix") (vl-filename-base (getvar "dwgname")) "-Bak.dwg"))
 (command "_.qsave")
 (if (findfile NewPath)
  (command "_.save" NewPath "_yes")
  (command "_.save" NewPath)
 )
 (setq NewPath nil)
)
I am using this now and it works, however I've noticed on multiple occasions after a save that while I am in the original *.dwg the toolspace shows that the *BAK.dwg file is the one opened. Has anyone else noticed such a glitch?
Thats because thats the name it was saved as LAST.
On my system that doesn't matter.  If you use the save command, and give it a name, it will save the file to that name, but keep the original one open still.  Maybe there is a system variable or something that is setup different.
Title: Re: Incremental Save As
Post by: hudster on December 13, 2007, 11:18:06 AM
save the file to somewhere on your server where everyone can access it, then do this

change the button command to read ^C^C(load "<yourserver location>/savemya**.lsp");savemya**;

that should work.
Title: Re: Incremental Save As
Post by: justin on December 19, 2008, 04:16:36 PM
Can someone offer a suggestion to change to this code such that the save of the current drawing happens after the save to -bak.dwg? 
We have an auto generated path name attached to our title block and the current code changes the path to -bak.dwg unless another qsave is performed after the current code.  We modified this code to add an additional qsave at the end of the current code, but our modified process involves 3 separate save commands and is quite slow.
Title: Re: Incremental Save As
Post by: Andrea on December 20, 2008, 12:36:12 PM
suggestion....(tested on 2009 only)

Code: [Select]
(DEFUN c:nsave (/ dname dpref bdir incr)
  (setvar "CMDECHO" 0)
  (setq dname (vl-filename-base (getvar "DWGNAME")))
  (setq dpref (getvar "DWGPREFIX"))
  (setq bdir (strcat dpref "DWGBACKUP\\"))

  (setq incr (rtos (getvar "CDATE") 2 6))

  (if (not (vl-file-directory-p bdir))
    (vl-mkdir bdir)
  )
 
  (if (findfile (strcat bdir dname "-" incr "-Bak.dwg"))
    (vl-cmdf "._save"
     (strcat bdir dname "-" incr "-Bak.dwg")
     "_Y"
    )
    (vl-cmdf "._save" (strcat bdir dname "-" incr "-Bak.dwg"))
  )

(if (findfile (strcat dpref dname ".dwg"))
    (vl-cmdf "._Qsave")
    (vl-cmdf "._save" (strcat dpref dname ".dwg"))
  )
  (princ "\save and backup done !")
  (princ)
)
Title: Re: Incremental Save As
Post by: uncoolperson on December 20, 2008, 01:19:51 PM
this is what I've got going on for the drafters i work with
http://www.theswamp.org/index.php?topic=8499.0
Title: Re: Incremental Save As
Post by: ronjonp on December 20, 2008, 01:39:06 PM
This is what I put in my MNL file so a copy is made via reactor whenever a save ends:

Code: [Select]
(vl-load-com)
(if (not *rjp-CommandReactors*)
  (setq *rjp-CommandReactors*
(vlr-command-reactor
   nil
   '((:vlr-commandEnded . EndCMD))
)
  )
)

(defun EndCMD (calling-reactor EndCMDInfo /)
  (if (wcmatch (strcase (nth 0 EndCMDInfo) T) "*save*")
    (rjp-backupdwg)
  )
)

;;makes a copy a DWG after a save to "C:/AutoCAD-BAK/"...keeps 1/2 hour history
(defun rjp-backupdwg (/ bkupdir date time hour minute dwgpath fullpath dwgdir)
  (if (= (getvar 'dwgtitled) 1)
    (progn (setq bkupdir  "C:/AutoCAD-BAK/";;put the path you want here
date   (rtos (fix (getvar 'cdate)) 2 0)
date   (strcat (substr date 5 2) "." (substr date 7 2) "." (substr date 1 4) "/")
time   (rtos (rem (getvar 'cdate) 1) 2 6)
hour   (substr time 3 2)
minute   (substr time 5 2)
hour   (if (>= (atoi minute) 30)
    (strcat hour "-30/")
    (strcat hour "/")
  )
dwgpath  (strcat (vl-string-right-trim
    "."
    (substr (vl-string-translate "\\\"" "." (getvar 'dwgprefix)) 4)
  )
  "/"
  )
fullpath (strcat bkupdir date hour dwgpath (getvar 'dwgname))
dwgdir   (strcat (getvar 'dwgprefix) (getvar 'dwgname))
   )
   (vl-mkdir bkupdir)
   (vl-mkdir (strcat bkupdir date))
   (vl-mkdir (strcat bkupdir date hour))
   (vl-mkdir (strcat bkupdir date hour dwgpath))
   (if (findfile fullpath)
     (vl-file-delete fullpath)
   )
   (vl-file-copy dwgdir fullpath)
    )
  )
  (princ)
)
Title: Re: Incremental Save As
Post by: justin on December 22, 2008, 04:50:19 PM
We seemed to have resolved our problem using the following code.

Code: [Select]
^C^C(progn
 (setq NewPath (strcat (getvar "dwgprefix") (vl-filename-base (getvar "dwgname")) "-Bak.dwg"))
  (if (findfile NewPath)
  (command "_.save" NewPath "_yes")
  (command "_.save" NewPath)
 )
 (setq NewPath nil)
(command "_.qsave")
)

Thanks for your input.

<edit CAB: added code tags>
Title: Re: Incremental Save As
Post by: Andrea on December 23, 2008, 10:23:52 AM
We seemed to have resolved our problem using the following code.

Code: [Select]
^C^C(progn
 (setq NewPath (strcat (getvar "dwgprefix") (vl-filename-base (getvar "dwgname")) "-Bak.dwg"))
  (if (findfile NewPath)
  (command "_.save" NewPath "_yes")
  (command "_.save" NewPath)
 )
 (setq NewPath nil)
(command "_.qsave")
)

Thanks for your input.

<edit CAB: added code tags>

Good.. ;-)
but...where is the incremental ?