Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

Adding a comma (as text) in Manual NC

NYC_CNC
Advocate

Adding a comma (as text) in Manual NC

NYC_CNC
Advocate
Advocate

We use Manual NC to engrave serial numbers and other text using G-Code commands built into the HAAS control (where the Manual NC allows us to pass along a combination of G-code and text parameters to the control).

 

We need to engrave "Zanesville, OH" which should work with the code:

 

T41 M6, S15000 M3,G54, M8, G0 X.7432 Y-1.4322, G43 Z.1 H41, G01 Z.1 F100., G187 P3 E0.002, G47 P0 (MADE IN ZANESVILLE,OH.) X.7432 Y-1.4322 I45. J0.125 R.1 Z-0.025 F15. E15. ;, G187

 

However, the comma in Manual NC is removed from the posted code, as it is interpreted as a carriage return (a.k.a. new line of code).

 

How can we keep the comma?

0 Likes
Reply
Accepted solutions (1)
678 Views
2 Replies
Replies (2)

vid.kok
Advocate
Advocate
Accepted solution

Hi John,

 

Is that the function that you are using in your postprocessor?

 

function onPassThrough(text) {
  var commands = String(text).split(",");
  for (text in commands) {
    writeBlock(commands[text]);
  }
}

It is from: https://knowledge.autodesk.com/support/hsm/learn-explore/caas/sfdcarticles/sfdcarticles/How-to-use-M...

 

You could replace the comma in the split method with some other ASCII character that generally does not appear in a text and use that character to move to another line. You could use "~" (tilde) for example.

 

function onPassThrough(text) {
  var commands = String(text).split("~");
  for (text in commands) {
    writeBlock(commands[text]);
  }
}

 

2 Likes

NYC_CNC
Advocate
Advocate

Thanks!  That should do the trick!

0 Likes