Visual LISP, AutoLISP and General Customization

Visual LISP, AutoLISP and General Customization

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

Revamp Revert

176 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
Do you have 60 seconds to spare? The Autodesk Community Team is revamping our site ranking system and we want your feedback! Please click here to launch the 5 question survey. As always your input is greatly appreciated.