JamCAD Posted March 4, 2014 Posted March 4, 2014 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? Quote
BlackBox Posted March 4, 2014 Posted March 4, 2014 (defun c:CloseWithoutSave () (if (< 0 (getvar 'dbmod)) (command "._close" "_y") (command "._close") ) (princ) ) (defun c:CloseWithSave () (command "._qsave" "._close") (princ) ) Quote
JamCAD Posted March 5, 2014 Author Posted March 5, 2014 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. Quote
BIGAL Posted March 6, 2014 Posted March 6, 2014 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". Quote
Recommended Posts
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.