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>