UCCNC sometimes does not read program (comments)

If you think you've found a bug post it here.

UCCNC sometimes does not read program (comments)

Postby Rilexer » Thu Nov 10, 2022 8:05 pm

Hi
I'm trying to build 3d printer out of CNC mill, but when I load gcode generated with Prusa Slicer or Cura it cannot load a file on the comment line.

I'm getting an "Error reading line number 21 Line: ;TYPE:Custom ", but It's not even command. I get the same results for "; Skirt/Brim"
Is there a way to make it ignore all comments? It also doesn't color all of the letters in the previous.

I would be grateful for a quick response.

SM
Attachments
Zrzut ekranu 2022-11-10 210153.png
Rilexer
 
Posts: 2
Joined: Thu Nov 10, 2022 7:46 pm

Re: UCCNC sometimes does not read program (comments)

Postby dezsoe » Fri Nov 11, 2022 1:42 pm

Yes, because the comments have to be in brackets (). The semicolon ; is not part of the g-code standard and UCCNC does not use it. (Google RS274NGC for the standard.)

Printable characters and white space inside parentheses is a comment. A left parenthesis always
starts a comment. The comment ends at the first right parenthesis found thereafter. Once a left
parenthesis is placed on a line, a matching right parenthesis must appear before the end of the line.
Comments may not be nested; it is an error if a left parenthesis is found after the start of a
comment and before the end of the comment. Here is an example of a line containing a comment:
“G80 M5 (stop motion)”. Comments do not cause a machining center to do anything.
dezsoe
 
Posts: 2093
Joined: Sun Mar 12, 2017 4:41 pm
Location: Csörög, Hungary

Re: UCCNC sometimes does not read program (comments)

Postby Dazp1976 » Fri Nov 11, 2022 4:18 pm

Beat me to it.
(comment)
Dazp1976
 
Posts: 162
Joined: Wed Mar 16, 2022 12:57 pm

Re: UCCNC sometimes does not read program (comments)

Postby Rilexer » Sat Nov 12, 2022 7:42 am

Ok, I understand this standard, Fusion 360 always uses brackets in generating gcode, but all 3d printing software uses brackets.
I wonder about Stepcraft using Cura and UCCNC, which also gives semicolons and UCCNC on video ignored all of them.
https://www.youtube.com/watch?v=2SbIsb6Rq3A&t=2019s.

By the way, one short question. Is there a way to modify the inside variable in the custom M function? Like MXXX D10. Where D 10 is inside int variable

I couldn't find it anywhere in "UCCNC MACROS & SCREENSET FUNCTIONS, BUTTONS, FIELDS, LED’s & CHECKBOXES"
Rilexer
 
Posts: 2
Joined: Thu Nov 10, 2022 7:46 pm

Re: UCCNC sometimes does not read program (comments)

Postby dezsoe » Sat Nov 12, 2022 8:16 am

As I see they simply ignore the risk of those lines. A macro or plugin can be written to repair those files.

You should check the manual of UCCNC in the UCCNC\Documentation directory. (4.1.2 M-codes)
dezsoe
 
Posts: 2093
Joined: Sun Mar 12, 2017 4:41 pm
Location: Csörög, Hungary

Re: UCCNC sometimes does not read program (comments)

Postby dezsoe » Sat Nov 12, 2022 1:14 pm

OK, I wrote a little macro to convert the opened file. If you save it as M20000..M21999 then you can place a button on the screen to call it or else you can just use the MDI.

Code: Select all
// ================================================================================================
// Convert remarks
// ================================================================================================

const double minimumQ = 20.0;

string fileName = exec.mainform.filenametoload;

if (!System.IO.File.Exists(fileName))
  return;

string inputFile = System.IO.Path.GetFileName(fileName);

if (inputFile == "Empty.txt")
  return;

exec.AddStatusmessage("Checking " + inputFile);

string outputPath = System.IO.Path.GetDirectoryName(fileName);
string outputFile = System.IO.Path.GetFileNameWithoutExtension(fileName) + "_(mod)" + System.IO.Path.GetExtension(fileName);

if (outputPath[outputPath.Length - 1] != '\\')
  outputPath += "\\";

String[] gCode = System.IO.File.ReadAllLines(fileName);

string line, wrk;
int ptr;
bool changed = false;

using (System.IO.StreamWriter sw = System.IO.File.CreateText(outputPath + outputFile))
{
  for (int i = 0; i < gCode.Length; ++i)
  {
    line = gCode[i].Trim();
    if (line != "")
    {
      if (line[0] == ';')
      {
        line = line.Replace("(", "[");
        line = line.Replace(")", "]");
        line = "( " + line.Substring(1).Trim() + " )";
        changed = true;
      }
      else
      {
        ptr = line.IndexOf(';');
        if (ptr > 0)
        {
          wrk = line.Substring(0, ptr);
          line = line.Substring(ptr + 1);
          line = line.Replace("(", "[");
          line = line.Replace(")", "]");
          line = wrk + "( " + line.Substring(1).Trim() + " )";
          changed = true;
        }
      }
    }
    sw.WriteLine(line);
  }
  sw.Close();
}

if (changed)
{
  exec.AddStatusmessage("Loading " + outputFile);
  exec.Loadfile(outputPath + outputFile);
}
else
  exec.AddStatusmessage("No change required");
dezsoe
 
Posts: 2093
Joined: Sun Mar 12, 2017 4:41 pm
Location: Csörög, Hungary


Return to Report a bug

Who is online

Users browsing this forum: No registered users and 10 guests