Showing results for 
Search instead for 
Did you mean: 

Post Configurator: Code example for adding operation/machining time


Just getting up to speed with PC, nothing serious and nothing to plug this too yet, and trying to figure out how to add a custom command, or importing some code from PB. I've looked at the doc and recent training but just can't figure it out.


Anyone willing to share any custom command(s) they have done recently for PC? I'm trying to do something as simple as adding total operation machining time and outputing this after each ops in the nc output.


Nothing work, for me anyway. Anyone have an example?




Re: Post Configurator: Code example for adding operation/machining time

Siemens Legend Siemens Legend
Siemens Legend



therefore you have 2 possibilities to handle that. You can use the Buffer method, means you switch on the property for debugging.












When you post now, you get more information in the listing window about the used buffers. Navigate to the buffer you want extend, e.g. in this case at the end of movements in an operation.


>>============================= END BUFFER SEQ Smiley Embarassed>LIB_GE_command_buffer_seq MOM_rapid_move_LIB FIRST_MOVE_MILL {@MOVE}<<


Now copy the highlighted code into your service file and behind the "MOVE" add your custom proc, e.g.

LIB_GE_command_buffer_seq MOM_rapid_move_LIB FIRST_MOVE_MILL {CMD_TIME @MOVE}


Now add your custom proc to the service file, this can be a new one or you reuse it from other posts.

proc CMD_TIME { } {
global mom_toolpath_cutting_time

MOM_output_literal ";-->OP-cutting time: $mom_toolpath_cutting_time"
MOM_output_literal ";-->time formatted: [LIB_DC_time_format $mom_toolpath_cutting_time]"


Have a look at the second output. This is an function included in Post Configurator libraries to format time values Smiley Happy .


With this implementation you get the output in the start of path. You will see that sometimes the buffer-method works fine but in some cases it's better to use the Entrypoints-method, e.g. when you want the output at the end of the path. For that add the entrypoint in the service file and then call your custom command.


proc MOM_end_of_path_LIB_ENTRY {position} {
switch $position {
"start" { }
"end" {CMD_TIME}


It maybe helps for future to have a file were you stored all the entrypoints proc's so that you just copy that and not write again and again or you use it as a new layer. An overview about the existing entrypoints is in the training material in the advanced modifications section.


In attachment you'll find the changed service layer from sim08 sinumerik with the commands above and some comments.


Best regards


Re: Post Configurator: Code example for adding operation/machining time


omg, Thomas, it works!!


Okay, I think I'm starting to get a good grip at this - thanks to you Thomas. That is exactly what I needed to get started and to understand how things works in PC. Not easy but then nothing is easy when you've never done it. I'll practice more over the week with other cmd I got standby here and see how it goes.


Much appreciated Sir




Learn online

Solution Information