/*Rule created by BBY4 9/20/2019*/ /*
* We are going to retrieve all Inner Cut Tools of the part and test the
circularity of them. * If it is circular, the hole type will be
standard type. Otherwise, it will be form type. */ /* Declaration
of variables */ Let featurePart(Part) Let
listOfToolsInnerCut(List) Let iNbOfInnerCutTools(Integer) Let
iNbOfToolsCircular(Integer) Let iNbOfToolsNonCircular(Integer) Let
featureInnerCutToolTemp(InnerCutTool) Let featureInputElement(Feature)
Let listInputElements(List) Let I(Integer) Let J(Integer) Let
booleanInnerCut(Boolean)
/* Initialize variables */ Set I=1
Set iNbOfInnerCutTools=0 Set iNbOfToolsCircular=0 Set
iNbOfToolsNonCircular=0 Set booleanInnerCut=false
/* Retrieve the part */ featurePart =
GetPartFeature()
/* Retrieve the tools */
listOfToolsInnerCut =
featurePart ->Query("InnerCutTool","")
for I while I <=
listOfToolsInnerCut.Size()
{
/* Initialize the variable J */
Set J=1
listInputElements->RemoveAll()
/* Retrieve the item I */
featureInnerCutToolTemp = listOfToolsInnerCut.GetItem(I)
/* Test on inner */
if featureInnerCutToolTemp ->GetAttributeString("Cut Sub Type") ==
"Pierce/Inner Cutting"
{
Set booleanInnerCut = true
}
if featureInnerCutToolTemp ->GetAttributeString("Cut Type") ==
"Pierce/Inner Cutting"
{
Set booleanInnerCut = true
}
/* Test on boolean */
if booleanInnerCut == true
{
iNbOfInnerCutTools = iNbOfInnerCutTools + 1
/*Retrieve the elements of the inner cut tool */
listInputElements = featureInnerCutToolTemp->GetInputElements()
/* Debug */
/* Message("Number of inputs : #", listInputElements.Size()) */
for J while J <= listInputElements.Size()
{
featureInputElement = listInputElements.GetItem(J)
/* Search for boolean */
if featureInputElement ->GetAttributeBoolean("Is Circular Hole")
== true
{
iNbOfToolsCircular = iNbOfToolsCircular + 1
/* We set the hole type to standard */
featureInputElement ->SetAttributeString("Hole Type", "Standard")
}
else
{
iNbOfToolsNonCircular = iNbOfToolsNonCircular + 1
/* We set the hole type to form */
featureInputElement ->SetAttributeString("Hole Type", "Form")
}
}
} } /* Display informations*/ /* Message("Number of inner
cutting tools is : #", iNbOfInnerCutTools) */ /* Message("Number of
circular holes is : #", iNbOfToolsCircular) */ /* Message("Number of
non circular holes is : #", iNbOfToolsNonCircular) */ if
iNbOfToolsCircular > 0
Message("# Hole types have been changed to standard",
iNbOfToolsCircular) if iNbOfToolsNonCircular > 0
Message("# Hole types have been changed to form", iNbOfToolsNonCircular )
|