About the NCPlayer Service:
File Menu
Edit Menu
View Menu
Formatting Menu
Tools Menu
Machine Configuration Menu
Collaboration

Add Spaces to Program


The Add Spaces tool automatically inserts spaces into G-code, bringing it to a consistent and parser-safe format. Formatting does not change the meaning of the commands, but makes the code more readable for humans and unambiguous for NCPlayer’s internal parser.

What the formatter does

  • Separates addresses: G00X10Y5Z-2F800G00 X10 Y5 Z-2 F800.
  • Separates modal codes: G17G90G54G17 G90 G54, G00XG00 X.
  • Adds spaces around the = sign in macro variable assignments: #100=ROUND[#101+10]#100 = ROUND[#101 + 10].
  • Normalizes syntax inside brackets [ ... ] (conditions/expressions): operators and functions are separated by spaces but not broken apart: [#100+5*COS[#101]][#100 + 5 * COS[#101]].
  • Preserves comments as is: text inside ( ... ) is not changed or parsed.
  • Formats control words in logic: IF, THEN, GOTO, WHILE, DO, END remain intact and are separated by spaces to avoid confusion with addresses/cutter comps.

Before/After examples

Before:
G0G90G54X0Y0S1200M3
#100=ROUND[#101+10]
IF[#100GT50]THENGOTO120
N11G1X[#7-#2]Z-[#8-#2]F[#12]

After:
G0 G90 G54 X0 Y0 S1200 M3
#100 = ROUND[#101 + 10]
IF [#100 GT 50] THEN GOTO 120
N11 G1 X[#7 - #2] Z-[#8 - #2] F[#12]

Why this matters for parsing

  • Clear delimiters between tokens remove ambiguity (e.g., G00X vs G00 X).
  • A unified style inside [ ... ] ensures correct recognition of operators (EQ/NE/GT/GE/LT/LE) and functions (SIN, COS, ROUND, FIX, etc.).
  • Proper spacing around IF / THEN / GOTO / WHILE / DO / END prevents logical parsing errors.
NCPlayer NCPlayer

Recommendations

  • After formatting, click Reload Toolpath to rebuild the toolpath with the new spacing.
  • Check sections with macro logic and jumps — the formatter does not change the logic but improves readability.
  • The minus sign for numbers (Z-2) remains attached to the value: Z-2, not Z - 2.
CNCPassport © MEBLEOS © 2026 · Ver 1.0 · Terms & Conditions | Privacy Policy | Cookie Policy | Refund Policy Legal information | Privacy Policy