Jump to content

Suppress alert while closing drawing


JamCAD

Recommended Posts

Just a quick one.

 

I have two shortcuts that I use to close a drawing while suppressing the "Do you want to save" alert, thus closing the drawing without using any mouse clicks. One to close and save the drawing (and zoom extents if in paperspace, thus updating the preview thumbnail in windows explorer), the other to close the drawings without saving the changes.

 

Basically I use the following function in my shortcuts lisp routine that loads in all the drawings:

 

(command "VBASTMT" "ThisDrawing.Close(FALSE/TRUE)")

 

Where FALSE or TRUE is used depending on whether I want to save the drawing or not.

 

To cut a short story shorter, I no longer have the VBA module installed on my computer and the shortcuts cause an alert to pop up directing to me to the download page for the VBA module. However I would still like to be able to use my shortcuts.

 

I tried :

(vlax-invoke-method (vla-get-activedocument (vlax-get-acad-object)) 'close :vlax-false)

and

(vla-close (vla-get-activedocument (vlax-get-acad-object)) :vlax-false)

 

But I get the following error:

 

; error: Automation Error. Drawing is busy.

 

Am I doing something wrong with the syntax, or is it simply not possible to do?

Link to comment
Share on other sites

(defun c:CloseWithoutSave ()
 (if (< 0 (getvar 'dbmod))
   (command "._close" "_y")
   (command "._close")
 )
 (princ)
)

(defun c:CloseWithSave ()
 (command "._qsave" "._close")
 (princ)
)

Link to comment
Share on other sites

Thanks, If I recall correctly the reason why I was using VBA in the first place was because I didn't need to check for changes to the drawing, but you have done that by checking the dbmod variable. However I'm still curious as to why the vlax/vla codes I tried using didn't work.

Link to comment
Share on other sites

You can also redefine the typed "Close" to what you want using something like Black box above. Even edit the CUI changing "Close" again to what you want maybe add the 2 versions "Close Y" "Close N".

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...