Jump to content

"if" Statements in User Defined Checks


---
 Share

Recommended Posts

hi, first time posting here

I am trying to choose to report the circle without an error, and if they are both calculating, the closest to nominal.

But if the inputs contain a un-computed value the whole result will also be un-computed, is there a way around this?

Thanks in advance,

Nyall
image.thumb.png.c4249844ec8234610c92079925c297dd.pngimage.png.706f583635e1f943ab96ca86848a515e.png

Link to comment
Share on other sites

I think I have the solution... if anyone else comes across a similar  issue, the proper test for if an element is uncomputed is:

x = "???"
if  A.actual.computation_status != INVALID:
    if B.actual.computation_status != INVALID:
        if abs(C.nominal.diameter - A.value) < abs(C.nominal.diameter - B.value) :
            x = A.actual.diameter
        else:
            x = B.actual.diameter
    else:
        x = A.actual.diameter
else:
    if B.actual.computation_status != INVALID:
        x = B.actual.diameter
    else:
        x = "???"
x


image.png.d80f30eea1df4665b4d22725af1eccf8.png

  • Like! 1
Link to comment
Share on other sites

Interesting, I didn't know you could use custom python code in the user defined, I was always using the basic functions in the fx dropdown. We measure difficult features and I many times need to construct many feature to get an average or to avoid question marks. This will help me in the future, thanks.

Link to comment
Share on other sites

 Share

×
×
  • Create New...