loop counting

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • loop counting

    I am trying to ask the operator to enter how many times they want to want to run. Below is what i have so far. need some help.


    RUNS =COMMENT/INPUT,NO,HOW MANY TIMES DO YOU WANT TO RUN THE PROGRAM
    REPEAT =LABEL/
    MOVE/POINT,NORMAL,<0.4,0,4>
    DIA_1.200_GREEN_RIGHT=FEAT/CONTACT/CIRCLE,CARTESIAN,IN,LEAST_SQR
    THEO/<0,0,0>,<1,0,0>,1.2,0,0
    ACTL/<-0.00029,0.0004,-0.00042>,<0.9999994,0.001077,0.0001269>,1.20006,0, 0
    TARG/<0,0,0>,<1,0,0>
    ANGLE VEC=<0,0.000072,1>
    DIRECTION=CCW
    SHOW FEATURE PARAMETERS=NO
    SHOW CONTACT PARAMETERS=NO
    ASSIGN/COUNT=1
    ASSIGN/COUNT=COUNT+1
    IF/COUNT<=RUNS.INPUT
    GOTO/REPEAT
    END_IF/
    IF/COUNT>RUNS.INPUT
    GOTO/END
    END_IF/
    END =LABEL/

  • #2
    Another approach could be to use a LOOP -
    1. Insert a COMMENT/INPUT before it asking "How Many Loops?" or other verbage
    2. ASSIGN the input to a variable
    3. Insert the LOOP
    4. Put the variable into the LOOP code as the ending number
    5. Perform function(s)
    6. Insert END of loop
    sigpic

    Comment


    • #3
      Originally posted by ir a programmer View Post
      Another approach could be to use a LOOP -
      1. Insert a COMMENT/INPUT before it asking "How Many Loops?" or other verbage
      2. ASSIGN the input to a variable
      3. Insert the LOOP
      4. Put the variable into the LOOP code as the ending number
      5. Perform function(s)
      6. Insert END of loop
      +1

      I have used this method for years
      DeWain Hodge

      Comment


      • #4
        You are really close with the example you posted. The only difference is move the ASSIGN count=1 above the label "REPEAT". Right now you are re-setting the count to 1 everytime it goes through the code. Hope this helps.

        Comment


        • #5
          The LOOP I used already, just wanted to try a different method. PCDtrainer got it working...thnx..

          Comment


          • #6
            Try something like this maybe?

            ASSIGN/COUNT = 1
            RUNS =COMMENT/INPUT,NO,'How many times to loop?'
            REPEAT =LABEL/
            $$ start : as an example , you can replace your program code here
            COMMENT/OPER,NO,"LOOP COUNT = "+COUNT
            $$ end
            ASSIGN/COUNT = COUNT+1
            IF/COUNT > RUNS.INPUT
            GOTO/STOP_RUNS
            END_IF/
            GOTO/REPEAT
            STOP_RUNS =LABEL/

            B&S CHAMELEON/PCDMIS CAD++ V2011

            There are no bugs, only "UNDOCUMENTED ENHANCEMENTS!"

            sigpic

            Comment

            Related Topics

            Collapse

            Working...
            X