Visual LISP, AutoLISP and General Customization

Visual LISP, AutoLISP and General Customization

Valued Contributor
Posts: 63
Registered: ‎12-10-2004
Message 1 of 1 (173 Views)

Revamp Revert

173 Views, 0 Replies
04-05-2013 06:48 AM

Hey everyone,

Turns out that if you have two sessions of AutoCAD/C3D open and use the Revert command and you select yes to abandon changes then it will close out the drawing as expected but it will reopen that drawing in the other session.  Wild.  I dont remember this behavior inside 2011 but it is happening in 2013.  I was wondering if there was a different command that could replace this one.  I don't care if it is in vlisp or not but we love love love this command.  Can someone help?  I think it has to do with vbastmt function, but I cannot say for sure.


(defun C:REVERT (/ dwg reply sdiOpen)
  ;;  special open for SDI mode
  (defun sdiOpen (name force)
                (acet-str-format "(command \"_.OPEN\"%1)\n%2\n"
                                 (if force " \"_Y\"" "")
                                 name ) )
  ;;  quiet
  (acet-error-init '(("CMDECHO" 0)))
  ;;  check for the necessary support code
  (if (acet-reg-get (strcat "HKEY_LOCAL_MACHINE\\"
                            "\\Applications\\acadvba\\commands" )
                    "VBASTMT" )
    ;;  worth trying ??
    (if (= 1 (getvar "DWGTITLED"))
        ;;  pick file name
        (setq dwg (strcat (getvar "DWGPREFIX") (getvar "DWGNAME")))
        ;;  drawing modified ??
        (if (and (/= 0 (getvar "DBMOD"))
                 (= Acet:IDCANCEL
                        (acet-str-format "Abandon changes to %1?" dwg)
                                         "AutoCAD - REVERT"
                                         (+ Acet:smileysurprised:KCANCEL
                                            Acet:smileyvery-happy:EFBUTTON2 ) ) ) )
        ;; SDI ??
        (if (/= 0 (getvar "SDI"))
          (sdiOpen dwg (/= 0 (getvar "DBMOD")))
          (command "vbastmt" (acet-str-format
              "ThisDrawing.Close(FALSE):AcadApplication.Documents.Open \"%1\""
              dwg ) )
      (acet-ui-message "Drawing has never been saved."
                       "AutoCAD - REVERT"
                       Acet:ICONSTOP )
    (acet-ui-message "VBA support not installed."
                     "AutoCAD - REVERT"
                     Acet:ICONSTOP )


thank you in advance


Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Are You Going To Be @ AU 2014? Feel free to drop by our AU topic post and share your plans, plug a class that you're teaching, or simply check out who else from the community might be in attendance. Ohh and don't forgot to stop by the Autodesk Help | Learn | Collaborate booths in the Exhibit Hall and meet our community team if you get a chance!