506,330 active members
2,501 visitors online
Register for free
Login
Page 1 of 2 12
Results 1 to 12 of 15
  1. #1
    Junior Member
    Join Date
    Apr 2013
    Posts
    1439

    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?

  2. #2
    Registered
    Join Date
    Oct 2005
    Posts
    799

    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
    Junior Member
    Join Date
    Apr 2013
    Posts
    1439

    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
    Registered
    Join Date
    Oct 2005
    Posts
    799

    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
    Registered
    Join Date
    Jul 2017
    Posts
    45

    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
    Junior Member
    Join Date
    Apr 2013
    Posts
    1439

    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
    Registered
    Join Date
    Oct 2005
    Posts
    799

    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
    Registered
    Join Date
    Dec 2008
    Posts
    627

    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
    Junior Member
    Join Date
    Apr 2013
    Posts
    1439

    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
    Registered
    Join Date
    Oct 2005
    Posts
    799

    Re: Newlines in log file

    Can you post your saved points file. ??

    (;-) TP

  11. #11
    Junior Member
    Join Date
    Apr 2013
    Posts
    1439

    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
    Registered
    Join Date
    Oct 2005
    Posts
    799

    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

Page 1 of 2 12

Similar Threads

  1. How to Merge Init file with external buttons file.
    By amitkumar171 in forum Dynomotion/Kflop/Kanalog
    Replies: 5
    Last Post: 11-19-2017, 07:14 PM
  2. Windows x64 text file splitter that goes by lines, not file size?
    By Galane in forum Uncategorised CAM Discussion
    Replies: 0
    Last Post: 04-06-2015, 12:26 AM
  3. How do you convert STL file from 3D printer to G-code or a CNC desktop mill file
    By imperial90303 in forum Uncategorised CAM Discussion
    Replies: 4
    Last Post: 01-25-2015, 08:37 PM
  4. using a data file for both 3D printer and CNC router , Converting file or ???
    By imperial90303 in forum Uncategorised CAM Discussion
    Replies: 2
    Last Post: 12-17-2014, 01:32 AM

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
  •