KrazyMann225 Posted May 13, 2011 Posted May 13, 2011 I wanted a command to close and not to save. I used the following code: (defun c:cln () ;Close No save (setvar "cmdecho" 0) (command "close" "No") (setvar "cmdecho" 1) ) But when I use it, it closes and saves.....help :S Quote
Tharwat Posted May 13, 2011 Posted May 13, 2011 This would help you with it . (defun c:TesT () (command "_.close" "_Y") (princ) ) Tharwat 1 Quote
KrazyMann225 Posted May 13, 2011 Author Posted May 13, 2011 wouldn't that close and save? I'm not doubting you but rather inquiring why it works like that. I'm very novice in my programming. Quote
KrazyMann225 Posted May 13, 2011 Author Posted May 13, 2011 I tried it and it works just like you said.....tho it does confuse me. The prompts after you type "close" are "save changes to etc....." "Yes" "No" "Cancel" one would think to not save you would reply No Quote
Tharwat Posted May 13, 2011 Posted May 13, 2011 To clarify the point , just from your lisp editor type (command "_.close") and load it directly and you will be prompted with a question Command: 'VLIDE _.close Really want to discard all changes to drawing? Really want to discard all changes to drawing? So when you type y , it means that you are certainly do not want to save , but if your answer is no , that means you do not want to leave the drawing without saving . Try it , it is easy . Tharwat Quote
KrazyMann225 Posted May 13, 2011 Author Posted May 13, 2011 hmmm very interesting! i have to use the visual lisp editor more, just for this sorta reason. I tend to use just notepad, but obviously that can lead to errors and mistake such as saving 15 drawings by accident....good thing i never changed anything in them Quote
Tharwat Posted May 13, 2011 Posted May 13, 2011 I recommend you to depend on the Visula lisp editor which is attached with Cad , that would help you a lot and much easier than notepad without a comparison at all . Good luck KrazyMann Tharwat Quote
MAzri Posted December 28, 2022 Posted December 28, 2022 On 13/05/2011 at 22:49, Tharwat said: This would help you with it . (defun c:TesT () (command "_.close" "_Y") (princ) ) Tharwat @Tharwat Sorry to revive old thread. Just want to ask a beginner question, what is the reason putting (princ) there? As far as i know, most of routine have this but I do not know why other than returning nil for this. Thank you. Quote
mhupp Posted December 28, 2022 Posted December 28, 2022 if princ wasn't there it would repeat the last output to the command line or in this case it would output nil. https://www.youtube.com/watch?v=nnkX7M0Hikk&t=57s 1 Quote
MAzri Posted December 28, 2022 Posted December 28, 2022 Oh i was mistaken. I thought the (princ) that return nil but the absence of (princ) that cause it. Many thanks for clearing that up for me! Quote
BIGAL Posted December 29, 2022 Posted December 29, 2022 I call it the "exit quietly" with out going down some technical path. Quote
MAzri Posted December 29, 2022 Posted December 29, 2022 38 minutes ago, BIGAL said: I call it the "exit quietly" with out going down some technical path. I use Tharwat code above using QQ command for "quit quietly". 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.