Basic Forms automatisation

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

  • Basic Forms automatisation

    Hello

    I need help with VB form for user input on begining of measurement
    We have 32 PCDMIS CMM. We want to a little automated process for measurement and I made one user form for inputting data when we start measuring program.
    Form we will use for inputting some data for Q-das database. (In attachment is picture of form).

    My problem is keep the data in from after run or after click OK. Form works fine and give us all necessity info and data into tracefileds, but when we run program from beginning we always get totally empty form. That is very hard that operator need to fill everything in form from beginning even if change only for example, sample Id

    Can someone please help me with code which will do that, I mean keep the last entered data in form even we leave program or restart pcdmis..

    Thank you very much.
    Attached Files
    CIMOS
    Metrology by RM

    ________________________
    GLOBAL 7-10-7 ADVANTAGE,
    SP25, FCR25
    PCDMIS 2015.0
    WIN 7 pro
    16 years on PCDMIS

  • #2
    Essentially you need the following flow

    - read values to variables from file (open, read, ..., read, close)
    - call the form, connecting the variables to the form fields
    - if OK, write variables to the file (open, write, ..., write, close), if Cancel don't write to file.

    AndersI
    SW support - Hexagon Metrology Nordic AB

    Comment


    • #3
      Helo
      there what I have. But this is doesn't work.
      I can store in file everything from form, but when I restart I cant see that stored data in my form
      What I make wrong?
      STARTUP =ALIGNMENT/START,RECALL:USE_PART_SETUP,LIST=YES
      ALIGNMENT/END
      MODE/MANUAL
      PREHIT/2
      RETRACT/2
      CHECK/4,1
      SCANSPEED/12
      FLY/ON
      FORMAT/TEXT, , ,HEADINGS,SYMBOLS, ;NOM,TOL,MEAS,DEV,OUTTOL, ,
      LOADPROBE/FI3L20
      TIP/T1A0B0, SHANKIJK=0, 0, 1, ANGLE=0
      $$ NO,
      COPY FROM HERE!!!!
      ************************************************** ******************
      EXTERNALCOMMAND/NO_DISPLAY, NO_WAIT ; C:\PROGRAM FILES (X86)\PC-DMIS - Q-DAS CONVERTER\PCDQDAS.EXE /i
      ASSIGN/PART_CODE="qdas_template v2"
      ASSIGN/PARAM_PATH="C:\CNC\param_"+PART_CODE+".TXT"
      ASSIGN/PAR1=" "
      ASSIGN/PAR2=" "
      ASSIGN/PAR3=" "
      ASSIGN/PAR4=" "
      ASSIGN/PAR5=" "
      ASSIGN/PAR6=" "
      ASSIGN/PAR7=" "
      ASSIGN/PAR8=" "
      ASSIGN/PAR9=" "
      ASSIGN/PAR10=" "
      ASSIGN/PAR11=" "
      ASSIGN/PAR12=" "
      F1 =FILE/EXISTS,PARAM_PATH
      IF/F1<>0
      PODAT =FILE/OPEN,PARAM_PATH,READ
      DO/
      F2 =FILE/READLINE,PODAT,{LINE}
      ASSIGN/PAR1=LINE
      F2 =FILE/READLINE,PODAT,{LINE}
      ASSIGN/PAR2=LINE
      F2 =FILE/READLINE,PODAT,{LINE}
      ASSIGN/PAR3=LINE
      F2 =FILE/READLINE,PODAT,{LINE}
      ASSIGN/PAR4=LINE
      F2 =FILE/READLINE,PODAT,{LINE}
      ASSIGN/PAR5=LINE
      F2 =FILE/READLINE,PODAT,{LINE}
      ASSIGN/PAR6=LINE
      F2 =FILE/READLINE,PODAT,{LINE}
      ASSIGN/PAR7=LINE
      F2 =FILE/READLINE,PODAT,{LINE}
      ASSIGN/PAR8=LINE
      F2 =FILE/READLINE,PODAT,{LINE}
      ASSIGN/PAR9=LINE
      F2 =FILE/READLINE,PODAT,{LINE}
      ASSIGN/PAR10=LINE
      F2 =FILE/READLINE,PODAT,{LINE}
      ASSIGN/PAR11=LINE
      F2 =FILE/READLINE,PODAT,{LINE}
      ASSIGN/PAR12=LINE
      UNTIL/F2=="EOF"
      FILE/CLOSE,PODAT,KEEP
      END_IF/
      ELSE/
      COMMENT/OPER,NO,FULL SCREEN=YES,AUTO-CONTINUE=NO,
      No last execute parameter file found. Enter all information manually!!!
      END_ELSE/
      CS1 =FORM/FILENAME= C:\CNC\INPUT_FORM_QDAS.FORM
      PARAM/CBXPLANTK0057.TEXTVALUE=PAR1
      PARAM/CBXCMMK0012.TEXTVALUE=PAR2
      PARAM/CBXINSPECTORK0008.TEXTVALUE=PAR3
      PARAM/TXTORDERK0053.TEXT=PAR4
      PARAM/CBXMEASTYPK0055.TEXTVALUE=PAR5
      PARAM/CBXSAMPSTAK0056.TEXTVALUE=PAR6
      PARAM/CBXMACHPRODK0010.TEXTVALUE=PAR7
      PARAM/TXTCAVMACHK0007.TEXT=PAR8
      PARAM/TXTNESTMACHK0054.TEXT=PAR9
      PARAM/TXTSAMPLEIDK0014.TEXT=PAR10
      PARAM/TXTTOOLCASTK0017.TEXT=PAR11
      PARAM/TXTNOTEK0009.TEXT=PAR12
      PARAM/=
      ENDFORM/
      PARWRITE =FILE/OPEN,PARAM_PATH,WRITE
      FILE/WRITELINE,PARWRITE,PAR1
      FILE/WRITELINE,PARWRITE,PAR2
      FILE/WRITELINE,PARWRITE,PAR3
      FILE/WRITELINE,PARWRITE,PAR4
      FILE/WRITELINE,PARWRITE,PAR5
      FILE/WRITELINE,PARWRITE,PAR6
      FILE/WRITELINE,PARWRITE,PAR7
      FILE/WRITELINE,PARWRITE,PAR8
      FILE/WRITELINE,PARWRITE,PAR9
      FILE/WRITELINE,PARWRITE,PAR10
      FILE/WRITELINE,PARWRITE,PAR11
      FILE/WRITELINE,PARWRITE,PAR12
      FILE/CLOSE,PARWRITE,KEEP
      ASSIGN/PAR1=LEFT(PAR1,3)
      ASSIGN/PAR2=LEFT(PAR2,5)
      ASSIGN/PAR3=LEFT(PAR3,5)
      ASSIGN/PAR5=LEFT(PAR5,2)
      ASSIGN/PAR6=LEFT(PAR6,1)
      ASSIGN/PAR7=LEFT(PAR7,4)
      TRACEFIELD/NO_DISPLAY,LIMIT=45 ; K0007 : PAR8
      TRACEFIELD/NO_DISPLAY,LIMIT=45 ; K0008 : PAR3
      TRACEFIELD/NO_DISPLAY,LIMIT=60 ; K0009 : PAR12
      TRACEFIELD/NO_DISPLAY,LIMIT=45 ; K0010 : PAR7
      TRACEFIELD/NO_DISPLAY,LIMIT=45 ; K0012 : PAR2
      TRACEFIELD/NO_DISPLAY,LIMIT=45 ; K0014 : PAR10
      TRACEFIELD/NO_DISPLAY,LIMIT=45 ; K0017 : PAR11
      TRACEFIELD/NO_DISPLAY,LIMIT=45 ; K0053 : PAR4
      TRACEFIELD/NO_DISPLAY,LIMIT=45 ; K0054 : PAR9
      TRACEFIELD/NO_DISPLAY,LIMIT=45 ; K0055 : PAR5
      TRACEFIELD/NO_DISPLAY,LIMIT=45 ; K0056 : PAR6
      TRACEFIELD/NO_DISPLAY,LIMIT=45 ; K0057 : PAR1
      $$ NO,
      COPY UNTIL HERE!!!!
      ************************************************** ******************
      MODE/DCC
      CIR1 =FEAT/CONTACT/CIRCLE/DEFAULT,CARTESIAN,IN,LEAST_SQR
      THEO/<18.436,71.456,12.045>,<-0.0820273,-0.081027,0.9933308>,8
      ACTL/<18.436,71.456,12.045>,<-0.0820273,-0.081027,0.9933308>,8
      TARG/<18.436,71.456,12.045>,<-0.0820273,-0.081027,0.9933308>
      START ANG=0,END ANG=360
      ANGLE VEC=<1,0,0>
      DIRECTION=CCW
      SHOW FEATURE PARAMETERS=NO
      SHOW CONTACT PARAMETERS=YES
      NUMHITS=7,DEPTH=5,PITCH=0
      SAMPLE METHOD=SAMPLE_HITS
      SAMPLE HITS=3,SPACER=0
      AVOIDANCE MOVE=NO,DISTANCE=10
      FIND HOLE=DISABLED,ONERROR=NO,READ POS=NO
      SHOW HITS=NO
      DIM 1= LOCATION OF CIRCLE CIR1
      AX NOMINAL +TOL -TOL MEAS DEV OUTTOL
      X 18.436 0.050 0.050 18.436 0.000 0.000 ----#----
      Y 71.456 0.050 0.050 71.456 0.000 0.000 ----#----
      Z 12.045 0.050 0.050 12.045 0.000 0.000 ----#----
      D 8.000 0.050 0.050 8.000 0.000 0.000 ----#----
      END OF DIMENSION 1
      CIMOS
      Metrology by RM

      ________________________
      GLOBAL 7-10-7 ADVANTAGE,
      SP25, FCR25
      PCDMIS 2015.0
      WIN 7 pro
      16 years on PCDMIS

      Comment


      • #4
        I have only this code in form on: EventInitialize

        Dim Plant As String
        Dim CMM As String
        Dim Inspector As String
        Dim MeasType As String
        Dim SampSta As String
        Dim MachProd As String


        'Plant data K0057


        If Len(dir("C:\CNC\Plant.dat"))<2 Then
        MsgBox "File not found"
        cbxPlantK0057.AddString "A"
        cbxPlantK0057.AddString "B"
        cbxPlantK0057.AddString "C"
        Else
        Open "C:\CNC\Plant.dat" For Input As #1
        Do While Not EOF(1)
        Line Input #1, Plant
        cbxPlantK0057.AddString Plant
        Loop
        Close #1
        End If

        'CMM data K0012

        If Len(dir("C:\CNC\CMM.dat"))<2 Then
        MsgBox "File not found"
        cbxCMMK0012.AddString "A"
        cbxCMMK0012.AddString "B"
        cbxCMMK0012.AddString "C"
        Else
        Open "C:\CNC\CMM.dat" For Input As #1
        Do While Not EOF(1)
        Line Input #1, CMM
        cbxCMMK0012.AddString CMM
        Loop
        Close #1
        End If

        'Inspector data K0008

        If Len(dir("C:\CNC\Inspector.dat"))<2 Then
        MsgBox "File not found"
        cbxInspectorK0008.AddString "A"
        cbxInspectorK0008.AddString "B"
        cbxInspectorK0008.AddString "C"
        Else
        Open "C:\CNC\Inspector.dat" For Input As #1
        Do While Not EOF(1)
        Line Input #1, Inspector
        cbxInspectorK0008.AddString Inspector
        Loop
        Close #1
        End If

        'Measure Type data K0055

        If Len(dir("C:\CNC\MeasureType.dat"))<2 Then
        MsgBox "File not found"
        cbxMeasTypK0055.AddString "A"
        cbxMeasTypK0055.AddString "B"
        cbxMeasTypK0055.AddString "C"
        Else
        Open "C:\CNC\MeasureType.dat" For Input As #1
        Do While Not EOF(1)
        Line Input #1, MeasType
        cbxMeasTypK0055.AddString MeasType
        Loop
        Close #1
        End If


        'Sample Status data K0056

        If Len(dir("C:\CNC\SampleStatus.dat"))<2 Then
        MsgBox "File not found"
        cbxSampStaK0056.AddString "A"
        cbxSampStaK0056.AddString "B"
        cbxSampStaK0056.AddString "C"
        Else
        Open "C:\CNC\SampleStatus.dat" For Input As #1
        Do While Not EOF(1)
        Line Input #1, SampSta
        cbxSampStaK0056.AddString SampSta
        Loop
        Close #1
        End If

        'cbxMachprodK0010

        If Len(dir("C:\CNC\Machine.dat"))<2 Then
        MsgBox "File not found"
        cbxMachprodK0010.AddString "A"
        cbxMachprodK0010.AddString "B"
        cbxMachprodK0010.AddString "C"
        Else
        Open "C:\CNC\Machine.dat" For Input As #1
        Do While Not EOF(1)
        Line Input #1, MachProd
        cbxMachprodK0010.AddString MachProd
        Loop
        Close #1
        End If


        CIMOS
        Metrology by RM

        ________________________
        GLOBAL 7-10-7 ADVANTAGE,
        SP25, FCR25
        PCDMIS 2015.0
        WIN 7 pro
        16 years on PCDMIS

        Comment


        • #5
          Have you verified that your parameter file contains something after the writes? Have you verified the values of PAR1 - PAR12 after reading the file? Why do you loop the reading until PAR12 = "EOF" - you only write them once in the file, why expect more?
          AndersI
          SW support - Hexagon Metrology Nordic AB

          Comment


          • #6
            You can probably fill in a few of the inputs from a local file assuming the CMM doesn't pick and move to another building.
            PcDmis 2015.1 SP10 CAD++
            Global 7-10-7 DC800S

            Comment


            • #7
              Anders, yes I have *.txt files with all data in, see att.. I just stacked here. I can't find where I made a mistake!
              Attached Files
              CIMOS
              Metrology by RM

              ________________________
              GLOBAL 7-10-7 ADVANTAGE,
              SP25, FCR25
              PCDMIS 2015.0
              WIN 7 pro
              16 years on PCDMIS

              Comment


              • #8
                Wouldnt you have to set the variables to whatever data you want from the text file as the original assignment of said variables? e.g.
                Code:
                Part1=READLINE (or however you do that in DMIS)
                If(PART1==NULL)Part1=""
                End If
                Etc.

                Comment


                • #9
                  Originally posted by romeom View Post
                  Anders, yes I have *.txt files with all data in, see att.. I just stacked here. I can't find where I made a mistake!
                  To start with, I would remove the DO/ UNTIL/ in the reading part. The only effect I can see from that is that those lines are all repeated twice, second time around doing (hopefully) nothing... And if the text file contains more lines, some of your PARxx will be from the first part, some from the second.

                  Then verify that PAR1 - PAR12 *do* have the right values just before calling the FORM in the actual program. It might be a problem of access rights.

                  If everything is OK so far, the problem must be in the FORM, either clearing the fields before or after showing.
                  AndersI
                  SW support - Hexagon Metrology Nordic AB

                  Comment

                  Working...
                  X