Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

.qsave in lisp error

6 REPLIES 6
Reply
Message 1 of 7
captjones
1551 Views, 6 Replies

.qsave in lisp error

Hello,
I've created a custom redefined qsave lisp to run load with acaddoc in ACA09. I've noticed the scrip will work, however on the .qsave command (default undefined) will not open a dialog box... instead it only provides a command line prompt for filename. When .qsave is manually entered immediately after , it will open with dialog box as expected. This happens in all drawings. Filedia is set to 1. Would appreciate any ideas. Lisp below. Thanks!


(command "undefine" "qsave")

(defun c:qsave ()
(command "zoom" "e")
(command ".qsave")
(princ)
)
6 REPLIES 6
Message 2 of 7
ktuning
in reply to: captjones

Try this?

(command "undefine" "qsave")
(defun c:qsave ()
(command "zoom" "e")
(if (= 1 (getvar "dwgtitled"))
(command ".save" "") ;If already saved, just save it
(command ".save" "~") ;If new drawing, open dialog to save
)
(princ)
)
Message 3 of 7
captjones
in reply to: captjones

Great! Thanks!!!
Message 4 of 7
Kent1Cooper
in reply to: captjones

It should also work to simply add

(initdia)

just before the

(command ".qsave")

line.

--
Kent Cooper
Kent Cooper, AIA
Message 5 of 7
Kent1Cooper
in reply to: captjones

I don't think you want the Save command here! It creates a *separate drawing file* [like SaveAs, except that it leaves you in the drawing you're in, instead of taking you into the new one]. It does *not* update the current drawing file. But it still counts as a form of saving, so if you then get out of the drawing you're in, that drawing file will not be updated to the current state of things, because it won't ask whether you want to save your changes!

Be careful about the difference between Qsave and Save and SaveAs. The File pull-down menu's so-called but mis-named "Save" item, and the diskette icon in the standard Toolbar, and Ctrl-S, all perform a Qsave, *not* a Save command, and that's what you should use here. [In a drawing that hasn't been saved/named yet, they all do the same thing by reverting to SaveAs, but not otherwise.]

--
Kent Cooper


ktuning wrote...
....
(command ".save" "") ;If already saved, just save it
(command ".save" "~") ;If new drawing, open dialog to save
....
Kent Cooper, AIA
Message 6 of 7
arul_kov
in reply to: captjones

How can i set the new file name in the qsave window

 

My new file name is "newnumber" as per the below lisp

 

(command "undefine" "qsave")
(defun c:qsave ()
 
(setq num (car (entsel"\nSelect Existing File number:\n"  )))
 
(setq texl1 (vlax-ename->vla-object num))
(setq val1(vla-get-TextString texl1 ))

  (setq oldnumber1 (substr val1 3 6) )
  (setq newnumber (strcat "57" oldnumber1) )
  (Princ newnumber)

(command "zoom" "e")


 
(if (= 1 (getvar "dwgtitled"))

(command ".save" "") ;If already saved, just save it
(command ".save" "~" ) ;If new drawing, open dialog to save
)
(princ)
  )

Message 7 of 7
Kent1Cooper
in reply to: arul_kov


@arul_kov wrote:

How can i set the new file name in the qsave window

My new file name is "newnumber" as per the below lisp

....


Look at the (getfiled) function, with its 'default' argument.

Kent Cooper, AIA

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost