add a counter to my program

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

  • add a counter to my program

    I need to run 50 parts one at a time before the data file dumps to our ERP system through an external batch file. anyone have experience? was thinking we can do a manual entry of part # and have the program only move ahead to the external Batch file when the number 50 is entered, otherwise have it loop back to measure the next part. any help with code to do this would be great.

  • #2
    Are the operators typically going to be doing 50 parts at a time? If so you can just do a loop that pauses after each part and says "Load Part #X" where X is a variable that bumps up each loop with an assign/X=X+1 line. Then you can do everything in an array such as Dim1[X], Dim2[X], Dim3[X].

    Comment


    • #3
      the problem is they will get bumped out by production and have to start and stop so it really has to be a manual entry for the count. then when they hit 50 it can continue to the end of the program and run the Batch file to do the data transfer to the ERP system.

      Comment


      • #4
        So the machine will be closing out of the program and reopening it to pick up where the operator left off? In that case, yes definitely something like a manual number entry. To achieve what I think you're looking for, I'd do a manual part number entry at the beginning of the program and then loop the entire measurement routine. To break out of it, right before the end of the loop maybe try something like IF_GOTO/PARTNO == 50, GOTO = L1 where L1 is a label just after the loop end. This way it'll loop continuously until it sees that part #50 has been measured and then run the rest of the program.

        Comment


        • #5
          Have you tried "STATS ON" command? It will automatically number each run for you.
          sigpic
          Originally posted by AndersI
          I've got one from September 2006 (bug ticket) which has finally been fixed in 2013.

          Comment


          • ajlee7
            ajlee7 commented
            Editing a comment
            Since you brought this up, do you know if it's possible to use the STATS number anywhere in the program as an assigned variable?

        • #6
          AJLEE exactly what i was looking for! I will try it like that.

          Comment


          • #7
            I believe I have posted code in the custom code section as of how to save stuff to file and also reading from file. Include a counter in your program that saves the number to file at the end of your program and include code to read that value from file at the beginning of it.

            Or, follow Matts advice regarding the STAT.
            PC-DMIS CAD++ 2o19 R1 SP11

            Comment

            Related Topics

            Collapse

            Working...
            X