TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: A_LOTA_NOTA on August 17, 2007, 09:44:00 AM
-
Is it possible to call the “SAVEAS” dialogue?
I’ve got a situation where I want to get the drawing name. So I want to test to make sure the drawing has been saved first. If not I would like to “SAVEAS” then get the drawing name.
Thanks
-
(getvar "DWGTITLED")
If it = 0, the drawing hasn't been saved yet.
It if = 1, the drawing has already been saved.
-
(getvar "DWGTITLED")
If it = 0, the drawing hasn't been saved yet.
It if = 1, the drawing has already been saved.
Thanks Matt but I knew that much. What I'm having a problem with it the "SAVEAS" part. If I just do a "Command SAVEAS" the user is not given a dialog box. I would like the "SAVEAS" dialog box to be displayed!
-
Look at (setvar 'filedia 1)
-
Look at (setvar 'filedia 1)
It's set to 1!
-
So what exactly is happening when the user does a SAVEAS?
-
So what exactly is happening when the user does a SAVEAS?
If I click on "File" then "SAVEAS" everything works fine! But if I add (command ".SAVEAS") to my code it doesn't give a dialog box. So I thought I must be coding it wrong.
-
Is filedia set to 0 somewhere in your code prior to the saveas?
-
No, I can have
(defun c:TEST ()
(setvar 'filedia 1)
(command ".SAVEAS")
)
& I still get the command line version!
-
Try
(defun c:TEST ()
(initdia)
(command ".SAVEAS")
)
-
Try
(defun c:TEST ()
(initdia)
(command ".SAVEAS")
)
That did it!! Thanks everyone!!!!
-
No, I can have
(defun c:TEST ()
(setvar 'filedia 1)
(command ".SAVEAS")
)
& I still get the command line version!
Part of the problem is with the second line of code...
(setvar 'filedia 1) should be (setvar "filedia" 1)
Notice the quotes. . . . . . . . . . . . .^ ^ ^
-
No, I can have
(defun c:TEST ()
(setvar 'filedia 1)
(command ".SAVEAS")
)
& I still get the command line version!
Part of the problem is with the second line of code...
(setvar 'filedia 1) should be (setvar "filedia" 1)
Notice the quotes. . . . . . . . . . . . .^ ^ ^
Try it my way, I think you will get the same results!
Willie fixed my problem.
-
No, I can have
(defun c:TEST ()
(setvar 'filedia 1)
(command ".SAVEAS")
)
& I still get the command line version!
Part of the problem is with the second line of code...
(setvar 'filedia 1) should be (setvar "filedia" 1)
Notice the quotes. . . . . . . . . . . . .^ ^ ^
Try it my way, I think you will get the same results!
Willie fixed my problem.
Huh... no $*#%. I never knew that nor have I ever seen it done that way (until today).
Cool.
-
No, I can have
(defun c:TEST ()
(setvar 'filedia 1)
(command ".SAVEAS")
)
& I still get the command line version!
Part of the problem is with the second line of code...
(setvar 'filedia 1) should be (setvar "filedia" 1)
Notice the quotes. . . . . . . . . . . . .^ ^ ^
Try it my way, I think you will get the same results!
Willie fixed my problem.
Huh... no $*#%. I never knew that nor have I ever seen it done that way (until today).
Cool.
Only saves one key stroke but I like it better!
-
Try
(defun c:TEST ()
(initdia)
(command ".SAVEAS")
)
This worked good for "SAVEAS" but now I have the same problem when closing a drawing. If I type close at the command line I get the dialog asking if I want to save changes. But if I use Close in a lisp it prompts me to save at te command line.
-
the mechanism is the same for the save/saveas dialogs
-
the mechanism is the same for the save/saveas dialogs
So may be I need to run some sort of test to see if the drawing needs to be saved before closing it?
-
Have a look at the DBMOD system variable.
-
Have a look at the DBMOD system variable.
Thank you! Looks like that will work!
added: After more thought I shouldn't need to do any testing. If I tell AutoCAD I want to close a drawing it does the testing for me. But I don't get the "Save Changes Yes No Cancel" dialog.
-
You should also look at at the DWGTITLED variable
-
You should also look at at the DWGTITLED variable
I have that one in my code & everything works great. But I had to make my own DCL for the "Do you want to save changes". But I shouldn't have to do that! AutoCAD knows the changes have been made & prompts me to save. But it does it at the command line, not with the DCL like it would if I typed "Close" at the command prompt.
-
added: ... But I don't get the "Save Changes Yes No Cancel" dialog.
Have a look at the initdia Help .. some commands do not make use of it.
reading the help now, I note that .SaveAs is not mentioned, so it's usage IS a bonus. ;-)
-
Kerry,
I just learned about "Initdia" at the beginning of this thread. When I had the same problem with "SAVEAS" as I'm having with "CLOSE". It fixed the saveas problem but doesn't seam to change close.
I have looked in the help file for '06 & '08. Didn't find it in either one.
-
If I use the following code I just get prompted at the command line to save the drawing.
(defun c:TEST ()
(initdia)
(command ".Close" puase)
)
-
I'm interested (from a design perspective) why you or your users would not be happy with the default command line Prompt.
-
I'm interested (from a design perspective) why you or your users would not be happy with the default command line Prompt.
It would work fine. But if I type "Close" at the command prompt or click "file" then "exit", AutoCAD gives a dialog asking if I would like to save changes. So in trying to make my program act like a standard AutoCAD command.
Just picky I guess.....
-
If I use the following code I just get prompted at the command line to save the drawing.
(defun c:TEST ()
(initdia)
(command ".Close" puase)
)
I haven't tested, I'll leave that to you, but I don't believe you need the 'pause ...
-
If I use the following code I just get prompted at the command line to save the drawing.
(defun c:TEST ()
(initdia)
(command ".Close" puase)
)
I haven't tested, I'll leave that to you, but I don't believe you need the 'pause ...
No, the pause is not need. I was posting the code more for the fact that I tried INITDIA and it doesn't change anything. And so someone could see a part of what I was trying to do & could may be point out why I don't get the dialog box like I do if entering "close" at the comand prompt.
-
Got it!!
(defun c:TEST1 ()
(vla-sendcommand
(vla-get-activedocument (vlax-get-acad-object))
".close ")
)