Business Rule to Validate NC Program before NC Output Generation

Introduction

This document is intended to provide a detailed guide and examples on how to customize the Business Rule that enables user to check and rework the NC Program before the NC Code gets created

Version – Validated on 2025x FD01 (FP)

Pre-requisites: User must be assigned with Owner Role

Licenses –

  • CSV (Collaborative Industry Innovator)

  • NSR (NC Shop Floor Programmer) or any other role with any Machining App

Disclaimer: Licenses mentioned above are as per 2025x documentation.

Below video demonstrates the implementation of the business rule and its effect while generating the NC Output.

Example Business Rule

DELValidateNCOutput.CATRule

Detail Explanation

Before generating the NV output for the Manufacturing Program. it is important to pre-validate the content of the program so as to generate the correct NC output. Doing this pre-validation manually is very time consuming and there is room for error especially if it is very big program. The given business rule helps in automating this process. It helps in running important checks on manufacturing Program before generating the NC outputs. If some checks fail, then the generated of NC output is aborted. User also gets the information in message box about the failed check.

Following script explains the check that can be implemented.

Fetch Input Manufacturing Program and initialize the Output Parameter Values

// Retrieve the current Manufacturing Program
MfgProgram = ThisObject 

bCreateNCOutput = TRUE 
bValidISR = true 
sWarningMsg = "Rule DELValidateNCOutput_ID invoked. " 
TCActiveStatus = true 
iMessageType = 1

Implement First Validation Condition

if(MfgProgram <> NULL)
{
    //Validation Condition1: Continue generation but warn if valid intermediate simulation result is not stored at the end of the Program
    if(MfgProgram.HasValidISR(bValidISR) AND bValidISR == false)
    {
        // Warning if the intermediate simulation result is not valid. Set output values.
        bCreateNCOutput = TRUE
        sWarningMsg = sWarningMsg + "Validation Condition1: There is no valid Intermediate Simulation Result at the end of the program " + MfgProgram.Name + ". It is highly recommended to do a full machine simulation with material removal before doing an APT generation."
        iMessageType = 2
    }

Implement Second Validation Condition

//Validation Condition2:  Exit in error if a tool change activity is deactivated while subsequent MO is activated
    MfgProgram.GetChildActivities(ListChildActivities) // Retrieve the Manufacturing Program children
    
    For ChildActivity inside ListChildActivities // Loop on each child activity
    {
        if(ChildActivity <> NULL)
        {    
            // Test if it's a tool change and get its status
            if(ChildActivity.IsASortOf("ToolChange"))
            {
                TCActiveStatus = ChildActivity.MfgIsActive
            }
            // Test the subsequent Operation status if tool change is deactivated    
            else if(TCActiveStatus == false)
            {
                // Exit in error if the Operation is activated while tool change is deactivated
                if (ChildActivity.MfgIsActive == true)
                {
                    bCreateNCOutput = FALSE
                    sWarningMsg = sWarningMsg + "Validation Condition2: Tool Change deactivated while Operation is activated. Generation aborted."
                    iMessageType = 3
                    Break
                }
            }
        }
    }

Set Output parameters

// OUTPUT
Parameters.SetAttributeBoolean("CreateNCOutput", bCreateNCOutput)
Parameters.SetAttributeString("AbortMessageString",sWarningMsg)
Parameters.SetAttributeInteger("MessageType", iMessageType)

Output parameters details:

  1. CreateNCOutput : Boolean to continue (TRUE) or abort (FALSE) the output generation.

  2. AbortMessageString :  String with message to be displayed

  3. MessageType : Integer about type of the message to be displayed

    1. MessageType = 1 => Message is of Type Information

    2. MessageType = 2 => Message is of Type Warning

    3. MessageType = 3 => Message is of Type Error

Business Rule Setup

Business Rule opening Id - DELValidateNCOutput_ID

The Business Rule can be executed in two different ways.

  1. DataSetup App: If you create the script through DataSetup, it remains persistent in the database, is stored on the server and available to all. The script opening ID will be available under Machining Resources. 

  2. CATRule/CATRuleExit: If you create the script using a CATRule, you must store the files DELValidateNCOutput.CATRule and DELValidateNCOutput.CATRuleExit in ..\\resources\\knowledge\\scripts. You can then edit the CATRule file or create a new CATRule and CATRuleExit files with an Opening ID of DELValidateNCOutput_ID

    You can then execute the Business Rule when upgrading tool resources.

    Note: Be careful while using this method as the setup is done on local machine and it is not available to all users. Each user will have to do the setup individually. 

Reference

Author

Person of Contact - @Sheetal MARDE