Modify post processor to support Manual NC Pass Through

SGoldthwaite
Collaborator

Modify post processor to support Manual NC Pass Through

SGoldthwaite
Collaborator
Collaborator

I'm using the shopbot post processor (https://cam.autodesk.com/hsmposts  ver 43779).  I followed the instructions in this article (www.autodesk.com/support/technical/article/caas/sfdcarticles/sfdcarticles/post-processor-manual-NC-n... and added the following code to the post processor:

 

// Manual NC PassThrough - added by SRG 4/30/22
function onPassThrough(text) {
  writeComment("Manual NC Passthrough");
  var commands = String(text).split(",");
  for (text in commands) {
    writeBlock(commands[text]);
  }
}

 

 

In Fusion, I'm using Manual NC > Pass Through and adding this (I'm only testing):

SGoldthwaite_0-1689881209011.png

 

The post processor is outputting this:

 

' Manual NC Passthrough
JX
 -10
' Manual NC Passthrough
JY
 5

 

 

I want it to output this:

 

' Manual NC Passthrough
JX, -10
JY, 5

 

 

Can anyone tell me how to edit my post processor to do this?

 

0 Likes
Reply
Accepted solutions (1)
524 Views
4 Replies
Replies (4)

yd_kwon
Advocate
Advocate
Accepted solution

Try it with the code below

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

This code doesn't break the text with a comma (,), it breaks the text based on the line break.

JX, -10
JY, 5

 

CAM-Fusion 360/Inventor
CAD-Fusion 360/Inventor
Before PowerMILL
0 Likes

SGoldthwaite
Collaborator
Collaborator

That worked, thanks!   It does write the comment multiple times like this:

 

' Manual NC Passthrough
JX, -10
' Manual NC Passthrough
JY, 5

 

It's doesn't hurt anything, but do you know how to get "Manual NC Passthrough" to print only once?

0 Likes

yd_kwon
Advocate
Advocate

That's not possible.
The onPassThrough() function is repeated for each object of text entered. This can be verified by using a dumper post file.

There are two alternatives.

1. include the desired comment text in the text. Like below

' Manual NC Passthrough
JX, -10
JY, 5


2. use the manual NC-comment with a preceding line.

CAM-Fusion 360/Inventor
CAD-Fusion 360/Inventor
Before PowerMILL
0 Likes

SGoldthwaite
Collaborator
Collaborator

Thanks.  That's a good idea to put the comment in the in with the pass-through code instead of the post processor

0 Likes