Looping help

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

  • Looping help

    I'm having difficulty searching and was wondering if someone could help me. I want to create a loop that ask the operator if they want to check another part. (checking multiple parts but not a defined amount) but can't seem to find any threads that meet what i'm looking for.

    Kinda along these lines

    "do you want to check another?"

    "yes" would run the loop and back to the beginning,

    "no" would end the loop and print off the report with all the parts ran.

    UPDATE:

    Here's what I came up with I also added a comment and dimension so it will print every part with an entered part number to one single report. good for CAP studies where we number each part.

    STARTUP =ALIGNMENT/START,RECALL:USE_PART_SETUP,LIST=YES
    ALIGNMENT/END
    MODE/MANUAL
    PREHIT/0.1
    RETRACT/0.1
    MOVESPEED/ 100
    MANRETRACT/0.1181
    FORMAT/TEXT,OPTIONS, ,HEADINGS,SYMBOLS, ;NOM,TOL,MEAS,DEV,OUTTOL, ,
    LOADPROBE/2X50MM
    TIP/T1A0B0, SHANKIJK=0, 0, 1, ANGLE=0
    PLN1 =FEAT/PLANE,CARTESIAN,TRIANGLE
    THEO/<12.3841,10.8092,-24.3772>,<0.0000203,-0.0001256,1>
    ACTL/<12.7461,11.4439,-24.4182>,<-0.0010152,-0.0000618,0.9999995>
    MEAS/PLANE,3
    HIT/BASIC,NORMAL,<12.4297,11.351,-24.3771>,<0.0000203,-0.0001256,1>,<12.7412,11.5325,-24.4182>,USE THEO=YES
    HIT/BASIC,NORMAL,<11.9393,10.6151,-24.3772>,<0.0000203,-0.0001256,1>,<12.6315,11.3995,-24.4183>,USE THEO=YES
    HIT/BASIC,NORMAL,<12.7834,10.4614,-24.3772>,<0.0000203,-0.0001256,1>,<12.8656,11.3999,-24.4181>,USE THEO=YES
    ENDMEAS/
    CIR1 =FEAT/CIRCLE,CARTESIAN,IN,LEAST_SQR
    THEO/<12.4197,10.7849,-24.4932>,<0,0,1>,0.7599
    ACTL/<12.69,10.9125,-24.4995>,<0,0,1>,0.7603
    MEAS/CIRCLE,3,ZPLUS
    HIT/BASIC,NORMAL,<12.4194,11.1648,-24.4942>,<0.0009949,-0.9999995,0>,<12.6863,11.2927,-24.5007>,USE THEO=YES
    HIT/BASIC,NORMAL,<12.7961,10.7326,-24.4933>,<-0.9904903,0.1375824,0>,<12.3554,10.7321,-24.4989>,USE THEO=YES
    HIT/BASIC,NORMAL,<12.0434,10.7322,-24.4922>,<0.9903483,0.1386009,0>,<13.0247,10.7322,-24.4988>,USE THEO=YES
    ENDMEAS/
    A1 =ALIGNMENT/START,RECALL:STARTUP,LIST=YES
    ALIGNMENT/LEVEL,ZPLUS,PLN1
    ALIGNMENT/TRANS,ZAXIS,PLN1
    ALIGNMENT/TRANS,XAXIS,CIR1
    ALIGNMENT/TRANS,YAXIS,CIR1
    ALIGNMENT/END
    MODE/DCC
    MOVE/CLEARPLANE
    CLEARP/ZPLUS,0.1,ZPLUS,0,ON
    MOVE/CLEARPLANE
    L1 =LABEL/…………………………………………………………….. (this line starts the loop)
    C2 =COMMENT/INPUT,NO,FULL SCREEN=NO,
    Part number?...………………………………………………………. (here I ask what the number on the part is and ASSIGN it to a variable)
    ASSIGN/V1=C2.INPUT
    PLN2 =FEAT/CONTACT/PLANE/DEFAULT,CARTESIAN,NONE
    THEO/<0,0,0>,<0,0,1>
    ACTL/<0,0.0001,-0.0001>,<0.0002898,-0.0004154,0.9999999>
    TARG/<0,0,0>,<0,0,1>
    ANGLE VEC=<0.0000001,1,0>,RADIAL
    SHOW FEATURE PARAMETERS=NO
    SHOW CONTACT PARAMETERS=NO
    MOVE/CLEARPLANE
    CIR2 =FEAT/CONTACT/CIRCLE/DEFAULT,CARTESIAN,IN,LEAST_SQR
    THEO/<0,0,-0.12>,<0,0,1>,0.76
    ACTL/<-0.0001,0.0001,-0.12>,<0,0,1>,0.7604
    TARG/<0,0,-0.12>,<0,0,1>
    START ANG=0,END ANG=360
    ANGLE VEC=<0.0000001,1,0>
    DIRECTION=CCW
    SHOW FEATURE PARAMETERS=NO
    SHOW CONTACT PARAMETERS=NO
    COMMENT/REPT,

    COMMENT/REPT,
    "Part #"+V1...……………………………………………………. (here it prints what's in the quotes and adds the entered number, I had to go with NO spaces around the + sign to make it work)
    DIM BORE= LOCATION OF CIRCLE CIR2 UNITS=IN ,$
    GRAPH=OFF TEXT=OFF MULT=10.00 OUTPUT=BOTH HALF ANGLE=NO
    AX NOMINAL +TOL -TOL MEAS DEV OUTTOL
    D 0.7600 0.0020 0.0020 0.7604 0.0004 0.0000 -----#---
    END OF DIMENSION BORE
    MOVE/CLEARPLANE
    C1 =COMMENT/YESNO,NO,FULL SCREEN=NO,AUTO-CONTINUE=NO,
    Run another part?
    IF_GOTO/C1.INPUT=="YES",GOTO = L1...………………………………….. (this sends it back to the L1 label and starts the loop over, or ends the program with a "no" selection)
    MOVE/CLEARPOINT

    it works good. I start with manual hits to locate and set the part's position, then use DCC hits to measure the same features over and over, to be complete I should use another alignment after the loop starts but this is just a basic loop program I did to learn how to make it work. as long as you have a fixture that holds the part steady in the same place this setup could work well. Be careful to start over from the beginning for each session or it will keep adding to the list on the printout instead of starting over. or if you get stopped mid stream and want to complete it later, just leave it open and running at a comment and come back later.
    Last edited by DB not cooper; 01-24-2020, 09:35 PM.

  • #2
    You could do it with a if/goto, with a label at the start, or a DO/UNTIL (C1.INPUT="NO") or a WHILE/C1.INPUT=="YES".

    Comment


    • DB not cooper
      DB not cooper commented
      Editing a comment
      I think I see, start with the comment = yes and put the comment asking to do another part input at the bottom of the loop?
      Last edited by DB not cooper; 01-23-2020, 05:43 PM.

  • #3
    Check out “Branching by using Flow control” in the help file.

    Something like ............

    Code:
    startup
    loadprobe
    tip/
    mode/dcc
    
    [COLOR=#d35400]PROG_START = LABEL/[/COLOR]
    
    main program code
    
    [COLOR=#e74c3c]C2 = COMMENT/YESNO,NO,Full Screen=NO,MEASURE ANOTHER PART?
    
    IF/C2.INPUT==“YES”
    GOTO/PROG_START
    END_IF[/COLOR]
    Last edited by dph51; 01-23-2020, 04:04 AM.

    B&S CHAMELEON/PCDMIS CAD++ V2011

    There are no bugs, only "UNDOCUMENTED ENHANCEMENTS!"

    sigpic

    Comment


    • #4
      The easiest way is to turn on the Wizards toolbar, and click the MultiExecute button (6:th from left, big exclamation mark). Handles both defined and undefinied number of loops, without any changes needing to be done to the part program.
      AndersI
      SW support - Hexagon Metrology Nordic AB

      Comment


      • DB not cooper
        DB not cooper commented
        Editing a comment
        not sure if I have that, we have 2 different versions so we try to write programs to work on the oldest so they will work on both. oldest is 2012

      • AndersI
        AndersI commented
        Editing a comment
        The Wizards toolbar is older than that...

    • #5
      I've always done it like this:

      Loop/start

      part code here

      c1=comment/yesno
      "would you like to measure another part?"
      if_goto/c1.input=="no",goto=L1
      L1=label/

      I know that's not a perfect example but basically you just set up a loop that will run 1,000 times unless the operator hits "no" and breaks it.

      Comment


      • #6
        Easiest way I have always done it, You know how many parts you are going to start with, so you ask "How Many Parts Do You Want To Run? "
        Put in a Comment at the begining so it stops in between each part so it pauses so you can put the next part on "Place Next Part On Fixture" this would be irrevelant on the first part.
        Instead of putting a number in the LOOP command just put C1.INPUT (or whatever your Input is called) that way whatever number you answer the question with it would just run that many times.

        Code:
        [COLOR=#C0392B]C1[/COLOR] =COMMENT/INPUT,NO,FULL SCREEN=NO,
        How Many Parts Do You Want To Run?
        V1 =LOOP/START,ID=YES,NUMBER=[COLOR=#E74C3C]C1.INPUT[/COLOR],START=1,SKIP=,
        OFFSET:XAXIS=0,YAXIS=0,ZAXIS=0,ANGLE=0
        
        COMMENT/OPER,NO,FULL SCREEN=NO,AUTO-CONTINUE=NO,
        Place Next Part On Fixture
        
        
        ************************************************
        
        
        Program
        
        
        
        ************************************************
        LOOP/END
        Last edited by KIRBSTER269; 01-23-2020, 03:34 PM.
        (In Memory of my Loving wife, "Ronda" who I lost March 7, 2016. I love you baby.)
        They say "Nobody's Perfect." I must be Nobody.

        Comment


        • DB not cooper
          DB not cooper commented
          Editing a comment
          yes I have one like that, however sometimes we do not know if we will get thru all the parts before the end of the shift so being able to stop at will works best. Thank you for the help.

      Related Topics

      Collapse

      Working...
      X