Visual LISP, AutoLISP and General Customization

Reply
*Patterson, Dwain
Message 1 of 8 (215 Views)

Qsave routine

215 Views, 7 Replies
03-17-2000 10:42 AM
I'm having a problem with a redefined command (qsave) running a lisp
routine. The lisp routine works but not in the order it is supposed to.
It is supposed to run the lisp routine then save the drawing, instead it
saves first then inserts the date stamp. The redefined qsave looks like
this:

(defun c:qsave (/ a)
(initget "Yes No")
(setq a (getkword "\nInsert Date Stamp? (y, n): "))
(if (= a "Yes")
(c:timestamp)
)
(command ".qsave")
(princ)
)

Then I get this:

Command: _qsave
Insert Date Stamp? (y, n): y
.qsave
Requires numeric distance, second point, or option keyword.
error: Function cancelled
(COMMAND ".qsave")
(C:QSAVE)

Any ideas?
*Fretty, Mark E.
Message 2 of 8 (215 Views)

Re: Qsave routine

03-17-2000 11:54 AM in reply to: *Patterson, Dwain
Dwain,

Try the attached updated TIMESTAMP.lsp I added the suppression of the
attribute prompts via the system variable ATTREQ. I also got rid of the
scaling of the block as that can be accomplished in the insert command
itself. I have the TIMESTAMP block scale up according to the DIMSCALE (also
a drawing variable) of the drawing itself.

Hope it helps,
Mark

Dwain Patterson wrote in message
news:38D27CAA.88704255@mcw-ers.com...
> I'm having a problem with a redefined command (qsave) running a lisp
> routine. The lisp routine works but not in the order it is supposed to.
> It is supposed to run the lisp routine then save the drawing, instead it
> saves first then inserts the date stamp. The redefined qsave looks like
> this:
>
> (defun c:qsave (/ a)
> (initget "Yes No")
> (setq a (getkword "\nInsert Date Stamp? (y, n): "))
> (if (= a "Yes")
> (c:timestamp)
> )
> (command ".qsave")
> (princ)
> )
>
> Then I get this:
>
> Command: _qsave
> Insert Date Stamp? (y, n): y
> .qsave
> Requires numeric distance, second point, or option keyword.
> error: Function cancelled
> (COMMAND ".qsave")
> (C:QSAVE)
>
> Any ideas?
>
>
>
>
*Griffin, Jerry
Message 3 of 8 (215 Views)

Re: Qsave routine

03-17-2000 12:13 PM in reply to: *Patterson, Dwain
You might try this (I thought I posted this before but it looks like it
didn't post - sorry if it's repeat info..)

(defun c:qsave (/ a)
(setq a (getstring "\nInsert Date Stamp? (y, n): "))

(while (/= nil a)
(progn
(if (= (strcase a) "Y") (progn
(c:timestamp)
(setq a nil)
))
(if (/= nil a)
(and
(= (strcase a) "N")
(setq a nil)
))
(if (/= nil a) (setq a (getstring "\n(y, n) Only Please: ")))
)
)
(command ".qsave")
(princ)
)

Dwain Patterson wrote in message
news:38D27CAA.88704255@mcw-ers.com...
> I'm having a problem with a redefined command (qsave) running a lisp
> routine. The lisp routine works but not in the order it is supposed to.
> It is supposed to run the lisp routine then save the drawing, instead it
> saves first then inserts the date stamp. The redefined qsave looks like
> this:
>
> (defun c:qsave (/ a)
> (initget "Yes No")
> (setq a (getkword "\nInsert Date Stamp? (y, n): "))
> (if (= a "Yes")
> (c:timestamp)
> )
> (command ".qsave")
> (princ)
> )
>
> Then I get this:
>
> Command: _qsave
> Insert Date Stamp? (y, n): y
> .qsave
> Requires numeric distance, second point, or option keyword.
> error: Function cancelled
> (COMMAND ".qsave")
> (C:QSAVE)
>
> Any ideas?
>
>
>
>
*Griffin, Jerry
Message 4 of 8 (215 Views)

Re: Qsave routine

03-17-2000 05:55 PM in reply to: *Patterson, Dwain
This should do it

Dwain Patterson wrote in message
news:38D27CAA.88704255@mcw-ers.com...
> I'm having a problem with a redefined command (qsave) running a lisp
> routine. The lisp routine works but not in the order it is supposed to.
> It is supposed to run the lisp routine then save the drawing, instead it
> saves first then inserts the date stamp. The redefined qsave looks like
> this:
>
> (defun c:qsave (/ a)
> (initget "Yes No")
> (setq a (getkword "\nInsert Date Stamp? (y, n): "))
> (if (= a "Yes")
> (c:timestamp)
> )
> (command ".qsave")
> (princ)
> )
>
> Then I get this:
>
> Command: _qsave
> Insert Date Stamp? (y, n): y
> .qsave
> Requires numeric distance, second point, or option keyword.
> error: Function cancelled
> (COMMAND ".qsave")
> (C:QSAVE)
>
> Any ideas?
>
>
>
>
*Fretty, Mark E.
Message 5 of 8 (215 Views)

Re:

03-20-2000 05:29 AM in reply to: *Patterson, Dwain
Jerry,

See Paul Turvill's version of QSAVE .lsp it works fine. Your's is way to
involved no need to go around the block when you can go directly from point
A to B.

Regards,
Mark

Jerry Griffin wrote in message
news:8aunfb$6u51@adesknews2.autodesk.com...
> This should do it
>
>
> Dwain Patterson wrote in message
> news:38D27CAA.88704255@mcw-ers.com...
> > I'm having a problem with a redefined command (qsave) running a lisp
> > routine. The lisp routine works but not in the order it is supposed to.
> > It is supposed to run the lisp routine then save the drawing, instead it
> > saves first then inserts the date stamp. The redefined qsave looks like
> > this:
> >
> > (defun c:qsave (/ a)
> > (initget "Yes No")
> > (setq a (getkword "\nInsert Date Stamp? (y, n): "))
> > (if (= a "Yes")
> > (c:timestamp)
> > )
> > (command ".qsave")
> > (princ)
> > )
> >
> > Then I get this:
> >
> > Command: _qsave
> > Insert Date Stamp? (y, n): y
> > .qsave
> > Requires numeric distance, second point, or option keyword.
> > error: Function cancelled
> > (COMMAND ".qsave")
> > (C:QSAVE)
> >
> > Any ideas?
> >
> >
> >
> >
>
>
>
*Griffin, Jerry
Message 6 of 8 (215 Views)

Re:

03-20-2000 06:38 AM in reply to: *Patterson, Dwain
Good point Mark. My initial attempt at running the routine failed and I
assumed it was in the qsave routine. Once the timestamp was corrected the
qsave worked just fine, but I never looked back.

Mark E. Fretty wrote in message
news:8b58qu$med3@adesknews2.autodesk.com...
> Jerry,
>
> See Paul Turvill's version of QSAVE .lsp it works fine. Your's is way to
> involved no need to go around the block when you can go directly from
point
> A to B.
>
> Regards,
> Mark
>
> Jerry Griffin wrote in message
> news:8aunfb$6u51@adesknews2.autodesk.com...
> > This should do it
> >
> >
> > Dwain Patterson wrote in message
> > news:38D27CAA.88704255@mcw-ers.com...
> > > I'm having a problem with a redefined command (qsave) running a lisp
> > > routine. The lisp routine works but not in the order it is supposed
to.
> > > It is supposed to run the lisp routine then save the drawing, instead
it
> > > saves first then inserts the date stamp. The redefined qsave looks
like
> > > this:
> > >
> > > (defun c:qsave (/ a)
> > > (initget "Yes No")
> > > (setq a (getkword "\nInsert Date Stamp? (y, n): "))
> > > (if (= a "Yes")
> > > (c:timestamp)
> > > )
> > > (command ".qsave")
> > > (princ)
> > > )
> > >
> > > Then I get this:
> > >
> > > Command: _qsave
> > > Insert Date Stamp? (y, n): y
> > > .qsave
> > > Requires numeric distance, second point, or option keyword.
> > > error: Function cancelled
> > > (COMMAND ".qsave")
> > > (C:QSAVE)
> > >
> > > Any ideas?
> > >
> > >
> > >
> > >
> >
> >
> >
>
>
Contributor
arul_kov
Posts: 11
Registered: ‎08-10-2012
Message 7 of 8 (151 Views)

qsave new filename

09-14-2012 01:02 AM in reply to: *Griffin, Jerry

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

Valued Mentor
gasty1001
Posts: 437
Registered: ‎04-11-2010
Message 8 of 8 (130 Views)

Re: qsave new filename

09-14-2012 08:49 AM in reply to: arul_kov

Hi,

 

Set FILEDIA to 0 (setvar "filedia" 0), and then save using (command ".save" newnumber)

 

Gaston Nunez

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community