Context Object Parameters
Parameter Name |
Type |
Read/Write |
Comments |
ReturnedOcc |
ObjectType |
Read |
Returns the occurrence computed from the input
occurrence. |
Sample
The following sample returns the owner part of the input occurrence if any, or the
input occurrence.
/* M2P 11/30/2013 */
let thisOcc(ProductOccurrence)
let initObjOcc(ProductOccurrence)
let thisOccAux(ProductOccurrence)
let thisRef(ProductOccurrence)
let thisResult(ProductOccurrence)
let i(Integer)
let attr(String)
let returnObj(Feature)
let ReturnedObject(Feature)
/*put into attr the name of the attribute*/
attr = "V_description"
i = 0
thisOcc = ThisObject
initObjOcc = ThisObject
/*iterate on each owner of the part to find the one with the attribute attr*/
for i while thisOcc <> NULL AND thisResult == NULL
{
thisRef = thisOcc.Reference
if(thisRef <> NULL)
{
/*Check if the attribut is defined*/
if(thisRef.GetAttributeString(attr) == "ReturnThis")
{
thisResult = thisOcc
}
else
{
if thisOcc.HasAttribute("Owner")
{
set thisOccAux = thisOcc.Owner
thisOcc = thisOccAux
}
else
thisOcc = NULL
}
}
}
if(thisResult <> NULL)
returnObj = thisResult
else
{
if thisOcc <> NULL
returnObj = thisOcc
else
returnObj =initObjOcc
}
/*Return the found attribute*/
if Parameters.HasAttribute("ReturnedObject")
{
Parameters.SetAttributeObject("ReturnedObject",returnObj)
ReturnedObject = Parameters.GetAttributeObject("ReturnedObject")
}