Community
HSM Post Processor Forum
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Adding Cutting Time for every tool to the header

1 REPLY 1
SOLVED
Reply
Message 1 of 2
j_zander
177 Views, 1 Reply

Adding Cutting Time for every tool to the header

Hey Guys,

we  are going to get a new machine with a robot. The robots software has a toolmanagementsystem. To use this i have to post the cuttingtime of every tool to the Nc-prgram header like this:

j_zander_0-1705417904632.png

With the DeferredVariables Propery/Function  from the postprocessor training guide i was able to add the time in seconds to the post. But now i'm struggeling to change it to the right format. I wanted to use this function to change the cutting times format:

function convertToTimeFormat(totaltoolTime){
    var format = "HH:MM:SS".split(":")[0];
    var hours, minutes, result, seconds;
  
    if (format == "HH" || format == "MM") {
      hours = Math.floor(totaltoolTime / 3600);
      totaltoolTime -= (format == "HH") ? hours * 3600 : 0;
  
      minutes = Math.floor(totaltoolTime / 60);
      totaltoolTime -= minutes * 60;
    }
  
    seconds = totaltoolTime.toFixed(1);
  
    if (format == "HH") {
      result = hours + "Hrs " + minutes + "Min " + seconds + "Sec";
    } else if (format == "MM") {
      result = minutes + "Min " + seconds + "Sec";
    } else {
      result = seconds + "Sec";
    }
  
    return result;  
}

It seems like the DeferredVariable is not a number.

Intstead of the new values i only get NaN.

 

I hope somebody can help. 

 

Attached you can find my post I am playing with. 

Tags (3)
1 REPLY 1
Message 2 of 2
serge.quiblier
in reply to: j_zander

Hi @j_zander 

 

In the dditive posts, we are using something like :

function formatCycleTime(cycleTime) {
  var seconds = cycleTime % 60 | 0;
  var minutes = ((cycleTime - seconds) / 60 | 0) % 60;
  var hours = (cycleTime - minutes * 60 - seconds) / (60 * 60) | 0;
  if (hours > 0) {
    return subst(localize("%1h:%2m:%3s"), hours, minutes, seconds);
  } else if (minutes > 0) {
    return subst(localize("%1m:%2s"), minutes, seconds);
  } else {
    return subst(localize("%1s"), seconds);
  }
}

 

You can build your own code from this sample. If you don't have to translate H, M S just remove the localize function call, and just keep the string.

 

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

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Technology Administrators


Autodesk Design & Make Report