add a pass trough at the beginning of the code not the end

add a pass trough at the beginning of the code not the end

thierry924K4
Enthusiast Enthusiast
422 Views
2 Replies
Message 1 of 3

add a pass trough at the beginning of the code not the end

thierry924K4
Enthusiast
Enthusiast

Hi,

 

Is it possible to add a pass through add the beginning of a cycle instead of the end?

I need to terminate G199 with a G198 but at the end of the cycle or my subspindle will keep turning.

 

please ignore the M145 in the code this was also a Pass through that did not work, it stops the subspindle on spot and the main spindle is slowly slowing down.

0 Likes
423 Views
2 Replies
Replies (2)
Message 2 of 3

serge.quiblier
Autodesk
Autodesk

Hello @thierry924K4 

 

you can 't change the pass-through location in the intermediate code.
But you can change when you want to output it.
Pass-through will be send between sections.

 

sergequiblier_0-1679929055414.png

In the example above, the pass-through command occurs between the onSectionEnd call for the Parallel1 operation.
Then we will be interpreting onSection call for the operation Swarf1 (2).
It means that the retract, coolant off. from the previous operation is outputted at the beginning of the next operation section.

If you want to output the pass-through command somewhere else, you can modify the function, for storing the elements.

Initial code :

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

 

Modified code:

var storedPassThrough = "";

function onPassThrough(text) {
  storedPassThrough = text;
}

 

Then in the appropriate location in the onSection function, where you want to output the commands, you can add this code.

  if (storedPassThrough != "") {
    var commands = String(storedPassThrough).split(",");
    for (text in commands) {
      writeBlock(commands[text]);
    }
    storedPassThrough = "";
  }

 

Known caveat, all the pass through commands will be outputted in that new location.

If it does not suit you, then add some logic in the onPassThrough function, seaching for substring, for example.

And reacting differently if it's that command or not.

 

Regards.


______________________________________________________________

If my post answers your question, please click the "Accept Solution" button. This helps everyone find answers more quickly!

 

 



Serge.Q
Technical Consultant
cam.autodesk.com
0 Likes
Message 3 of 3

josh.sapp
Advocate
Advocate

Thank you for this. I have been wracking my brain to get the pass through to where I wanted.👍

0 Likes