hexagon logo

Onerror

I am trying to use the ONERROR (edge not detected) command allow the CMM to locate a part fixtured on a mandrel. It is a part we have to measure with the zoom lens. I would like for it to first look at specific coordinates, then subtract .5mm each time it misses. I'm getting no where. I've done something similar before in Level 3 training, but that was several years ago. I'm on PCDMIS 2012 MR1 and an Optive Performance. Any ideas?

Thanks!
  • Excellent question! Please hold while I draft a response

    EDIT:
    I have an Optiv Performance 1z443 with the Zoom lens you describe (fun!)
    Basically I'd recommend this:

                            ASSIGN/NUM_RETRIES=3
                            ASSIGN/VCOUNTER=0
                            ASSIGN/V2=<Start value for feature>
    LBL_RETRY   =LABEL/
                            ASSIGN/IS_FAILED=0
                            ONERROR/EDGE_NOT_DETECTED,SET IS_FAILED
    

    Place this right before your feature.
    What this does is set a variable, IS_FAILED, to 1, if the Edge is not detected.
    Below the feature, you would have this
    ONERROR/EDGE_NOT_DETECTED,OFF
    IF/IS_FAILED
    ASSIGN/VCOUNTER=VCOUNTER+1
    IF/VCOUNTER=NUM_RETRIES
    COMMENT/OPER...
    Focus failed 3 times. Exiting...
    PROGRAM/END
    END_IF
    ASSIGN/V2=V2-5
    GOTO/LBL_RETRY
    END_IF
    ASSIGN/VCOUNTER=0
    ASSIGN/IS_FAILED=0
    


    And you would use the variable V2 in your feature, which gets subtracted by 5 each time the feature fails to get focus.

    EDIT 2:
    If the feature fails to get focus after 3 retries (defined by the NUM_RETRIES variable), it will simply end the program. If the feature gets focus the first time, last time, or any time in between, it will simply move on to the next feature.

    I had to do something similar where I had a part that the rotational alignment for our rotary was defined by that would be on either the top or the bottom of the part. It would focus, and if it failed it would rotate the part 180° and try again. When I used Matching edge, it basically checked if a hole was there or not.

    It should work in the way you're looking for, however.
  • Are you familiar with how assignments function in PC-DMIS? They come in real farkin' handy in sitcheeashuns liek this
  • I tried your code. For some reason it will not move. It tries to locate the edge in the same location all three times.
    Th
  • I just noticed the value V1 value changes in the feature, but does not move the zoom lens. That's odd...
  • I forgot to put the variable in the target value, it works! Thanks you guys for your help!
  • Glad you could get it working.

    Variables can be tricky, especially to those that are unfamiliar with them.
    Once you get the hang of how they work and what you can do with them, they can be really helpful at getting the best readings.

    Heck, some programs I couldn't even do within a reasonable amount of time without variables, and if I want them fully automatic? Definitely.
    Hence why I suggested using the OnError capability to enable a variable, and then using that variable to determine "alright, it failed, now what?", instead of some other way that may not have involved variables.