Smart Mechanical Components Functions

Smart Mechanical Components Functions provide knowledge to retrieve projected areas or modify the attributes of holes for process export.

This page discusses:

GetPartFeature

According to the parameter of circularity in the process export attributes, you can access different type of the process in the Knowledge Advisor. You can create rules to modify the process export attribute.

Signature

GetPartFeature() : Part

ReturnType

Part

Example

/*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 )

ProjectedArea

You can compute the projected area of a surface.

Signature

ProjectedArea(iSurface : Surface, iAxisSystemZ : AxisSystem) : AREA

Arguments

Name Input/Output Required? Type Comment
iSurface In Yes Surface -
iAxisSystemZ In Yes AxisSystem -

ReturnType

AREA

ProjectedArea

You can compute the projected area of a solid.

Signature

ProjectedArea(iSolid : Solid, iAxisSystemZ : AxisSystem) : AREA

Arguments

Name Input/Output Required? Type Comment
iSolid In Yes Solid -
iAxisSystemZ In Yes AxisSystem -

ReturnType

AREA