Read-Line comand not working
CADForums.net Forum Index CADForums.net
Discussion of AutoCAD and other CAD software.
 
 FAQFAQ   MemberlistMemberlist     RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Google
 
Web cadforums.net
Read-Line comand not working

 
Post new topic   Reply to topic    CADForums.net Forum Index -> Customization
Author Message
mblangy
Guest





Posted: Thu Dec 23, 2004 11:36 pm    Post subject: Read-Line comand not working Reply with quote

I have identical lisp routines on two different machines - one works and the other does not. The READ-LINE command is returning nil where there is text...I am stumped.

Back to top
T.Willey
Guest





Posted: Thu Dec 23, 2004 11:39 pm    Post subject: Re: Read-Line comand not working Reply with quote

Is it finding the file on both machines?
Maybe posting the code will help, and the locations of both text files per each computer.

Tim
Back to top
mblangy
Guest





Posted: Thu Dec 23, 2004 11:45 pm    Post subject: Re: Read-Line comand not working Reply with quote

The source files are on the desktop in both cases. Excerpt from code:
(setq sf (open "sec.mpr" "r"))
(repeat 5 (read-line sf))
(setq minx (substr (read-line sf) 26))
It crashes when it gets to the substr command.

Back to top
T.Willey
Guest





Posted: Thu Dec 23, 2004 11:48 pm    Post subject: Re: Read-Line comand not working Reply with quote

From the computer that doesn't work do a
(findfile "sec.mpr")
and see what it returns.

Tim
Back to top
mblangy
Guest





Posted: Thu Dec 23, 2004 11:52 pm    Post subject: Re: Read-Line comand not working Reply with quote

The file that it should be reading is on the desktop. I have many more of these files in other directories as I have been using this code without problem for some time now which is what really drives me crazy.
Back to top
T.Willey
Guest





Posted: Thu Dec 23, 2004 11:55 pm    Post subject: Re: Read-Line comand not working Reply with quote

Try hard coding the path to the desktop then, and see it that works. Only thing I can think of is that it's not finding the right file so there is nothing to read.

Tim
Back to top
mblangy
Guest





Posted: Fri Dec 24, 2004 12:03 am    Post subject: Re: Read-Line comand not working Reply with quote

This is like a bad dream. Here is the new code:
(setq sf (open "C:\Documents and Settings\Administrator\Desktop\sec.mpr" "r"))
(repeat 5 (read-line sf))
(setq minx (substr (read-line sf) 26))

Here are the contents of C:\Documents and Settings\Administrator\Desktop\sec.mpr:

---------------- REGIONS ----------------

Area: 0.8421
Perimeter: 11.9980
Bounding box: X: 73.5967 -- 75.5087
Y: 136.7406 -- 140.0526
Centroid: X: 74.8405
Y: 138.2646
Moments of inertia: X: 16098.9422
Y: 4716.7731
Product of inertia: XY: 8713.8909
Radii of gyration: X: 138.2678
Y: 74.8419
Principal moments and X-Y directions about centroid:
I: 0.1220 along [0.2807 0.9598]
J: 0.8014 along [-0.9598 0.2807]

??????????????????? Thanks anyhow.
Back to top
T.Willey
Guest





Posted: Fri Dec 24, 2004 12:09 am    Post subject: Re: Read-Line comand not working Reply with quote

I cut/pasted what you had into a text file on my desktop, selected that file with getfiled. Your code seemed to work, but minx was set to "". Sorry can't duplicate your problem here.

Tim
Back to top
mblangy
Guest





Posted: Fri Dec 24, 2004 12:42 am    Post subject: Re: Read-Line comand not working Reply with quote

I modified the code to include all file extensions in file names and it seems to run fine now.
Back to top
mblangy
Guest





Posted: Fri Dec 24, 2004 12:42 am    Post subject: Re: Read-Line comand not working Reply with quote

Thanks and happy holidays.
Back to top
T.Willey
Guest





Posted: Fri Dec 24, 2004 12:47 am    Post subject: Re: Read-Line comand not working Reply with quote

I don't know what I did, but I'm glad you got it to work for you.

Happy Holidays.
Tim
Back to top
LUCAS
Guest





Posted: Fri Dec 24, 2004 12:06 pm    Post subject: Re: Read-Line comand not working Reply with quote

;;You must waiting!!
(defun WAIT (SECONDS / STOP)
;;
;; Posted by Tony Tanzillo
;; Creates a pause in your program flow
;; This function provides for much finer
;; increments in time then the command DELAY
;;
(setq STOP (+ (getvar "DATE") (/ SECONDS 86400.0)))
(while (> STOP (getvar "DATE"))
(princ)
)
)
(while (or (= (setq FILE (findfile "sec.mpr")) NIL)
(progn (setq FIB (open FILE "r"))
(setq NR (read-line FIB))
(close FIB)
(not NR)
)
)
(WAIT 0.01)
)

"T.Willey" <nospam@address.withheld> ¦b¶l¥ó
news:16313191.1103831260841.JavaMail.jive@jiveforum1.autodesk.com ¤¤¼¶¼g...
Quote:
I don't know what I did, but I'm glad you got it to work for you.

Happy Holidays.
Tim
Back to top
 
Post new topic   Reply to topic    CADForums.net Forum Index -> Customization All times are GMT
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum




Windows Server DSP VoIP Electronics New Topics
Powered by phpBB