Jump to content

Recommended Posts

Posted

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

Posted

This would help you with it .

 

(defun c:TesT ()
 (command "_.close" "_Y")
  (princ)
)

 

Tharwat

  • Like 1
Posted

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.

Posted

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 :?

Posted

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

Posted

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 :o:?

Posted

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

  • 11 years later...
Posted
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.

Posted

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!

Posted

I call it the "exit quietly" with out going down some technical path.

Posted
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".🤣

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...