Newlines in log file

Results 1 to 15 of 15

Thread: Newlines in log file

  1. #1
    Member kstrauss's Avatar
    Join Date
    Apr 2013
    Location
    Canada
    Posts
    1788
    Downloads
    0
    Uploads
    0

    Default Newlines in log file

    If I create a log file using a comment like "(LOGOPEN,probe-results.ngc)" and write to the file using "(LOG #<_theValue>)" I don't get any newlines in the file. Including "\n" results in "\n" being written to the file. How can I get each line separated by newline or carriage return or linefeed?

    Similar Threads:


  2. #2
    Member vmax549's Avatar
    Join Date
    Oct 2005
    Location
    Lady Lake
    Posts
    1145
    Downloads
    3
    Uploads
    0

    Default Re: Newlines in log file

    5.2.16 Logging
    • (LOGOPEN,filename.txt) - opens the named log file. If the file already exists, it is truncated.
    • (LOGAPPEND,filename) - opens the named log file. If the file already exists, the data is appended.
    • (LOGCLOSE) - closes an open log file.
    • (LOG,) - everything past the , is written to the log file if it is open. Supports expansion of parameters as described below.
    Examples of logging are in nc_files/examples/smartprobe.ngc and in nc_files/ngcgui_lib/rectange_probe.ngc sample G code files.

    (;-) TP



  3. #3
    Member kstrauss's Avatar
    Join Date
    Apr 2013
    Location
    Canada
    Posts
    1788
    Downloads
    0
    Uploads
    0

    Default Re: Newlines in log file

    Yes, I found that in the LinuxCNC docs. LOGOPEN/LOG/LOGCLOSE work as expected but how do I get LOG to write *LINES* ending with carriage return, linefeed or newline? Where are the referenced sample files found?



  4. #4
    Member vmax549's Avatar
    Join Date
    Oct 2005
    Location
    Lady Lake
    Posts
    1145
    Downloads
    3
    Uploads
    0

    Default Re: Newlines in log file

    you do not need /n or carrage return for example

    (logopen,Test1.txt) opens Test1.txt for writing

    (log, 123.123 234.234 345.345) Write that line to the open file. It appends each line to the file
    (log, Testing123) Write teh next line to the file
    (log, #<newData> )
    etc
    etc
    (logClose) Closes file

    IF teh file already exists you Reopen it as append file to continue writing to an existing file.

    (logAppend,Test123.txt) Opens teh Test123.txt file for appending(adding) to that file

    (log, #1)
    (log, #2)
    (log, #3)
    etc
    etc

    Hope that helps. (;-) TP



  5. #5

    Default Re: Newlines in log file

    Older versions of PathPilot supported the log comment functionality, but the resulting log file was created in a folder on the controllers internal drive that was impossible to view or manipulate using the PathPilot file tab.

    Forget which version, but recent versions of PathPilot 2.x now place the resulting log file in the gcode folder by default. They even support relative folders. If you manually create a folder named 'mycustomlogs' in the gcode folder, use a relative path in the logopen statement like this - (logopen, mycustomlogs/log.txt) to create the file there.



  6. #6
    Member kstrauss's Avatar
    Join Date
    Apr 2013
    Location
    Canada
    Posts
    1788
    Downloads
    0
    Uploads
    0

    Default Re: Newlines in log file

    Thanks for the help but obviously I'm not explaining my problem very well!

    1) LOGOPEN, LOG and LOGCLOSE work as expected. I can easily create the log file.

    2) I can give the log file my chosen name. I can locate the log file and access it over my network.

    3) I can write the values of variables to the log file.

    My problem is that the file is just a string of bytes. Without newline/carriage return/linefeed it is a pain to use the log file in Excel. (If anyone cares, my goal is to analyze and eventually compensate for probing errors that result from stylus flex and the lobe behaviour of the kinematic structure of a Renishaw style probe.)

    How do I easily generate a log file that contains proper lines?



  7. #7
    Member vmax549's Avatar
    Join Date
    Oct 2005
    Location
    Lady Lake
    Posts
    1145
    Downloads
    3
    Uploads
    0

    Default Re: Newlines in log file

    When I look at a file here it is a series of lines of values not a string of bytes. Can you post your file here so we can see what it looks like.

    (;-) TP



  8. #8
    Member
    Join Date
    Dec 2008
    Location
    Switzerland
    Posts
    740
    Downloads
    0
    Uploads
    0

    Default Re: Newlines in log file

    Quote Originally Posted by kstrauss View Post
    Thanks for the help but obviously I'm not explaining my problem very well!

    1) LOGOPEN, LOG and LOGCLOSE work as expected. I can easily create the log file.

    2) I can give the log file my chosen name. I can locate the log file and access it over my network.

    3) I can write the values of variables to the log file.

    My problem is that the file is just a string of bytes. Without newline/carriage return/linefeed it is a pain to use the log file in Excel. (If anyone cares, my goal is to analyze and eventually compensate for probing errors that result from stylus flex and the lobe behaviour of the kinematic structure of a Renishaw style probe.)

    How do I easily generate a log file that contains proper lines?
    Of course we care I'm planning on doing something similar in the not too distant future.
    I just tried a sample routine with V2.2.2 and v2.2.4 and they both produced one line of text for each (LOG, xxxx) in the g-code. If multiple values are included in a single log entry: (LOG, #<_value1> #<_value2>) they appear in the same line in the text output (is what you're doing perhaps?). This could be comma separated with a ',' between the values: (LOG, #<_value1>, #<_value2>) or simply separated into individual g-code lines for each value.
    My tests gave me the results I was expecting. Perhaps you're doing something different? In which case the code might help.
    Step



  9. #9
    Member kstrauss's Avatar
    Join Date
    Apr 2013
    Location
    Canada
    Posts
    1788
    Downloads
    0
    Uploads
    0

    Default Re: Newlines in log file

    I'm delighted that you care <G>. Please see my code below. I'll have to visit the shop to confirm but I'm pretty sure that I'm on the latest (2.2.4?). I get very long lines in the log file but with the desired data.


    ( The plan is to probe from the centre to the rim of a ball bearing race )

    (Configuration section)
    G20 (Inches)
    F20 (probe speed)
    G90 (absolute mode)

    #<_maxMove> = 2 ; probe move <= 2 inch
    #<_angles> = 360 ; number of samples
    #<_angleIncr> = [360/#<_angles>]
    #<_angle> = 0

    g0 Z0
    (LOGOPEN,probe-results.ngc)
    o10 repeat [ #<_angles> ]
    g0 X0 Y0

    g38.2 @#<_maxMove> ^#<_angle>

    (LOG,#<_angle>, #<_X>, #<_Y>\n)
    #<_angle> = [#<_angle> + #<_angleIncr>]

    o10 endrepeat

    (LOGCLOSE)
    G0 x0 y0
    G30



  10. #10
    Member vmax549's Avatar
    Join Date
    Oct 2005
    Location
    Lady Lake
    Posts
    1145
    Downloads
    3
    Uploads
    0

    Default Re: Newlines in log file

    Can you post your saved points file. ??

    (;-) TP



  11. #11
    Member kstrauss's Avatar
    Join Date
    Apr 2013
    Location
    Canada
    Posts
    1788
    Downloads
    0
    Uploads
    0

    Default Re: Newlines in log file

    It appears that I am mistaken. Rather than the Microsoft standard of ending lines with carriage return + linefeed, the log file lines have only a linefeed. This causes many Microsoft programs to treat the entire file as a single line. I apologize for my confusion.

    Testing with the Tormach passive probe shows a relatively small effect due to the lobes. If there is any interest I'll post some actual results soon.



  12. #12
    Member vmax549's Avatar
    Join Date
    Oct 2005
    Location
    Lady Lake
    Posts
    1145
    Downloads
    3
    Uploads
    0

    Default Re: Newlines in log file

    (;-) I have been caught by that several times. Sometime people save Gcode files in an odd format unknowningly and then a Gcode file is a long string of bytes. Then PP just says HUH ???

    Are you collecting points from axis positions or the trip point values as a #var . The #var method is always teh best approach as it is least effected by probing speed.

    (;-) TP



  13. #13
    Member kstrauss's Avatar
    Join Date
    Apr 2013
    Location
    Canada
    Posts
    1788
    Downloads
    0
    Uploads
    0

    Default Re: Newlines in log file

    The program posted uses #<_X> and #<_Y>. I haven't yet compared the values in those variables with the values in #5061 and #5062. Will they differ?



  14. #14
    Member vmax549's Avatar
    Join Date
    Oct 2005
    Location
    Lady Lake
    Posts
    1145
    Downloads
    3
    Uploads
    0

    Default Re: Newlines in log file

    Yes they do differ . The trip point values are teh most reliable and are LEAST effected by probing feedrate . IF teh values you are using are axis positions then they are effected by feedrate as teh machine has to come to a stop and the distance to stop is reflected in teh axis stopped position. Where as the trip points are recorded before the deacceleration occurs.

    (;-) TP



  15. #15
    Member kstrauss's Avatar
    Join Date
    Apr 2013
    Location
    Canada
    Posts
    1788
    Downloads
    0
    Uploads
    0

    Default Re: Newlines in log file

    Thanks! I'll change to using #5061 and #5062.



Tags for this Thread

Posting Permissions

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


About CNCzone.com

    We are the largest and most active discussion forum for manufacturing industry. The site is 100% free to join and use, so join today!

Follow us on


Our Brands

Newlines in log file

Newlines in log file