Turn cycle blocks output in native NX is working, but do not output when post processing from NX in managed mode.
SolutionIn Post Configurator add following procedure to post processor service layer:
##=======================================================================================================================================
proc LIB_CTRL_init_rough_turn_cycle_output {} {
#------------------------------------------------
global mom_machine_control_motion_output
global mom_sys_output_cycle95
global mom_sys_output_contour_motion
global mom_template_subtype
global dpp_record_rough_cycle_seq
global mom_machine_cycle_subroutine_name
global dpp_finish_feed
global mom_feed_cut_value
global dpp_turn_cycle_g_code
global mom_operation_name
##++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# "mom_sys_output_contour_motion" can be set [ 0 | 1 | 2 ].
# 0: No contour output
# 1: Part contour
# 2: Tracking path contour
##++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Initialize mom_sys_output_contour_motion to 0 as default.
set mom_sys_output_contour_motion 0
##++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# So far, machine cycle motion has been supported in following three scenarios.
#
# Scenario 1: single rough turning cycle operation.
# Scenario 2: both rough and finish turning cycle operation.
# (The following two conditions should be fulfilled in this scenario.)
# Condition 1: contour data of rough and finish operations should be same.
# This is checked by user when operations are created, not checked by post processor.
# Condition 2: subroutine name of rough operation should be same as the finish operation name.
# Scenario 3: single finish turning cycle operation.
##++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# When "Machine Cycle" is selected as Motion Output in Machine control and
# post processor is equipped with the ability to output rough turning cycle, then:
if {([info exists mom_machine_control_motion_output] && $mom_machine_control_motion_output == 2) && \
([info exists mom_sys_output_cycle95] && $mom_sys_output_cycle95)} {
# Check scenario 1
if {[string match "*Turn*" $::mom_operation_type] || [string match "*Rough*" $::mom_operation_type]} {
LIB_CTRL_set_contour_motion
# Check scenario 2 or 3
} elseif {[string match "*Finish*" $::mom_operation_type]} {
# Scenario 2
if {[info exists dpp_record_rough_cycle_seq(begin,$mom_operation_name)]} {
# Output G70 command
set dpp_finish_feed $mom_feed_cut_value
set dpp_turn_cycle_g_code 70
LIB_GE_command_buffer TURN_CYCLE_FINISHING_IN_INITIAL
LIB_GE_command_buffer {MOM_do_template turn_cycle_finishing} @TURN_CYCLE_FINISHING_IN_INITIAL
LIB_GE_command_buffer_output
MOM_force once G_motion X Z
# Scenario 3
} else {
LIB_CTRL_set_contour_motion
}
# Other scenarios
} else {
LIB_GE_abort_message "$mom_operation_name: The machine cycle motion has not been supported in current operation type so far."
}
# Don't output cutcom until rough turning cycle called
MOM_disable_address G_cutcom
}
}
##=======================================================================================================================================
In Post Builder edit or replace PB_CMD_init_cycle95_output procedure with the following code:
# ==> This command should be called in the event whose position can be output
# as the "ready position" (outside of stock) for the CYCLE95 call.
#
#-----------------------------------------------------------------------------
# This command gathers information to determine if NX/Post should
# process contour data and produce subprogram & cycle95 instructions.
#
# The state of variable "mom_machine_control_motion_output" will indicate
# when turning processor will produce contour data whereas the variable
# "mom_sys_output_cycle95" indicates that post is equipped with the ability
# to output CYCLE95. This ability can be activated in the event below:
#
# "Program & Tool Path"
# -> "Program"
# -> "Canned Cycles" -> "Turn Roughing"
#
#*****************************************************************************
# This command will only function when
# - Turning processor has produced contour data
# - The post is equipped with the ability to output cycle95
#
# What can be done here?
# 1. Select subprogram output style in either in-line or external SPF file
# 2. Specify labels and/or subprogram name
# 3. Validate subprogram name
#*****************************************************************************
#
global mom_sys_output_contour_motion
global mom_machine_control_motion_output
global mom_sys_output_cycle95
global mom_machine_cycle_subroutine_name
global mom_operation_name
global mom_template_subtype
global mom_operation_type
set mom_sys_output_contour_motion 0
# Skip contour output for non-turning operations
if { [info exists ::mom_operation_type] && ![string match "*Turn*" $::mom_operation_type] } {
return
}
#======================================================
# When turning processor has produced contour data and
# post is equipped with the ability to output cycle95:
#======================================================
if { ([info exists mom_machine_control_motion_output] && $mom_machine_control_motion_output == 2) && \
([info exists mom_sys_output_cycle95] && $mom_sys_output_cycle95) } {
# <2016-12-06 szl> Check if the operations are supported by CYCLE95, if not, will switch the output mode from Machine-Cycle to
# None_Machine_Cycle and list the warning message.
if {[string match "*Rough*" $mom_operation_type] || [string match "*Finish*" $mom_operation_type] || \
[string match "Facing" $mom_operation_type]} {
# <2016-11-28 szl> Check if Profile stock are same as Rough stock while "Additional Profile" option is on,
# if no, we will switch output mode from Machine-Cycle to Non-Machine-Cycle.
if {[info exists ::mom_profiling] && ($::mom_profiling == 1)} {
if { !([EQ_is_equal $::mom_finish_equidistant_stock $::mom_stock_part] && \
[EQ_is_equal $::mom_finish_face_stock $::mom_face_stock] && \
[EQ_is_equal $::mom_finish_radial_stock $::mom_radial_stock]) } {
MOM_output_to_listing_device "$mom_operation_name: Additional Profiling can only be used when profile stock is the same with rough stock.\
\nSo it will not be output in current operation. Switch output mode from Machine-Cycle to Non-Machine-Cycle."
return
}
}
#----------------------------------------
# Notify NX/Post to process contour data
#----------------------------------------
set mom_sys_output_contour_motion 1
} else {
MOM_output_to_listing_device "$mom_operation_name: The Machine Cycle motion output has not been supported for current operation type so far.\
\nSwitch output mode from Machine-Cycle to Non-Machine-Cycle."
}
#####################################################
# Set CYCLE95 contour output mode
#
# LBL: Output subprogram in-line with main program
# (Enclosed in start & end labels)
# LBL_END: Output subprogram at end of main program
# (Enclosed in start & end labels)
# SUB: Output subprogram in a separate SPF file
#####################################################
global mom_siemens_cycle95_output_mode
set mom_siemens_cycle95_output_mode "LBL"
# set mom_siemens_cycle95_output_mode "LBL_END"
# set mom_siemens_cycle95_output_mode "SUB"
#++++++++++++++++++++++++++++++++++++++++++++++++
# Defined start & end labels and subprogram name
# ==> User may customize these labels as needed.
#++++++++++++++++++++++++++++++++++++++++++++++++
global mom_sys_cycle95_subprogram_name
global mom_sys_cycle95_subprogram_start
global mom_sys_cycle95_subprogram_end
set ::udv_cycle_name_idx [expr $::udv_cycle_name_idx + 1]
# Define subprogram name when it is not specified in NX.
if { ![info exists mom_machine_cycle_subroutine_name] } {
set mom_machine_cycle_subroutine_name SUB_$mom_operation_name
set mom_sys_cycle95_subprogram_end "[string toupper $mom_operation_name]_FIM"
} elseif { ![string compare "" $mom_machine_cycle_subroutine_name] } {
set mom_machine_cycle_subroutine_name SUB_$mom_operation_name
set mom_sys_cycle95_subprogram_end "[string toupper $mom_operation_name]_FIM"
} else {
#set mom_sys_cycle95_subprogram_end "[string toupper $mom_machine_cycle_subroutine_name]_FIM"
set mom_sys_cycle95_subprogram_end "FIM_$::udv_cycle_name_idx"
}
set mom_sys_cycle95_subprogram_name "[string toupper $mom_machine_cycle_subroutine_name]"
#set mom_sys_cycle95_subprogram_start "[string toupper $mom_machine_cycle_subroutine_name]_INICIO"
set mom_sys_cycle95_subprogram_start "INICIO_$::udv_cycle_name_idx"
# Validate subprogram name and labels
PB_CMD_check_subroutine_name
#---------------------------------------------------------------
# Save current position of this event.
# - It will be used as the return position after the cycle call.
#---------------------------------------------------------------
# <10-30-15> szl - Don't need it as return position any more, so remove it.
# global mom_pos mom_pos_saved_for_cycle95
# VMOV 3 mom_pos mom_pos_saved_for_cycle95
#------------------------------
# Skip to the end of operation
#------------------------------
# <10-30-15> szl - Due to we have generic cycle now, we don't need to skip
# to the end of operation here.
# MOM_abort_operation
} else {
MOM_output_to_listing_device "$mom_operation_name: Lathe Rough Cycle has not been supported in Post Processor currently.\
\nSwitch output mode from Machine-Cycle to Non-Machine-Cycle."
}