hexagon logo

Error Handling option coding


Hi guys, its been a while ! Need some help....I have the basics down for error handling and have code for one option, part of level 3 pc-dmis training....but want to go one step more....


So, if I wanted it to do something else, rather than increment around 22.5 degrees....then what ?

Lets say I wanted it to flag the operator, pause the program and let him manually measure it avoid a bad spot, then carry on the program again....

Sorry, coding is my weakest link here and I figured someone may have code doing something the same or similar....open to any and all coding examples.....

TIA !
  • Jim,
    Eh, let's not go out on the limb over thin ice of trusting an operator to manually miss possible form defects...
    Try this:

    
    LABEL/Begin_trying
    
    
    DCC CIR_1 measured with 8 hits, make it an Autocircle with an avoidance move After to get the tip out of the hole.
    
    Dimension CIR_1 for roundness, let's name this dimension RND1
    
    IF/ RND1.OUTTOL > 0
    
    [COLOR=#008000].    The If Test to see if the out-of-tol number delivered by the dimension is greater than zero will return True of False, 1 or 0.
     .    Now if the test turned out to be True, then any and all code between the IF and the END_IF gets executed.
    .                                      but if the test returned False then all the code between the IF and END_IF gets skipped.)
    .    So here are the actions that happen if the roundness fails:[/COLOR]
    
    .   Operator Comment: "Clean the hole with denatured alcohol and lint-free material, then click OK
    
    .   GOTO/Begin_trying
    
    END_IF
    
    


    Now the sharp eyed will immediately grin and wag a finger with a stern warning about the danger of Infinite Loops!
    Then we add some more fun stuff to the code to fix that:

    [COLOR=#0000FF]Assign/Counter_Variable=0[/COLOR]
    
    LABEL/Begin_trying
    
    [COLOR=#0000FF]Assign/Counter_Variable=Counter_Variable + 1
    
    
    IF Counter_Variable > 3
    
    .    Operator Comment, "Inform production of roundness defect"
    
    .   GOTO Skip_Position
    
    END_IF[/COLOR]
    
    
    DCC CIR_1 measured with 8 hits.
    
    Dimension CIR_1 for roundness RND1
    
    IF/ RND1.OUTTOL > 0
    
    .   Operator Comment: "Clean the hole with denatured alcohol and lint-free material, then click OK
    
    .   GOTO/Begin_trying
    
    END_IF
    
    [COLOR=#0000FF]Dimension Position & size of CIR_1
    
    LABEL/Skip_Position[/COLOR]
    
    


  • Do/ and UNTIL are red, so you should re-create a do until, then copy / paste the code between them, copy paste the UNTIL case, and delete the first...
    I think your code should do what you are looking for.
  • Do/ and UNTIL are red, so you should re-create a do until, then copy / paste the code between them, copy paste the UNTIL case, and delete the first...
    I think your code should do what you are looking for.


    His picture is actually borrowed from the Hex Level 3 training exercise. They printed the Do & Until pair red on purpose to make them stand out.
    In fact they have tons of red as the author's coding style was to hand-type add the first half of the logic pair (so it goes red), then the in-between code, then hand-type complete the logic pair - instead of the way you (and I) like of adding the pairs as a set with the drop-down menus and then adding code between them.

    IMO, that particular lesson is a bit of ridiculous exercise for 99% of real-world applications, because finding bad roundness is normally not something inspection strives to purposefully skip over and ignore.

    The key point to learn from it is the ability to automate changing DCC motion parameters based on conditions found. Jim wanted to include operator actions, so my reply went in that direction with a setup I've employed lots of times: clean the dang part.

    Where I work now we run CMMs in a standardized production environment. While it would seem like adding tons of error-handling logic would be beneficial it turns out that the burden of proving out and then supporting and maintaining the far more complex programs ends up costing us more time and effort than making programs simple and rugged that anyone with Level 1 basic skills can quickly troubleshoot.

    One key point about logic branches in PC-DMIS is that you cannot stop the program and re-start it at that same spot, you usually have to start over from the beginning as all the dynamic/temporary values of variables and True/False results of IF tests completely disappear and nothing works.