Author Topic: lisp on command line?  (Read 3165 times)

0 Members and 1 Guest are viewing this topic.

mohobrien

  • Guest
lisp on command line?
« on: August 22, 2005, 01:06:23 PM »
I'm trying to loop through a series of queries in A2Kmap and am having a problem with one of the loops. The problem is a lisp problem, nothing to do with map so that's why it's here. I'm reading a series of text files, each of which is a lisp function. I want to read the file and then run it.
Code: [Select]
   
....
    (ade_qryclear)
    (ade_qrysettype "draw")
    (qryd)
    (command(eval qtrun))
    (ade_qrydefine
      '("AND"
""
""
"Property"
("layer" "=" "Lake,MarshLine,River")
""
       )
    )
....
and the qryd routine is
Code: [Select]
(defun qryd (/ byline fn)
  (setq
    fn (open (strcat "c:\\Drawings\\querytest\\" query_to_run ".qry")
    "r"
       )
  )
  (setq qtrun "")
  (while (setq byline (read-line fn))
    (setq qtrun
  (strcat
    qtrun
    byline
  )
    )
  )
  (close fn)
  qtrun
)
This is the error message
(ade_qrydefine '("" "" "" "Location" ("polyline" "polygon" "crossing"  
1 (0 0 1) 0.000000 (562958 6.23358e+006 0) 0.000000 (563171 6.22527e+006 0)
0.000000 (571373 6.22485e+006 0) 0.000000 (571799 6.23241e+006 0))"")) LISP
command is not available. :cry:Any suggestions?

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
lisp on command line?
« Reply #1 on: August 22, 2005, 01:11:29 PM »
Never saw any functions like those in Lisp  .. are they a subset of lisp commands defined locally? From the error it appears as though they are not loaded.
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

LE

  • Guest
Re: lisp on command line?
« Reply #2 on: August 22, 2005, 01:21:50 PM »
Quote from: mohobrien

  (command(eval qtrun))


No good.....

I think we need more input....

mohobrien

  • Guest
lisp on command line?
« Reply #3 on: August 22, 2005, 01:22:52 PM »
ade_qrydefine is a function in the map api. The functions are working fine if typed in the lisp. What I want to do is dynamically (is that a word?) change the routine by evaluating the contents of a text file.
The contents of qtrun are like this: (ade_qrydefine '("" "" "" "Location" ("polyline" "polygon" "crossing"  1 (0 0 1) 0.000000 (562958 6.23358e+006 0) 0.000000 (563171 6.22527e+006 0) 0.000000 (571373 6.22485e+006 0) 0.000000 (571799 6.23241e+006 0))""))
If typed into the lisp, it runs fine. I'm trying to find how to evaluate the contents of the text file.

Jeff_M

  • King Gator
  • Posts: 4098
  • C3D user & customizer
lisp on command line?
« Reply #4 on: August 22, 2005, 02:08:20 PM »
Does this help?
Code: [Select]

(setq test "(command \"line\" pause pause \"\")")
(eval (read test))

This works, so I think you just need to replace:
(command(eval qtrun))
with:
(eval (read qtrun))

mohobrien

  • Guest
lisp on command line?
« Reply #5 on: August 22, 2005, 04:29:22 PM »
Thank you all. Yes Jeff that worked perfectly. :D