Jump to content

myArray, collection is empty?


Recommended Posts

The code below works fine in v2019 on multiple CMM's.
Once used on Calypso v2022, it fails.

The error is telling me the "myArray=getCFNames(GroupName).asArray.asString" is "Empty".
What has changed from v2019 to v2022?

We use Groups with Nested Groups.
defineFunctionStart("SET_CFAttribute")
MyName=getFunctionObjectName()
GroupName=getCFGroupname2(MyName)
GroupNameINOUT=true
myArray=getCFNames(GroupName).asArray.asString
for i=1 to getCFNames(GroupName).size
charName = strElement(i*2,"'",myArray)
if getActual(charName).inTolerance == false
GroupNameINOUT=false
endif
next i
setCFAttribute("u_{2403}","IN") 
if GroupNameINOUT == false
setCFAttribute("u_{2403}","OUT") 
endif
CF_Attribute="IN"
if GroupNameINOUT == false
CF_Attribute="OUT"
endif
defineFunctionEnd("CF_Attribute")
generateTableColumn("u_2403","SET_CFAttribute")

PCM errpr_Internal error.JPG

Link to comment
https://qualityforum.zeiss.com/topic/6934-myarray-collection-is-empty/
Share on other sites

Well, for strElement must be provided as third parameter really string - but either i don't understand what you want to achieve, or that code is not written well.

I would guess you want to retrieve first element from array, then instead of strElement use myArray[0] - wild guess.

But now you know, you get some data.

Please sign in to view this quote.

The PCM code was written by Zeiss employee.
What it does, goes thru a Group/Nested Groups and tests for "IN" or "OUT" tolerance conditions.

Any characteristic in the Group or Nested Group that is out of tolerance has the entire Group or Nested Group placed on an "Exception" PiWeb report.
The programs are all in Groups and nested Groups, hence, "getCFGroupname2(MyName)".
We have ran into two issues with this code.
1. If a characteristic is using a Best-Fit for a group of holes its output crashes the PCM code at the line stated originally.
myArray=getCFNames(GroupName).asArray.asString
1a. Moving the Best-Fit characteristic outside of all Groups has allowed the code to function as intended.
See image: Access attribute not allowed_PCM.JPG
(Subsequently, the image "Access attribute not allowed_PCM.JPG" shows the order of Groups with the Best-Fit in the Group).
1b. The Characteristic can fall in between Groups, but must not be inside a group.

2. The code will not work when running the same CMM program on Calypso v2022 under the above condition of 1a and 1b.
Something in v2022 must have changed with "getCFGroupname2" is my best guess right now.

Please sign in to view this quote.


This is probably the single biggest caveat with undocumented/unsupported PCM commands. There is no communication on when specific commands will be discontinued, syntax adjusted or operation altered. Even a Service Pack can (and has) disabled some undocumented PCM.

If this PCM routine was written by a ZEISS Applications Engineer, I would advise that it is best to reach back out to that AE for direct assistance. I am guessing this was a member of the US ZEISS IQS Metrology Services team. I would assume you have their contact info from when they discussed and shared this with you. Looking at this specific operation block, that AE had a high level of understanding of the operation, technicalities, and nuances of PCM. I would be willing to bet a significant amount of time went into writing and debugging this operation for a very specific application so you should have a direct line to them. I would be confident in stating that I bet that AE likely has already addressed this PCM versioning conflict and has a working revision.
  • 3 months later...

Please sign in to view this quote.

"generateTableColumn("u_2403","SET_CFAttribute")" does the following:
  • goes through every characteristic (regardless of group depth)
  • runs the passed in function ("SET_CFAttribute")
  • sets the returned result to the specified table file entry ("u_2403")
I could see "myArray=getCFNames(GroupName).asArray.asString" would fail if the referenced characteristic was not in a group:

Example: "Diameter1" is a lone characteristic, ungrouped:
  • MyName → "Diameter1" ◄ getFunctionObjectName() returns the name of the current characteristic
  • GroupName → "" ◄ getCFGroupname2("Diameter1") returns the group name, which is an empty string
  • getCFNames("") → an empty Ordered Collection
  • using ".asArray.asString" on an empty collection → cannot make a string from an empty collection
  • Internal Error: "this collection is empty"
With that in mind... I don't think it's necessary to do the looping through characteristics in a group when "generateTableColumn" will already get every single characteristic. It would be necessary however to loop through the result (of "getFunctionObjectName") when there is a pattern of features or multiple results in the characteristic.

Try this and see if it works:

defineFunctionStart("SET_CFAttribute")
    characteristicName = getFunctionObjectName() // Current Characteristic Name
    CF_Attribute = "IN"  // Pass
    
    // below could be doing double the work, uncomment below if your solution isn't working
    //setCFAttribute("u_{2403}","IN")
    
    // Check if single characteristic
    if characteristicName.size == 0
        // Check if in tolerance, if not: set attribute "OUT"
        if getActual(characteristicName).inTolerance == false
            // Fail
            CF_Attribute = "OUT"
            
            // below could be doing double the work, uncomment below if your solution isn't working
            //setCFAttribute("u_{2403}","OUT")
        endif
    endif
    
    // Check if multiple characteristics, i.e. bore pattern
    if characteristicName.size <> 0
        // Iterate through all in array
        for i = 1 to characteristicName.size
            // Check if in tolerance, if not: "OUT"
            if getParameterNamed(getActual(characteristicName), i).inTolerance == false
                // Fail
                CF_Attribute = "OUT"
                
                // below could be doing double the work, uncomment below if your solution isn't working
                //setCFAttribute("u_{2403}","OUT")
            endif
        next i
    endif
defineFunctionEnd("CF_Attribute")

// Runs the "SET_CFAttribute" function on every characteristic in the program
// sets the return value in defineFunctionEnd to the user defined "u_2403" field
generateTableColumn("u_2403","SET_CFAttribute")

calculation_end_pcm.txt

×
×
  • Create New...