If/Endif

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • If/Endif

    Let me see if I can explain my self properly here or not.... I'm new with the if statements.

    I have a part that when I first get it it has a .500" predrill in it and then goes out for broaching and comes back with a .780" square in it were the hole used to be. (I have to use the drill or square as my origin)

    I ask the operator (yes/no input) before the program executes "Has the broaching operation been completed" click yes or no.

    If operator answers yes I have this:
    If/c3.Input=="Yes"
    I then measure the lines, create mid lines, intersect them for a point
    I then do an alignment translate to the intersect point as my XY origin
    End_if/

    If operator answers no I have this:
    If/c3.Input=="No"
    I measure the .500" predrill
    I then do alignment translate to the predrill as my XY origin
    End_if/

    The problem I'm having is that if the operator answered yes it does not ignore the alignment of the No answer. I thought anything between the IF statement and the END_IF/ statement it ignored depending on the answer including the alignments. If this is not correct then I guess I can't do it this way. I could copy the program over and have two programs depending on what has been complete, but I would rather have one that zeros to what ever feature that has been completed at the time.

    If the IF statement is the incorrect way to procede because pc-dmis does not ignore alignments in IF statements (which it seems it does'nt), what direction would you take to do handle this type of situation?

    Thanks
    Dan

  • #2
    Try a if/goto so that it jumps the area for that alignment

    Comment


    • #3
      variable(s) should work

      Here's one way to do it.

      Write the IF/ENDIF the way you have it. Inside each group, you create the respective alignment and save it as a unique name. Also inside the group(s) you have an assignment statement to copy the name of each alignment ot a common variable. For example,

      If/c3.Input=="Yes"
      measure lines
      A1 = alignment
      Assign A_Good = "A1"
      End_if/

      If/c3.Input=="No"
      measure .500" predrill
      A2 = alignment translate
      Assign A_Good = "A2"
      End_if/


      Then, after both groups, you recal whichever has gotten the variable reference, like this -

      recall alignment/A_Good

      Comment


      • #4
        I use if/goto statement also. They work fine. But are you sure your labels are in the right place? Can you upload the program for us to look at it?
        sigpic

        Comment


        • #5
          Use an esle/if after you if/endif

          Example:

          Code:
          IF/C3.INPUT=="YES"
                      measure the lines, create mid lines, intersect them for a point
                      do an alignment translate to the intersect point as my XY origin
                      END_IF/
                      ELSE/
                      I measure the .500" predrill
                      then do alignment translate to the predrill as my XY origin
                      END_ELSE/
          Craig
          Last edited by craiger_ny; 05-15-2006, 01:18 PM.
          <internet bumper sticker goes here>

          Comment


          • #6
            Thanks all... I used Don's example first and it worked well. I'll try the other ways next because I would like to learn more about these statements. I'll post my results shortly.

            Thanks all!!! You guy really know your stuff!

            Comment


            • #7
              Dr,

              Have more fun and add this to the routine and skip the question to the operator....

              Measure the feature as a circle with 4 points - each point touching where the flats of the square might be. Then, based on the diameter go to the section of the inspection program that measures either the hole (.5") or measures the square(.780"). Set the diameter as if it was .5".

              This allows the program to make the decision and you dont have to stop and wait for the operator!
              Links to my utilities for PCDMIS

              Comment


              • #8
                Good call cmmguy. We have identical parts where we kicked around an idea of machining two different size features depending on what workkcenter it came from and based on that using if/endif to set a variable that represented the workcenter for offsets and tracefields. The limits are as far as you can imagine.
                <internet bumper sticker goes here>

                Comment


                • #9
                  I'll give it a try, I sent the parts on but kept a scrap one to play with so I can learn these things....

                  Thanks!

                  Comment

                  Related Topics

                  Collapse

                  Working...
                  X