CATRule to Define Tool Query

You can use this business rule during tool or tool assembly assignment on a Manufacturing Operation if the tool query results in multiple matching results during Template or Machining Process Instantiation.

This page discusses:

General Information

You can add the Business Logic as a CATRule file or you can define it through the DataSetup app.

If you create the script through the DataSetup, it will be persistent in the database, stored on the server and available to all.

If you create the script using a CATRule file, you must store the DELToolQuery.CATRule and DELToolQuery.CATRuleExit files in ..\resources\knowledge\scripts. You can invoke them by editing the CATRule file or by creating a new CATRule and CATRuleExit files with an Opening ID of DELToolQuery_ID.

If the business rule is not defines (which is the case by default), the first tool of the tool query result is automatically assigned to the manufacturing operation.

If the business rule is defined and the SelectedResource output object is null, no tool is assigned to the manufacturing operation.

Input Objects

You can use the attributes of a manufacturing operation. Input objects must be of the following types:

ManufacturingOperation

Parameter Name Comments
ToolResourceList List of the multiple tool resources resulted from the tool query during template instantiation.
ToolResourceListSource Define the source of the ToolResourceList (for example, document, database, library or catalog).

Output Objects

The following table describes the output object.

Output Object Description
SelectedResource If the tool query results as multiple matching tools, this is the resource selected, based on the business rule you set.

Example of Usage

  • For CATRule file:

    /* ------------------------------------------------------------------------------------------------ */
    /* NOT CONTRACTUAL AND PROPERTY OF DS. ANY CHANGE MAY HAPPEN WITHOUT NOTICE                         */ 
    /* ------------------------------------------------------------------------------------------------ */
    /* Customize the logic to select the required tool
    /* ------------------------------------------------------------------------------------------------ */
    
    Let sourceToolQuery (String)
    Set sourceToolQuery = Parameters->GetAttributeString("iToolResourceListSource")
    
    Notify("BL DELToolQuery from # : Start ------", sourceToolQuery)
    
    // Rerieve the current activity --------
    Let NCActivity (ManufacturingOperation)
    Set NCActivity = ThisObject 
    Let NCActivityDrilling (DwDrilling)
    Set NCActivityDrilling = NCActivity
    Let NCActivitySeqDrilling (DwSequentialDrilling)
    Set NCActivitySeqDrilling = NCActivity
    if (NCActivity <> NULL)
    	Notify (NCActivity.Name)
    else 
    	Notify ("no NCActivity")
    
    // Retrieve the list of the tool assembly --------
    Let listToolAssembly(List)
    Set listToolAssembly = Parameters->GetAttributeObject("iToolResourceList")
    
    // Loop on this list ----------------
    Let currFeature, selectFeature (Feature)
    Let currInst (VPMInstance)
    Let currToolAssembly (ResourceNCMillAndDrillToolAssembly)
    Let minGage (Length)
    Notify("Nb Input: #", listToolAssembly.Size())
    for currFeature inside listToolAssembly
    {
    	// Instance in case of tool query from document
    	// Reference in case of tool query from database
    	Set currToolAssembly = currFeature
    	if (currToolAssembly == NULL)
    	{
    		set currInst = currFeature
    		if (currInst <> NULL)
    			set currToolAssembly = currInst.Reference
    	}
    
    	// Filter of the name and the type of activity ------------------
    	if (currToolAssembly <> NULL)
    	{
    		// If drilling activity, need ot filter the "chanfrein" tool
    		If (NCActivityDrilling <> NULL OR NCActivitySeqDrilling <> NULL) 
    		{
    			Notify("Drilling Activity")
    			Let nameToolAssembly (String)
    			Set nameToolAssembly = currToolAssembly.Name
    			if (nameToolAssembly.Search("chanfrein") > 0 OR nameToolAssembly.Search("Chanfrein") > 0 OR OR nameToolAssembly.Search("Chanfrein") > 0)
    			{
    				currToolAssembly = NULL
    				Notify ("# - Skip", nameToolAssembly)
    			}
    			else
    			{
    				Notify ("# - Keep", nameToolAssembly)
    			}
    		}
    	}
    	else Notify ("ERROR")
    
    	// Filter on the minimum tool gage ------------------
    	if (currToolAssembly <> NULL)
    	{
    		if (selectFeature <> NULL)
    		{
    			if(currToolAssembly.V_Tool_Gage < minGage)
    			{
    				Notify("Min Found")
    				Set minGage = currToolAssembly.V_Tool_Gage 
    				Set selectFeature = currFeature
    			}
    		}
    		else // first element of the list
    		{
    			Set selectFeature = currFeature
    			Set minGage = currToolAssembly.V_Tool_Gage
    		}
    	}
    }
    
    Let outToolAssembly(List)
    if ( selectFeature <> NULL)
    {
    	Notify("MillAndDrillToolAssembly")
    	Notify("Selected Tool Name : ", selectFeature.Name)	
    	Notify("Selected Tool Gage : ", minGage)
    
    	// OUPUTS
    	outToolAssembly.Append(selectFeature)
    	Parameters->SetAttributeObject("oSelectedResource", outToolAssembly)
    
    }
    Notify("Nb Output: #", outToolAssembly.Size())
    
    Notify("BL DELToolQuery : End ------")
    
    
    

  • For CATRuleExit file:

    <Scripts>
     <Script OpeningID=" DELToolQuery _ID"  Type=" ManufacturingOperation "  ScriptName=" DELToolQuery " />
    </Scripts>