hexagon logo

Different machines same program TXT

Hello,

I have a problem with exporting to txt file.

At our company we just get a new machine so now we have three of them. On all of them we measure with same programs.
So the problem is now we would like to include in txt file on which machine was it measured without typing it in a comment or something like that.
It would have to work AUTOMATICALLY no matter where would I measure.

Thanks for help.

Best regards.
Parents
  • Scriptcode for filewrite:
    Open "C:\MyText.txt" For Append As #1
    Write #1, MyString_With_CMM_Name
    Close #1


    There are commands such as FILEWRITE for writing to file directly from within the partprogram.


    ASSIGN/MACHINE=""
                ASSIGN/DAT="C:\PROGRAM FILES (X86)\WAI\TXT_DATA\MACHINE.TXT"
    FILE1       =FILE/EXISTS,FILE
                IF/DAT1
    FPTR         =FILE/OPEN,DAT,READ
    MACHINE1       =FILE/READLINE,FPTR,":"+{MACHINE}
                  FILE/CLOSE,FPTR,KEEP
                END_IF/
                ELSE/
                  COMMENT/OPER,NO,FULL SCREEN=NO,AUTO-CONTINUE=NO,
                  "No file"+FILE
                END_ELSE/
    L1         =LABEL/
                COMMENT/OPER,NO,FULL SCREEN=YES,AUTO-CONTINUE=NO,
                Park over left hole
    PNT1       =FEAT/POINT,CARTESIAN
                THEO/<-311,-776.6,641.8>,<-0.9999942,0.0020117,-0.0027362>
                ACTL/<-311,-776.6,641.8>,<-0.9999942,0.0020117,-0.0027362>
                READPOINT/
    A1           =ALIGNMENT/START,RECALL:STARTUP,LIST=YES
                    ALIGNMENT/TRANS,XAXIS,PNT1
                    ALIGNMENT/TRANS,YAXIS,PNT1
                    ALIGNMENT/TRANS,ZAXIS,PNT1
                  ALIGNMENT/END
    C_D          =COMMENT/INPUT,NO,FULL SCREEN=NO,
                  'WORK ORDER!'
    C_P          =COMMENT/INPUT,NO,FULL SCREEN=NO,
                  'PROCEDURE!'
    C_M          =COMMENT/INPUT,NO,FULL SCREEN=NO,
                  'OPERATOR!'
    BACK3        =LABEL/
    C_R          =COMMENT/INPUT,NO,FULL SCREEN=NO,
                  'Measurment reason:'              
                  IF/C_R.INPUT<>"P" AND C_R.INPUT<>"O" AND C_R.INPUT<>"K" AND C_R.INPUT<>"M" AND C_R.INPUT<>"N" AND C_R.INPUT<>"D"
                  GOTO/BACK3
                END_IF/
    C_O        =COMMENT/INPUT,YES,FULL SCREEN=NO,
                'PEACE NUMBER'
                MODE/DCC
    PNT2       =FEAT/POINT,CARTESIAN
                THEO/<1.074,6.705,1.017>,<-1,0,0>
                ACTL/<715.593,556.288,-483.58>,<-1,0,0>
                MEAS/POINT,1,WORKPLANE
                  HIT/BASIC,NORMAL,<1.074,6.705,1.017>,<-1,0,0>,<715.593,556.288,-483.58>,USE THEO=YES
                ENDMEAS/
    A2         =ALIGNMENT/START,RECALL:A1,LIST=YES
                  ALIGNMENT/TRANS,XAXIS,PNT2
                ALIGNMENT/END
                MOVE/POINT,NORMAL,<-3.039,-0.070,0.150>
    CIR1       =FEAT/CONTACT/CIRCLE/DEFAULT,CARTESIAN,IN,LEAST_SQR
                THEO/<0,-0.016,-0.003>,<-1,0,0>,5
                ACTL/<0,-0.223,-0.248>,<-1,0,0>,5.024
                TARG/<0,-0.016,-0.003>,<-1,0,0>
                START ANG=0,END ANG=360
                ANGLE VEC=<0,0,1>
                DIRECTION=CCW
                SHOW FEATURE PARAMETERS=YES
                  VOID DETECTION=NO
                  REMEASURE=NO
                  SURFACE=THEO_THICKNESS,0
                  MEASURE MODE=NOMINALS
                  RMEAS=NONE,NONE,NONE
                  AUTO WRIST=NO
                  CIRCULAR MOVES=STRAIGHT
                  GRAPHICAL ANALYSIS=NO
                  FEATURE LOCATOR=NO,NO,""
                SHOW CONTACT PARAMETERS=YES
                  NUMHITS=4,DEPTH=1,PITCH=0
                  SAMPLE METHOD=SAMPLE_HITS
                  SAMPLE HITS=0,SPACER=0
                  AVOIDANCE MOVE=BOTH,DISTANCE=3
                  FIND HOLE=DISABLED,ONERROR=NO,READ POS=NO
                SHOW HITS=NO
    CIR2       =FEAT/CONTACT/CIRCLE/DEFAULT,CARTESIAN,IN,LEAST_SQR
                THEO/<0,38.184,-0.003>,<-1,0,0>,5
                ACTL/<0,37.986,-0.018>,<-1,0,0>,5.024
                TARG/<0,38.184,-0.003>,<-1,0,0>
                START ANG=0,END ANG=360
                ANGLE VEC=<0,0,1>
                DIRECTION=CCW
                SHOW FEATURE PARAMETERS=YES
                  VOID DETECTION=NO
                  REMEASURE=NO
                  SURFACE=THEO_THICKNESS,0
                  MEASURE MODE=NOMINALS
                  RMEAS=NONE,NONE,NONE
                  AUTO WRIST=NO
                  CIRCULAR MOVES=STRAIGHT
                  GRAPHICAL ANALYSIS=NO
                  FEATURE LOCATOR=NO,NO,""
                SHOW CONTACT PARAMETERS=YES
                  NUMHITS=4,DEPTH=1,PITCH=0
                  SAMPLE METHOD=SAMPLE_HITS
                  SAMPLE HITS=0,SPACER=0
                  AVOIDANCE MOVE=BOTH,DISTANCE=3
                  FIND HOLE=DISABLED,ONERROR=NO,READ POS=NO
                SHOW HITS=NO
    A3         =ALIGNMENT/START,RECALL:A2,LIST=YES
                  ALIGNMENT/ROTATE_CIRCLE,YPLUS,TO,CIR1,AND,CIR2,ABOUT,ZPLUS
                  ALIGNMENT/TRANS,YAXIS,CIR1
                  ALIGNMENT/TRANS,ZAXIS,CIR1
                  ALIGNMENT/TRANS,XAXIS,PNT2
                ALIGNMENT/END
                PREHIT/1
                RETRACT/1
    PLN_A      =FEAT/PLANE,CARTESIAN,TRIANGLE,NO
                THEO/<0,19.548,1.694>,<-1,0,0>
                ACTL/<0.005,19.55,1.699>,<-0.9999985,-0.0008769,0.0014862>
                CONSTR/PLANE,BF,PNT_A1,PNT_A2,PNT_A3,,
                OUTLIER_REMOVAL/OFF,3
                FILTER/OFF,WAVELENGTH=0
    A4         =ALIGNMENT/START,RECALL:A3,LIST=YES
                  ALIGNMENT/LEVEL,XMINUS,PLN_A
                  ALIGNMENT/TRANS,XAXIS,PLN_A
                  ALIGNMENT/ROTATE_CIRCLE,YPLUS,TO,CIR1,AND,CIR2,ABOUT,XMINUS
                  ALIGNMENT/TRANS,YAXIS,CIR1
                  ALIGNMENT/TRANS,ZAXIS,CIR1
                ALIGNMENT/END
    SLTR_C     =FEAT/CONTACT/ROUND SLOT/DEFAULT,CARTESIAN,IN
                THEO/<0,1.596,14>,<-1,0,0>,<0,1,-0.0000023>,2.55,2.969
                ACTL/<0,1.599,14.012>,<-1,0,0>,<0,0.9999878,0.0049386>,2.576,3.015
                TARG/<0,1.596,14>,<-1,0,0>,<0,1,-0.0000023>
                MEAS ANGLE=130
                SHOW FEATURE PARAMETERS=YES
                  VOID DETECTION=NO
                  REMEASURE=NO
                  SURFACE=THICKNESS_NONE,0
                  MEASURE MODE=NOMINALS
                  RMEAS=NONE,NONE,NONE
                  AUTO WRIST=NO
                  GRAPHICAL ANALYSIS=NO
                  FEATURE LOCATOR=NO,NO,""
                SHOW CONTACT PARAMETERS=YES
                  NUMHITS=8,DEPTH=1
                  SAMPLE METHOD=SAMPLE_HITS
                  SAMPLE HITS=0,SPACER=0.8
                  AVOIDANCE MOVE=BOTH,DISTANCE=3
                  FIND HOLE=DISABLED,ONERROR=NO,READ POS=NO
                SHOW HITS=NO
    CIR_B      =FEAT/CONTACT/CIRCLE/DEFAULT,CARTESIAN,IN,LEAST_SQR
                THEO/<0,36.6,14>,<-1,0,0>,2.55
                ACTL/<0,36.613,13.99>,<-1,0,0>,2.575
                TARG/<0,36.6,14>,<-1,0,0>
                START ANG=0,END ANG=360
                ANGLE VEC=<0,0.0000023,1>
                DIRECTION=CCW
                SHOW FEATURE PARAMETERS=YES
                  VOID DETECTION=NO
                  REMEASURE=NO
                  SURFACE=THEO_THICKNESS,0
                  MEASURE MODE=NOMINALS
                  RMEAS=NONE,NONE,NONE
                  AUTO WRIST=NO
                  CIRCULAR MOVES=STRAIGHT
                  GRAPHICAL ANALYSIS=NO
                  FEATURE LOCATOR=NO,NO,""
                SHOW CONTACT PARAMETERS=YES
                  NUMHITS=5,DEPTH=1,PITCH=0
                  SAMPLE METHOD=SAMPLE_HITS
                  SAMPLE HITS=0,SPACER=0
                  AVOIDANCE MOVE=BOTH,DISTANCE=3
                  FIND HOLE=DISABLED,ONERROR=NO,READ POS=NO
                SHOW HITS=NO
                MOVE/POINT,NORMAL,<-2.000,-0.000,0.000>
    A_A        =ALIGNMENT/START,RECALL:A4,LIST=YES
                  ALIGNMENT/LEVEL,ZPLUS,PLN_A
                  ALIGNMENT/ROTATE_CIRCLE,XPLUS,TO,CIR_B,AND,SLTR_C,ABOUT,ZPLUS
                  ALIGNMENT/TRANS,ZAXIS,PLN_A
                  ALIGNMENT/TRANS,XAXIS,CIR_B
                  ALIGNMENT/TRANS,YAXIS,CIR_B
                ALIGNMENT/END
    PLN_C      =FEAT/PLANE,CARTESIAN,TRIANGLE,NO
                THEO/<17.249,-8.769,0>,<0,0,1>
                ACTL/<17.227,-8.886,0.01>,<-0.0003401,-0.0006823,0.9999997>
                CONSTR/PLANE,BF,PNT_C2,PNT_C6,PNT_C1,PNT_C3,PNT_C5,PNT_C4,,
                OUTLIER_REMOVAL/OFF,3
                FILTER/OFF,WAVELENGTH=0
    DIM FLAT1= FLATNESS OF PLANE PLN_C  UNITS=MM ,$
    GRAPH=OFF  TEXT=OFF  MULT=10.00  ARROWDENSITY=100  OUTPUT=BOTH
    AX    NOMINAL       +TOL       -TOL       MEAS        DEV     OUTTOL
    M        0.000      0.100      0.000      0.009      0.009      0.000 #--------
    
                DATDEF/FEATURE=PLN_A,A
                DATDEF/FEATURE=CIR_B,B
                DATDEF/FEATURE=SLTR_C,C
                COMMENT/REPT,
                CIRCLE MIDLE LEFT
    FCFLOC_DD1 =POSITION : CIR5
                FEATCTRLFRAME/SHOWNOMS=NO,SHOWPARAMS=YES,SHOWEXPANDED=YES
                CADGRAPH=OFF,REPORTGRAPH=OFF,TEXT=OFF,MULT=10.00,ARROWDENSITY=100,OUTPUT=BOTH,UNITS=MM
                COMPOSITE=NO,FIT TO DATUMS=YES,DEV PERPEN CENTERLINE=ON,OUTPUT ALIGNMENT=Current Alignment
                CUSTOMIZED DRF=NO
                STANDARDTYPE=ISO_1101
                  SIZE TOLERANCES/1,DIAMETER,4.5,0.1,-0.1
                  PRIMARY DIMENSION/POSITION,DIAMETER,0.4,MMC,A,B,<MC>,C,<MC>
                  SECONDARY DIMENSION/<Dim>,<tol>,<MC>,<dat>,<dat>,<dat>
                  NOTE/FCFLOC_DD1
                FEATURES/CIR5,,
                COMMENT/REPT,
                CIRCLE MIDLE RIGHT
                COMMENT/REPT,
                .
                XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    
                ASSIGN/TIME=SYSTEMDATE("dd.MM.yy")+";"+SYSTEMTIME("hh:mm")
                ASSIGN/V_1=C_D.INPUT+";"+C_P.INPUT+";"+1+";"+C_O.INPUT+";"+C_M.INPUT+";"+FLAT1.MEAS++";"+FCFLOC_DD1.DF.MEAS+";"+FCFLOC_DD1.TP.MEAS+";"+TIME
    FPTR       =FILE/OPEN,C:\TEST.TXT,APPEND
                FILE/WRITE_BLOCK,FPTR,
                FILE/WRITELINE,FPTR,V1
                FILE/CLOSE,FPTR,KEEP
                COMMENT/OPER,NO,FULL SCREEN=NO,AUTO-CONTINUE=NO,
    


    This is my program. In the midle are missing points for PLN_A becouse of too much characthers.
    And now I would like to put the name of the machine which in writen under MACHINE into ASSIGN/V_1 so I could write it in txt.
  • Isn't it just enough to add +MACHINE1 to the string V_1?
Reply Children
No Data