Get measured dimension inside loop command

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

  • Get measured dimension inside loop command

    Does anyone know who to extract measured dimensions inside a loop command for repeating features using API? Thanks.

  • #2
    Originally posted by cmshieh View Post
    Does anyone know who to extract measured dimensions inside a loop mcdvoice command for repeating features using API? Thanks.
    here i wanted to ask the same
    Last edited by gandrew; 07-12-2019, 12:15 PM.

    Comment


    • #3
      I presume you are talking about something like this?
      Code:
      assign/v1=dimension1[1].x.meas
      cycle the bracket value for each array index

      you could even do something like this
      Code:
      assign/count=1
      do
      assign/v1=dimension1[count].x.meas
      assign/count=count+1
      until/count==loopcount(whatever your number is)
      what do you plan to do with the values? you could report them within the loop and not have to extract later, that would be cleaner in my opinion.

      Comment


      • #4
        The code looks something like this:

        Code:
        LOOP/START,ID=YES,NUMBER=TUBE_COUNT,START=1,SKIP=,OFFSET:XAXIS=0,YAXIS=0,ZAXIS=0,ANGLE=0
            DIM D29_D30_= POSITION OF CYLINDER FEATURE_CYL_29  USE AXIS=WORST (START PT)  REF LENGTH=0.0000  UNITS=IN ,$
            GRAPH=OFF  TEXT=OFF  MULT=10.00  OUTPUT=BOTH  FIT TO DATUMS=OFF  DEV PERPEN CENTERLINE=OFF  DISPLAY=DIAMETER
            AX    NOMINAL       +TOL       -TOL      BONUS       MEAS        DEV     OUTTOL
            Y      0.0000                                      0.0000     0.0000          
            Z      0.0000                                      0.0000     0.0000          
            DF     0.5180     0.0020     0.0010                0.5180     0.0000     0.0000 -----#------------
            TP        RFS     0.0050                0.0000     0.0000     0.0000     0.0000 #-----------------
            END OF DIMENSION D29_D30_
        LOOP/END
        The intention is to extract the data automatically after running the PC-DMIS program to be uploaded into an in-house database using an automation tool. After some trial-and-error, looks like turning PREVIOUS_RUNS from DELETE_INSTANCES to KEEP_INSTANCES in PRINT/REPORT will do the trick.

        Comment


        • #5

          Code:
          LOOP/START,ID=YES,NUMBER=TUBE_COUNT,START=1,SKIP=,OFFSET:XAXIS=0,YAXIS=0,ZAXIS=0,ANGLE=0
          DIM D29_D30_= POSITION OF CYLINDER FEATURE_CYL_29[loop id] USE AXIS=WORST (START PT) REF LENGTH=0.0000 UNITS=IN ,$
          GRAPH=OFF TEXT=OFF MULT=10.00 OUTPUT=BOTH FIT TO DATUMS=OFF DEV PERPEN CENTERLINE=OFF DISPLAY=DIAMETER
          AX NOMINAL +TOL -TOL BONUS MEAS DEV OUTTOL
          Y 0.0000 0.0000 0.0000
          Z 0.0000 0.0000 0.0000
          DF 0.5180 0.0020 0.0010 0.5180 0.0000 0.0000 -----#------------
          TP RFS 0.0050 0.0000 0.0000 0.0000 0.0000 #-----------------
          END OF DIMENSION D29_D30_
          LOOP/END
          would work.

          also, you could use different modes of data output than print/report. --If you are looking to output the measured values exclusively, you can use two other methods:

          This will output a report with ONLY the measured data of each looped dimension output.
          Code:
          assign/count=1
          do
          assign/v1=DIM D29_D30_[count].Diam.meas 
          comment/report= DIM D29_D30_[count].Diam.meas (or V1, or whatever assignment you want to define for your measured value)
          assign/count=count+1
          until/count==loopcount(whatever your number is)
          or you can completely avoid the print report command and specify a *.CSV file with assignments, then do file/writeline to output the measured value directly into a csv file. Every time routine runs, it appends the data to bottom of CSV. This is what we use.

          Here's an example:
          Code:
          Beginning of routine
          ASSIGN/C_PATH="C:\PRODUCTION\parts.CSV"
          ASSIGN/PART="PARTNUMBER"
          ASSIGN/ROUTINE="PARTNUMBER CMM"
          ASSIGN/TRACE_FOLDER="Traceability-customer CMM"
          ASSIGN/CHAR_1="AA #3 Position "
          ASSIGN/CHAR_2="AB #5 Position "
          ASSIGN/CHAR_3="AD #7 Position "
          ASSIGN/CHAR_4="AD #8 Position "
          ASSIGN/CHAR_5="AE #18 Position "
          ASSIGN/CHAR_6="AF #39 Position "
          ASSIGN/CHAR_7="AG #92 Position "
          ASSIGN/CHAR_8="AH #93 Position "
          
          Before loop:
          C_FILE =FILE/OPEN,C_PATH,APPEND
          FILE/WRITELINE,C_FILE,"/PART NUMBER/" + "," + PART
          FILE/WRITELINE,C_FILE,"/ROUTINE NAME/" + "," + ROUTINE
          FILE/WRITELINE,C_FILE,"/LOT#/" + "," + RUN_ID
          FILE/WRITELINE,C_FILE,"/OPERATOR/" + "," + TRACE_FOLDER + "," + "Operator" + "," + OPERATOR
          FILE/WRITELINE,C_FILE,"/SCHEDULED TIME/" + "," + TRACE_FOLDER + "," + "Scheduled Time" + "," + TIME
          FILE/CLOSE,C_FILE,KEEP
          C_FILE =FILE/OPEN,C_PATH,APPEND
          
          At end of looped segment, so the data outputs each time a part is measured (V1 is Loop ID)
          FILE/WRITELINE,C_FILE,"/CAVITY ID/" + "," + TRACE_FOLDER + "," + "Position " + V1 + "," + POS
          FILE/WRITELINE,C_FILE,"/DATA/" + "," + CHAR_1 + V1 + "," + DIST_AA_1.MEAS
          FILE/WRITELINE,C_FILE,"/DATA/" + "," + CHAR_2 + V1 + "," + DIST_AB_1.D.MEAS
          FILE/WRITELINE,C_FILE,"/DATA/" + "," + CHAR_3 + V1 + "," + DIST_AD1_1.MEAS
          FILE/WRITELINE,C_FILE,"/DATA/" + "," + CHAR_4 + V1 + "," + DIST_AD2_1.MEAS
          FILE/WRITELINE,C_FILE,"/DATA/" + "," + CHAR_5 + V1 + "," + DIST_AE_1.MEAS
          FILE/WRITELINE,C_FILE,"/DATA/" + "," + CHAR_6 + V1 + "," + DIST_AF_1.D.MEAS
          FILE/WRITELINE,C_FILE,"/DATA/" + "," + CHAR_7 + V1 + "," + DIST_AG_1.MEAS
          FILE/WRITELINE,C_FILE,"/DATA/" + "," + CHAR_8 + V1 + "," + DIST_AH_1.MEAS
          FILE/CLOSE,C_FILE,KEEP

          Comment

          Related Topics

          Collapse

          Working...
          X