Business Rule for Tool Query

Introduction

This document is intended to provide a detailed guide and examples on how to customize the logic of tool query to select the required tool.

Version – Validated on 2025x FD01 (FP)

Pre-requisites: User must be assigned with Owner Role

Licenses –

  • CSV (Collaborative Industry Innovator)

  • NPX (NC Milling Machine Programmer) or any other Machining role except NSR (NC Shop Floor Programmer)

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

Below video demonstrates the implementation of the business rule and its effect on tool selection while instantiating the machining know how template.

Example Business Rule

DELToolQuery.CATRule

Detail Explanation

During Machining Know How Template Instantiation, when the tool query to assign the tool/tool assembly to a manufacturing operation gets multiple matching results, there is an option for the user to interactively select the tool/tool assembly to be assigned. Using this business rule, user will be able to select the tool/tool assembly non-interactively and automatically based on the selection logic defined in the business rule.

Following script will explain how the correct tool/tool assembly is getting selected in the Business Rule.

Fetch Inputs. The script has two input parameters. The main input is "ToolResourceList ". It is the list of multiple tool resources resulted from the tool query during the template instantiation

// INPUT
Let ToolResourceList(List)
Let sourceToolQuery (String)
Set ToolResourceList = Parameters->GetAttributeObject("iToolResourceList")
Set sourceToolQuery = Parameters->GetAttributeString("iToolResourceListSource")
Notify("BL DELToolQuery from # : Start ------", sourceToolQuery)
Notify("List size- ", ToolResourceList->Size())

Get initial reference values of Nominal Diameter and Cutting Length from the first tool resource from the ToolResourceList

Let CurrentRes(Feature)
Let currInst (VPMInstance)
Let currToolAssembly(ResourceNCMillAndDrillToolAssembly)
Let APMX, DIA(LENGTH)
Let MinAPMX, MaxDIA(LENGTH)
Let MaxIdx(Integer)

Set MaxIdx = 1
Set CurrentRes = ToolResourceList.GetItem(MaxIdx)
// Instance in case of tool query from document
// Reference in case of tool query from database
Set currToolAssembly = CurrentRes
if (currToolAssembly == NULL)
{
    set currInst = CurrentRes
    if (currInst <> NULL)
        set currToolAssembly = currInst.Reference
}
if ( currToolAssembly <> NULL)
{
    Set MinAPMX= currToolAssembly.V_Cut_Length
    Set MaxDIA= currToolAssembly.V_Nominal_Diameter
}

For each item in the ToolResourceList check if the values of Nominal Diameter and Cutting Length and meeting the conditions required

Let Itr(Integer)
for Itr = 2 while Itr <= ToolResourceList->Size()
{
    Set CurrentRes = ToolResourceList.GetItem(Itr)
    // Instance in case of tool query from document
    // Reference in case of tool query from database
    Set currToolAssembly = CurrentRes
    if (currToolAssembly == NULL)
    {
        set currInst = CurrentRes
        if (currInst <> NULL)
            set currToolAssembly = currInst.Reference
    }
    if ( currToolAssembly <> NULL)
    {
        Set APMX = currToolAssembly.V_Cut_Length
        set DIA = currToolAssembly.V_Nominal_Diameter
        if(APMX < MinAPMXand DIA >= MaxDIA)
        {
            Notify("Max Diameter and Min APMX Found")
            Set MinAPMX= APMX
            Set MaxDIA= DIA
            Set MaxIdx = Itr        
        }
    }
}

Fetch the selected Tool resource matching the conditions

Let SelectedRes(Feature)
Set SelectedRes = ToolResourceList.GetItem(MaxIdx)
// Instance in case of tool query from document
// Reference in case of tool query from database
Set currToolAssembly = SelectedRes
if (currToolAssembly == NULL)
{
    set currInst = SelectedRes
    if (currInst <> NULL)
        set currToolAssembly = currInst.Reference
}
if ( currToolAssembly <> NULL)
{
    Notify("currToolAssembly")
    Notify("Selected Tool Name : ", currToolAssembly.Name)    
    Notify("Selected Tool APMX: ", currToolAssembly.V_Cut_Length)
    Notify("Selected Tool DIA: ", currToolAssembly.V_Nominal_Diameter)
}

Set the Output as selected tool resource

Let SelectedToolResourceList(List)
SelectedToolResourceList.Append(SelectedRes)

// OUPUTS
Parameters->SetAttributeObject("oSelectedResource", SelectedToolResourceList)
Notify("BL DELToolQuery : End")

Business Rule Setup

Business Rule opening Id - DELToolQuery_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 DELToolQuery.CATRule and DELToolQuery.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 DELToolQuery_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

For more details, please visit user assistance.

 

Author

Person of Contact - @Sheetal MARDE 

Special Thanks to @Vivek BAGALKOT, @Pavankumar K M and @Tejaswi S R for providing support in this topic.