LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 03-09-2010, 05:15 PM   #1
gary_in_springhill
Member
 
Registered: Mar 2008
Posts: 136

Rep: Reputation: 21
pyqt3 readline question


I have a text file with most lines that resemble:

#1003 = 0.0139 ( X points to inches scale factor =1/72 )
#1004 = 0.0139 ( Y points to inches scale factor =1/72 )
M3 S15000 ( spindle cw at 15000rpm )
G4 P2 ( let spindle get to speed )
M7 ( mist coolant on )
G01 Z#1000 F#1001

G00 Z#1000
G00 X[#1003*300.133] Y[#1004*2343.29]
G01 Z#1002
G01 X[#1003*300.188] Y[#1004*2343.29]
G01 X[#1003*300.246] Y[#1004*2343.29]
G01 X[#1003*300.246] Y[#1004*2343.29]
G01 X[#1003*300.246] Y[#1004*2343.29]
G01 X[#1003*301.453] Y[#1004*2343.29]
G01 X[#1003*302.641] Y[#1004*2343.26]
G01 X[#1003*303.855] Y[#1004*2343.22]
G01 X[#1003*305.043] Y[#1004*2343.15]
G01 X[#1003*306.227] Y[#1004*2343.1]

What I need to do is read each line one at a time and IF the line starts with a "G0" it gets read otherwise it's skipped and in the line it reads eg:G01 X[#1003*300.188] Y[#1004*2343.29] would take 1003*300.188 (from the X) send it to LCDNumber55.display and 1004*2343.29 send it to LCDNumber56.display and then same for "Z" value to LCDNumber57.display same process for all three variables on each line even if "Z" is missing. If the readout is to fast can I put an adjustable time variable between each readline to slow it down?

Thanks
 
Old 03-09-2010, 05:43 PM   #2
gary_in_springhill
Member
 
Registered: Mar 2008
Posts: 136

Original Poster
Rep: Reputation: 21
revision

I was thinking that to be inline with other gcode layouts that all three coordinates may not appear on the same line the one factor that is always consistent is the Xinterger Yinteger Zinteger so it would be better to readline a line and send the integer that follows X to lcdnumberdisplay and the same for the other Y and Z integers even if they appear on a line that does not start with the "G0".so the trigger would be X integer and a white space to end the trigger and same for Y and Z.
 
Old 03-09-2010, 05:49 PM   #3
gary_in_springhill
Member
 
Registered: Mar 2008
Posts: 136

Original Poster
Rep: Reputation: 21
second file example

Here is a sample of another file layout to go with the above :


F200.0
S1000.0
G00 Z6.0000
X-6.5000 Y-5.2000
G01 Z4.2000
X6.5000
G00 Z6.0000
Y-4.3000
G01 Z4.2000
X-6.5000
G00 Z6.0000
Y-3.4000
G01 Z4.2000
X6.5000
G00 Z6.0000
Y-2.5000

So as you can see it's more universal to grab the integer after the X and send it to the lcd display and so on for Y and Z if the actual XYZ are used as the trigger start point.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] math question for Qspinbox in pyqt3 gary_in_springhill Programming 5 02-07-2010 07:49 PM
[SOLVED] pyqt3 in slackware 13 Quercus ruber Slackware 8 01-12-2010 02:16 PM
Using cat readline within cat readline while loop demxkn66 Programming 5 12-16-2007 05:10 PM
readline compile feetyouwell Programming 1 10-06-2004 06:01 PM
Question about Readline Library sasha_baranov Programming 0 08-23-2004 03:39 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:02 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration