NX Custom format for User Defined Events in CLSF file output

2021-10-06T23:27:56Z
NX for Manufacturing

Summary


Details

The customer has developed a new custom User Defined Event (UDE) for use in CAM programs.  The software will include this UDE in a general CLSF file export of the tool path, but the standard format is not as desired.  Is there any way the user can control the format of UDE output in a CLSF file?

Solution

Users can control the way UDE information is output to the CLSF file.  However, this requires manual customization of tcl scripts that generate the CLSF output file, which is not supported by GTAC. 

The following is a general reference outline of how to accomplish this, in case users want to experiment with this on their own.

For the sake of example, we have a simple UDE defined in the ude.cdl file that asks the user for an integer and a string input:

EVENT myUDE
{
   UI_LABEL "My UDE"

   PARAM integer_value
   {
      TYPE   i
      DEFVAL "0"
      UI_LABEL "Integer Value"
   }
   PARAM string_value
   {
      TYPE   s
      TOGGLE Off
      UI_LABEL "String Value"
   }
}


When we add this as a start event in NX, we will use "5" as the integer value and "This is a test" as the string value:


When we output this using the standard CSLF option, we get the default formatting of the UDE, since this is an unknown event for the export script:

TOOL PATH/DRILLING,TOOL,930-0147-00
TLDATA/DRILL,MILL,0.2500,0.0000,2.8000,135.0000,2.8000
MSYS/0.6650,-0.0132,0.8593,1.0000000,0.0000000,0.0000000,0.0000000,1.0000000,0.0000000
$$ centerline data
PAINT/PATH
PAINT/SPEED,10
LOAD/TOOL,1,ADJUST,1
$$UDE: MY UDE/INTEGER VALUE=5,STRING VALUE=THIS IS A TEST
PAINT/COLOR,186
RAPID
GOTO/1.0000,1.0000,2.0000,0.0000000,0.0000000,1.0000000
CYCLE/DRILL,CLEAR,0.1250,FEDTO,-1.1518,RTRCTO,AUTO,IPM,10.0000
PAINT/COLOR,31
GOTO/1.0000,1.0000,0.0000
CYCLE/OFF
PAINT/SPEED,10
PAINT/TOOL,NOMORE
END-OF-PATH


Note that the UDE line follows a standard format of the UDE event name then parameter name and parameter value for each parameter in the event.

To change this, you have edit the ...\MACH\resource\tool_path\clsf.tcl file of the NX installation.  This file includes tcl procedures to handle each event.  Here, we will add a new custom proc to handle this specific UDE type.  Name the proc using MOM_udename syntax.  You can then add whatever tcl commands desired to change or format the data from the UDE.  Note also that we use the standard mom_parametername type variables that NX automatically creates for any UDE content.

Here, we will just change how the two values are reported:

proc MOM_myUDE {} {
   global mom_string_value
   global mom_integer_value
   set mytext "**** Custom UDE output here.  String value: $mom_string_value    Integer value: $mom_integer_value ****"
   MOM_output_literal "$mytext"
}

With that procedure added to the clsf.tcl file and saved, we can now export the CLSF for this operation again.  No changes were made to the UDE itself in the cam operation.  Note the change in the way this UDE line is now formatted:

TOOL PATH/DRILLING,TOOL,930-0147-00
TLDATA/DRILL,MILL,0.2500,0.0000,2.8000,135.0000,2.8000
MSYS/0.6650,-0.0132,0.8593,1.0000000,0.0000000,0.0000000,0.0000000,1.0000000,0.0000000
$$ centerline data
PAINT/PATH
PAINT/SPEED,10
LOAD/TOOL,1,ADJUST,1
**** Custom UDE output here.  String value: This is a test    Integer value: 5 ****
PAINT/COLOR,186
RAPID
GOTO/1.0000,1.0000,2.0000,0.0000000,0.0000000,1.0000000
CYCLE/DRILL,CLEAR,0.1250,FEDTO,-1.1518,RTRCTO,AUTO,IPM,10.0000
PAINT/COLOR,31
GOTO/1.0000,1.0000,0.0000
CYCLE/OFF
PAINT/SPEED,10
PAINT/TOOL,NOMORE
END-OF-PATH


This concept can be applied to event handlers already in the clsf.tcl file, as well as creating special formatting for new custom UDEs.



Hardware/Software Configuration

Platform: all
OS: n/a
OS Version: n/a
Product: NX
Application: CAM
Version: V12.0.2
Function: CLSF

Ref: 002-8529982

KB Article ID# PL8529982

Contents

SummaryDetails

Associated Components

CLSF