Hello Guest it is April 20, 2024, 02:01:51 AM

Author Topic: Mach won't load this parametric code.  (Read 4178 times)

0 Members and 1 Guest are viewing this topic.

Offline OCNC

*
  •  23 23
    • View Profile
Mach won't load this parametric code.
« on: February 16, 2011, 10:16:29 PM »
Mach3 won't load this parametric code.   Is it a syntax error or just not within Mach's capabilities?  It's hanging on line 4 not liking the word 'If'.

Thanks.

Chris

O001
N1#123=0
N2#100=[5/.125]
N3#101=[#123*.125]
N4IF[#123EQ#100]GOTO7
N5#123=[#123+1]
N6GOTO8
N7M30
N8G1 X[#101] Z0 Y0
N9Z0.037 Y0.0054
N10Z0.0643 Y0.0156
N11Z0.0924 Y0.0313
N13Z0.1144 Y0.0469
N14Z0.1332 Y0.0625
N16Z0.1646 Y0.0938
N17Z0.1904 Y0.125
N20Z0.2115 Y0.1563
N21Z0.2288 Y0.1875
N23Z0.2434 Y0.2188
....etc.
N121Z0.1227 Y11
N122Z0.1095 Y11.125
N123Z0.0961 Y11.25
N124Z0.0825 Y11.375
N125Z0.0687 Y11.5
N126Z0.0549 Y11.625
N127Z0.0409 Y11.75
N128Z0.0268 Y11.875
N129Z0.0127 Y12
N130G0Z.75
N131Y0
N132GOTO3
 

Offline Graham Waterworth

*
  • *
  •  2,672 2,672
  • Yorkshire Dales, England
    • View Profile
Re: Mach won't load this parametric code.
« Reply #1 on: February 17, 2011, 05:13:02 PM »
Mach3 has no support for IF, EQ, GOTO or any other conditional codes

Graham
Without engineers the world stops

Offline OCNC

*
  •  23 23
    • View Profile
Re: Mach won't load this parametric code.
« Reply #2 on: February 17, 2011, 06:25:06 PM »
Ok. Thanks Graham.

Chris

Offline stirling

*
  • *
  •  2,188 2,188
  • UK
    • View Profile
    • www.razordance.co.uk
Re: Mach won't load this parametric code.
« Reply #3 on: February 18, 2011, 01:33:21 PM »
Chris - your code re-structured without conditionals.

Code: [Select]
N1#123=0
N2#100=[5/.125]
N3#101=[#123*.125]
N4M98 P1 L#100
N7M30
o1
N8G1 X[#101] Z0 Y0
N9Z0.037 Y0.0054
N10Z0.0643 Y0.0156
N11Z0.0924 Y0.0313
N13Z0.1144 Y0.0469
N14Z0.1332 Y0.0625
N16Z0.1646 Y0.0938
N17Z0.1904 Y0.125
N20Z0.2115 Y0.1563
N21Z0.2288 Y0.1875
N23Z0.2434 Y0.2188
(....etc.)
N121Z0.1227 Y11
N122Z0.1095 Y11.125
N123Z0.0961 Y11.25
N124Z0.0825 Y11.375
N125Z0.0687 Y11.5
N126Z0.0549 Y11.625
N127Z0.0409 Y11.75
N128Z0.0268 Y11.875
N129Z0.0127 Y12
N130G0Z.75
N131Y0
N132#101=[#101+0.125]
M99
%

Ian

Offline OCNC

*
  •  23 23
    • View Profile
Re: Mach won't load this parametric code.
« Reply #4 on: February 18, 2011, 09:14:21 PM »
Thanks Ian.  This worked well.  What is the meaning of the percent symbol?

Chris

Offline stirling

*
  • *
  •  2,188 2,188
  • UK
    • View Profile
    • www.razordance.co.uk
Re: Mach won't load this parametric code.
« Reply #5 on: February 19, 2011, 05:39:29 AM »
Chris - you're welcome.

The % isn't required but it's not a bad idea to put one on the last line of a gcode program. The gcode interpreter has a "quirk" in that it only processes a line when it sees a carriage-return-line-feed (CRLF) at the end of the line. It's easy to forget to do this on the last line (usually the M30) but in the case of a subroutine (like here) an M99. The % ensures (and visually confirms) that there IS a CRLF after the last line.

Ian
« Last Edit: February 19, 2011, 05:41:41 AM by stirling »

Offline OCNC

*
  •  23 23
    • View Profile
Re: Mach won't load this parametric code.
« Reply #6 on: February 19, 2011, 10:47:19 AM »
Ian,

When you refer to 'gcode interpreter' are you referring to the Mach specific interpreter or to an industry standard?  Either way is there a reference that details these operating subtleties?
Thanks.
Chris

Offline stirling

*
  • *
  •  2,188 2,188
  • UK
    • View Profile
    • www.razordance.co.uk
Re: Mach won't load this parametric code.
« Reply #7 on: February 19, 2011, 12:07:14 PM »
I'm referring here specifically to Mach. I suspect there's a gazillion different gcode dialects and hence interpreters out there but other than that I can't comment. The % as the first character in a line is just an empty comment line to Mach so if you preferred you could do something like (end of my file) - the % is just quicker I guess.

The only refs I know of are those via the links at the top of this page

Ian
« Last Edit: February 19, 2011, 12:11:43 PM by stirling »