Results 1 to 6 of 6

Thread: Where have I gone astray?

  1. #1
    I could stop if I wanted to
    Join Date
    2004-11
    Location
    Somewhere close to hell
    Posts
    228
    Login to Give a bone
    0

    Unhappy Where have I gone astray?

    Just a quick rundown:
    I am trying to put together a routine that will query GIS data specified in existing query file and then wblock data out using the same name as query file.

    My problem arises when the routine returns "bad argument type: stringp nil
    and stops at (read-line dir).
    Anyone have an idea of where I'm going wrong here?

    Code:
    (defun c:gns ()
       (setvar "filedia" 0)
       (setvar "cmddia" 0)
       (setq worms "C:\\temp\\ldd\\")
       (command "sh"
     	   (strcat "dir " worms "*.QRY /b >" worms "Queryfiles.txt")
       )
       (setq dir (open (strcat worms "Queryfiles.txt") "r"))
       (while (/= (setq filenm (substr (read-line dir) 1 6)) nil)
     	(setq fish (car (list filenm)))
     	(setq net (cons fish net))
     	(setq handl (reverse net))
       )
       (foreach ent handl
     	(command "_aderunxquery" ent "")
     	(command ".zoom" "E")
     	(command "-wblock"
     		 (strcat "C:\\RAD\\CC_GIS\\CC_Atlas\\" ent)
     		 ""
     		 "0,0"
     		 "ALL"
     		 ""
     	)
       )
       (close dir)
       (setvar "filedia" 1)
       (setvar "cmddia" 1)
       (princ)
     )
    Last edited by Mike.Perry; 2005-07-29 at 09:55 PM. Reason: [CODE] tags added.

  2. #2
    AUGI Addict madcadder's Avatar
    Join Date
    2000-11
    Location
    Too far from the beach
    Posts
    1,054
    Login to Give a bone
    0

    Default Re: Where have I gone astray?

    Off the top of my head I see a few things that should bomb on ya.
    Here's a file that does something sim to what you are looking to do.

    Working with shell commands and ascii code is a little tricky; this should show you how to get the character codes all working correctly together and how to string the commands.

    Let me know if you have any questions about the code. Should be around this weekend some; have work to do from home and you know you can't draw pretty lines without augi in the background.
    Attached Files Attached Files

  3. #3
    I could stop if I wanted to
    Join Date
    2002-02
    Location
    Kansas
    Posts
    487
    Login to Give a bone
    0

    Default Re: Where have I gone astray?

    Code:
     (while (/= (setq filenm (substr (read-line dir) 1 6)) nil)
    When dir is at end of file (read-line dir) return nill and the function subsrt will error

    change code so it check for end of file be for the subsrt funtion
    Code:
    (while (/= (setq mydata (read-line dir)) nil)
    	   (setq filenm (substr mydata 1 6))
    	   (setq fish (car (list filenm)))
    	   (setq net (cons fish net))
    	   (setq handl (reverse net))
    )
    Last edited by jwanstaett; 2005-07-30 at 03:37 AM.

  4. #4
    I could stop if I wanted to
    Join Date
    2004-11
    Location
    Somewhere close to hell
    Posts
    228
    Login to Give a bone
    0

    Default Re: Where have I gone astray?

    Thanx for the help!

    Next Problem:
    I have 67 query files in my list and need to run several commands _aderunxquery, zoom extents & Wblock all.
    The problem arises when I apply these commands to each member of the list it steps through the list so fast that it tries to query all 67 files without processing the other two commands.

    It bypasses the zoom e & Wblock completely.

    Anyone have an idea on how to get map to complete the query, zoom e, wblock all and then step to the next item in the list?

    Thanx

  5. #5
    AUGI Addict madcadder's Avatar
    Join Date
    2000-11
    Location
    Too far from the beach
    Posts
    1,054
    Login to Give a bone
    0

    Default Re: Where have I gone astray?

    got any updated code to look at?

  6. #6
    I could stop if I wanted to
    Join Date
    2004-11
    Location
    Somewhere close to hell
    Posts
    228
    Login to Give a bone
    0

    Default Re: Where have I gone astray?

    Duh yep!
    Sorry about that

    Code:
    (defun c:gns ()
      (setvar "filedia" 0)
      (setvar "cmddia" 0)
      (setq worms "C:\\temp\\ldd\\")
      (vl-cmdf "sh"
    	   (strcat "dir " worms "*.QRY /b >" worms "Queryfiles.txt")
      )
      (setq dir (open (strcat worms "Queryfiles.txt") "r"))
      (while (setq tmp (read-line dir))
        (setq filenm (substr tmp 1 6))
        (setq fish (car (list filenm)))
        (setq net (cons fish net))
        (setq handl (reverse net))
        (setq len (length handl))
        (setq count 0)
      )
      (if (/= len 0)
        (progn (setq x (nth count handl))
    	   (abc)
    	   (setq len (- len 1))
    	   (setq count (+ count 1))
        )
      )
      (close dir)
      (setvar "filedia" 1)
      (setvar "cmddia" 1)
      (princ)
    )
    
    
    
    (defun abc ()
      (vl-cmdf "_aderunxquery" x "")
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;how to delay until query finishes ???
      (vl-cmdf ".zoom" "E")
      (vl-cmdf "-wblock"
    	   (strcat "C:\\RAD\\CC_GIS\\CC_Atlas\\" x)
    	   ""
    	   "0,0"
    	   "ALL"
    	   ""
      )
    )
    Last edited by Glenn Pope; 2005-08-02 at 06:37 PM. Reason: Placed code in code tag

Similar Threads

  1. Multiline Attribute Goes Astray
    By dhallett in forum ACA General
    Replies: 2
    Last Post: 2009-10-07, 04:01 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •