DO/UNTIL problem

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

  • DO/UNTIL problem

    Hi all !
    I have an old program that uses a DO/UNTIL loop inside a classical loop. It worked fine some years ago, and I have to use it now (2014.1 SP5) and it doesn't work.
    I re-write it, and it doesn't work !!!
    I changed DO/UNTIL by a WHILE/END WHILE and it works fine.
    I tried a DO/UNTIL out of the loop and it works fine...

    I use DO/UNTIL EOF to read a text file and measure points from it, and it reads only 1 or 2 lines. WHILE/!EOF reads all the lines...

    Should it be a bug ??????

  • #2
    It's an "undocumented enhancement "!

    B&S CHAMELEON/PCDMIS CAD++ V2011

    There are no bugs, only "UNDOCUMENTED ENHANCEMENTS!"

    sigpic

    Comment


    • #3
      Originally posted by JEFMAN View Post
      Hi all !
      I have an old program that uses a DO/UNTIL loop inside a classical loop. It worked fine some years ago, and I have to use it now (2014.1 SP5) and it doesn't work.
      I re-write it, and it doesn't work !!!
      I changed DO/UNTIL by a WHILE/END WHILE and it works fine.
      I tried a DO/UNTIL out of the loop and it works fine...

      I use DO/UNTIL EOF to read a text file and measure points from it, and it reads only 1 or 2 lines. WHILE/!EOF reads all the lines...

      Should it be a bug ??????
      I had a problem with using EOF and a Do Until also, in 2015.0 though.
      Unfortunately I was pressed for time and could not properly diagnose it.

      Can you post your chunk of code so i can emulate it for testing?

      Comment


      • #4
        Sorry for the length of this post, I try to show what's working and what's not...

        The old code, inside a loop (which worked fine on 3.7, long time ago) was :
        Code:
        FPTR1      =FILE/OPEN,TEST_READING.TXT,READ
                    DO/
                    RECALL/ALIGNMENT,EXTERNAL,REF5
        REF5       =ALIGNMENT/START,RECALL:REF5,LIST=YES
                      ALIGNMENT/ROTATE_OFFSET,ROTATION_REF,ABOUT,ZPLUS
                    ALIGNMENT/END
                    COMMENT/REPT,
                    temporisation
        ETAT       =FILE/READLINE,FPTR1,{nom}+" , "+{x_pti}+" , "+{y_pti}+" , "+{z_pti}+" , "+{i_pti}+" , "+{j_pti}+" , "+{k_pti}
                    ASSIGN/NOM_PT=NOM
                    COMMENT/REPT,
                    "texte :"+NOM_PT+","+X_PTI+","+Y_PTI+","+Z_PTI+","+I_PTI+","+J_PTI+","+K_PTI
        NOM_PT     =FEAT/CONTACT/VECTOR POINT/DEFAULT,CARTESIAN
                    THEO/<X_PTI,Y_PTI,Z_PTI>,<I_PTI,J_PTI,K_PTI>
                    ACTL/<-0.0001,0.002,89.7098>,<0,0,-1>
                    TARG/<X_PTI,Y_PTI,Z_PTI>,<I_PTI,J_PTI,K_PTI>
                    SNAP=NO
                    SHOW FEATURE PARAMETERS=NO
                    SHOW CONTACT PARAMETERS=YES
                      AVOIDANCE MOVE=NO,DISTANCE=0
                    SHOW HITS=NO
        DIM CAR2= LOCATION OF POINT PT_INT_19  UNITS=MM ,$
        GRAPH=OFF  TEXT=OFF  MULT=100.00  OUTPUT=BOTH  HALF ANGLE=NO
        AX       MEAS    NOMINAL       +TOL       -TOL        DEV     OUTTOL
        T       0.2902     0.0000     0.0500    -0.0500     0.2902     0.2402 -------->
        END OF DIMENSION CAR2
                    COMMENT/REPT,
                    "texte :"+NOM_PT+","+NOM_PT.XYZ+","+NOM_PT.IJK+","+NOM_PT.TXYZ+","+NOM_PT.TIJK
                    ASSIGN/ANGLE_POL_PT=(ATAN(SQRT((NOM_PT.X)^2+(NOM_PT.Y)^2)/(NOM_PT.Z-10)))
                    ASSIGN/T_VAL_PT=CAR2.T.MEAS
                    FILE/WRITELINE,FPTR,","+ANGLE_POL_PT+""+VIRGULE+""+T_VAL_PT
                    UNTIL/ETAT=="EOF"
                      FILE/CLOSE,FPTR1,KEEP
        Now, it doesn't work, PC-DMIS reads only 1 or 2 lines before continue the loop.

        I tried also :
        Code:
        FPTR_2       =FILE/OPEN,ELLIPSE_IMPORT_IGES_PT_INT.TXT,READ
                    DO/
        V2         =FILE/READLINE,FPTR_2,{nom_pt}+" , "+{x1}+" , "+{y1}+" , "+{z1}+" , "+{i1}+" , "+{j1}+" , "+{k1}
        NOM_PT     =GENERIC/POINT,DEPENDENT,CARTESIAN,$
                    NOM/XYZ,<X1,Y1,Z1>,$
                    MEAS/XYZ,<X1,Y1,Z1>,$
                    NOM/IJK,<I1,J1,K1>,$
                    MEAS/IJK,<I1,J1,K1>
                    UNTIL/EOF("FPTR_2")
                      FILE/CLOSE,FPTR_2,KEEP
        which doesn't work (alone or in a loop)

        For writing, the code below works fine alone (I just need to close/open the prog to make it work !)
        Code:
        ASSIGN/V7=1
                    ASSIGN/V16=SCN1.NUMHITS
        FPTR_2     =FILE/OPEN,TEST_WRITING.TXT,APPEND
                    DO/
                    ASSIGN/V5="SCN1.HIT["+V7+"]"
                    ASSIGN/V8=V5.PR
                    ASSIGN/V9=V5.Z-10
                    ASSIGN/V10=RAD2DEG(ATAN(V8/V9))
                    ASSIGN/V11=DOT(V5.XYZ-V5.TXYZ,V5.TIJK)
                    FILE/WRITELINE,FPTR_2,V10+VIRGULE+V11
                    ASSIGN/V7=V7+1
                    UNTIL/V7==V16+1
                      FILE/CLOSE,FPTR_2,KEEP
        But it doesn't work into a loop :
        Code:
        V17        =LOOP/START,ID=YES,NUMBER=2,START=1,SKIP=,
                      OFFSET:XAXIS=0,YAXIS=0,ZAXIS=0,ANGLE=0
        (...)
                      ASSIGN/V7=1
                      ASSIGN/V16=SCN1.NUMHITS
        FPTR_2       =FILE/OPEN,TEST_WRITING.TXT,APPEND
                    DO/
                    ASSIGN/V5="SCN1.HIT["+V7+"]"
                    ASSIGN/V8=V5.PR
                    ASSIGN/V9=V5.Z-10
                    ASSIGN/V10=RAD2DEG(ATAN(V8/V9))
                    ASSIGN/V11=DOT(V5.XYZ-V5.TXYZ,V5.TIJK)
                    FILE/WRITELINE,FPTR_2,V10+VIRGULE+V11
                    ASSIGN/V7=V7+1
                    UNTIL/V7==V16+1
                      FILE/CLOSE,FPTR_2,KEEP
                    LOOP/END
        The solution which works now is :
        Code:
        FPTR_1     =FILE/OPEN,GLOBAL_02_2016.TXT,APPEND
        V1         =LOOP/START,ID=YES,NUMBER=1,START=1,SKIP=,
                      OFFSET:XAXIS=0,YAXIS=0,ZAXIS=0,ANGLE=0
        REF5         =ALIGNMENT/START,RECALL:REF_PIECE,LIST=YES
                        ALIGNMENT/ROTATE,XPLUS,TO,LN1,ABOUT,ZPLUS
                        ALIGNMENT/ROTATE_OFFSET,V4,ABOUT,ZPLUS
                      ALIGNMENT/END
                      MOVE/CLEARPLANE
                    COMMENT/OPER,NO,FULL SCREEN=NO,AUTO-CONTINUE=YES,TIME DELAY=1,
                    tempo
        FPTR       =FILE/OPEN,test_reading.TXT,READ
                    ASSIGN/VIRGULE=VIRGULE+","
                    WHILE/!EOF("FPTR") 
        V2           =FILE/READLINE,FPTR,{nom_pt}+" , "+{x1}+" , "+{y1}+" , "+{z1}+" , "+{i1}+" , "+{j1}+" , "+{k1}
        NOM_PT       =FEAT/CONTACT/VECTOR POINT/DEFAULT,CARTESIAN
                      THEO/<X1,Y1,Z1>,<I1,J1,K1>
                      ACTL/<-0.0001,0.002,89.7098>,<0,0,-1>
                      TARG/<X1,Y1,Z1>,<I1,J1,K1>
                      SNAP=NO
                      SHOW FEATURE PARAMETERS=NO
                      SHOW CONTACT PARAMETERS=NO
                      ASSIGN/V12=NOM_PT.PR
                      ASSIGN/V13=NOM_PT.Z
                      ASSIGN/V14=RAD2DEG(ATAN(V12/V13))
                      ASSIGN/V15=DOT(NOM_PT.XYZ-NOM_PT.TXYZ,NOM_PT.TIJK)
                      FILE/WRITELINE,FPTR_1,V14+VIRGULE+V15
                    END_WHILE/
                    ASSIGN/V4=V4-60
                    FILE/CLOSE,FPTR,KEEP
                    COMMENT/OPER,NO,FULL SCREEN=NO,AUTO-CONTINUE=YES,TIME DELAY=2,
                    Tempo
                    ASSIGN/VIRGULE=VIRGULE+","
                    LOOP/END
        It doesn't work without comments "tempo" with the time delay...

        Comment

        Related Topics

        Collapse

        Working...
        X