Author Topic: save dwg code causing acad 2019 to prompt for dwg recovery when opening any dwg  (Read 1865 times)

0 Members and 1 Guest are viewing this topic.

andrew..

  • Newt
  • Posts: 24
does anyone see anything wrong with the code below?

when i open any dwg after saving it, it prompts for dwg recovery.
If i disable this and run the OOTB save, I do not get the recovery prompt.

This code has never been an issue till now.

Code: [Select]
(defun c:nsave (/ activedoc docfullname backuppath archivename dwgbakk)
(if (= (getvar "dwgtitled") 0)
 (PROGN
   (initdia)
  (if (>= (atof (getvar "acadver")) 20.0)
   (command-S ".saveas")
   (command ".saveas")
    )
 )
)
 
  (setq activedoc (vla-get-activedocument (vlax-get-acad-object)))
  ;;
(vla-save activedoc)
  (if (and (not (= 0 (strlen (setq docfullname (vla-get-fullname activedoc)))))
           (setq backuppath "C:\\ACADBACK\\")
           (setq archivename (strcat backuppath (vl-filename-base (vla-get-name activedoc))".dwg"))
           )

    (setq dwgbakk (vl-file-copy docfullname archivename))
    (alert "Ooooops. Unable to get Filename.")
  )
  (if (= dwgbakk nil)
(progn
(vl-file-delete archivename)
(vl-file-copy docfullname archivename)
)
)
  (prompt (strcat "\n\nFile Saved..." archivename ))
  (prompt (strcat "\n\nFile Saved..." docfullname))
  (princ)

)

kdub_nz

  • Mesozoic keyThumper
  • SuperMod
  • Water Moccasin
  • Posts: 2159
  • class keyThumper<T>:ILazy<T>

You have no course of action that works as expected if the backuppath does not exist.
Otherwise I can see no obvious cause for error.

Called Kerry in my other life
Retired; but they dragged me back in !

I live at UTC + 13.00

---
some people complain about loading the dishwasher.
Sometimes the question is more important than the answer.