Text Output Techniques

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

  • Text Output Techniques

    Dear Friends,


    I would like to incorporate output to a text file. I have forgotten the code, could anyone be so kind as to refresh my memory?
    Thank you very much.

    Gabriel
    sigpic

  • #2
    insert>file IO command>file open

    FPTR =FILE/OPEN,C:\PCDMISW_35mr2\results.txt,APPEND

    set variables for each feature needed to be sent to file

    i.e......ASSIGN/V1 = PERP1.MEAS

    insert>file IO>writing commands>write line

    FILE/WRITELINE,FPTR,PARTNUM+","+V2+","+V3+","+V4+","+V5

    this will import into excel if the commas are used
    sigpiccall me "Plum Crazy"....but you only go around once!

    Comment


    • #3
      Can you explain this:

      i.e......ASSIGN/V1 = PERP1.MEAS

      FILE/WRITELINE,FPTR,PARTNUM+","+V2+","+V3+","+V4+","+V5

      Thanks,

      Comment


      • #4
        ThX Mike! Very nice touch adding the commas, since my goal is to build an append file, and database to Access.

        ok for taterhouse:
        ASSIGN/V1 = PERP1.MEAS
        this is the label for a variable, the perp1 is a dimensioned feature, the .meas is the output of that measured feature.

        FILE/WRITELINE,FPTR,PARTNUM+","+V2+","+V3+","+V4+","+V5
        the file writeline is the call to write the variables to the file named by FPTR with the part number first, followed by commas and the rest of the variables.

        BUT FIRST YOU MUST OPEN A FILE TO WRITE TO!!!


        thanks again Mike.

        Gabriel
        sigpic

        Comment


        • #5
          from the "insert" option at the top of pcdmis...

          v1 Assignment

          the info after the "=" is the value you wish to capture as a variable. It could be any part (x,y,z,d,r,...etc) of any dimension (cir1,pln2,perp1,...etc)

          the meaning for this example was the perp1 measured dimension created prior to entering this assignment
          ================================================== ====

          from the "insert" option at the top of pcdmis...

          insert>file IO>writing commands>write line

          FILE/WRITELINE,FPTR,PARTNUM+","+V2+","+V3+","+V4+","+V5

          this command writes to the predifined file, the assignment variables stated as v1,v2,v3....etc
          sigpiccall me "Plum Crazy"....but you only go around once!

          Comment


          • #6
            Also you might want to check out the help file. It has some code examples of how to do File Input and Output using the various File I/O commands. See the "Using File Input / Output" section. Or mouse-over the menu item, and press F1.
            Jared Hess - Techwriter @ WAI
            [View Reporting Tutorials Here]

            Comment


            • #7
              need help on getting this to work

              We've got 2 CMMs with DataPage and 2 without and I am trying to set a repeatability test between all.

              I've entered the code as stated above and assigned the variables I want to report into the prg and this is my code as stated in this thread and all I get in my text file is: "PARTNUM+,"+V1+","+V2+","+V3+","+V4+","+V5+","+V6+ ","+V7+","+V8+","+V9+","+V10+","+V11+","+V12+","+V 13+","+V14+","+V15+","+V16+","+V17+","+V18+","+V19 +","+V20+","+V21+","+V22+",

              This is the code that I've got at the end of the prg.
              FPTR =FILE/OPEN,C:\PCDMISW37mr1\data\blockrr.txt,APPEND
              FILE/WRITELINE,FPTR,PARTNUM+,"+V1+","+V2+","+V3+","+V4+ ","+V5+","+V6+","+V7+","+V8+","+V9+","+V10+","+V11 +","+V12+","+V13+","+V14+","+V15+","+V16+","+V17+" ,"+V18+","+V19+","+V20+","+V21+","+V22+",
              FILE/CLOSE,FPTR

              What is not correct?

              Duane
              Xcel & MicroVal Pfx & Global 37mr4 thru 2012mr1sp3
              Contura Calypso 5.4

              Lord, keep Your arm around my shoulder and Your hand over my mouth. Amen.

              Comment


              • #8
                Look closely at your quotes. You want to concatenate with the + sign, anything you quote is basically a string.

                You do PARTNUM +, "+V1+"......

                This is like saying send a variable named PARTNUM concatenate then a comma which is probably screwing things up because it is not in quotes then no cancatenate then +V1+ as a string.

                This is what you want

                PARTNUM + "," + V1......

                This says send a variable named PARTNUM concatenate a comma then concatenate a variable named V1 etc.

                My guess is a variable named PARTNUM might have gotten sent but then things went screwy.

                As a side note, you don't have to do this but puting a space in between variables, strings, operators etc makes the code more readable and helps when it comes time to trouble shoot. Not mandatory but I know it helps me. PCDMIS will read it either way.
                Last edited by craiger_ny; 07-12-2006, 09:31 AM.
                <internet bumper sticker goes here>

                Comment


                • #9
                  I think I understand.... I did not have any spaces between my features that I wanted to output to the file. Is that what you were trying to tell me?

                  Also, is the a limit the number of characters in a line of code in PC-DMIS?
                  Xcel & MicroVal Pfx & Global 37mr4 thru 2012mr1sp3
                  Contura Calypso 5.4

                  Lord, keep Your arm around my shoulder and Your hand over my mouth. Amen.

                  Comment


                  • #10
                    Originally posted by dwade
                    I think I understand.... I did not have any spaces between my features that I wanted to output to the file. Is that what you were trying to tell me?

                    Also, is the a limit the number of characters in a line of code in PC-DMIS?
                    No it is not the sapces that is doing it. It is your placement of quotes.

                    Look closely this is your code (I am adding spaces for clarity):
                    Code:
                    FPTR =FILE/OPEN,C:\PCDMISW37mr1\data\blockrr.txt,APPEND
                    FILE/WRITELINE,FPTR,PARTNUM + , "+V1+" , "+V2+" , "+V3+" , "+V4+ " , "+V5
                    +" , "+V6+" , "+V7+" , "+V8+" , "+V9+" , "+V10+" , "+V11 +" , "+V12+" , "+V13
                    +" , "+V14+" , "+V15+" , "+V16+" , "+V17+" ,"+V18+" , "+V19+" , "+V20+" , 
                    "+V21+" , "+V22+" ,
                    FILE/CLOSE,FPTR
                    All of your variables are wrapped in quotes so it goes over as a string instead of the variable information it has been set (assigned) as.

                    Here is what your code should look like:
                    Code:
                    FPTR =FILE/OPEN,C:\PCDMISW37mr1\data\blockrr.txt,APPEND
                    FILE/WRITELINE,FPTR,PARTNUM + "," + V1 + "," + V2 + "," + V3 + "," + V4
                     + "," + V5 + "," + V6 + "," + V7 + "," + V8 + "," + V9 + "," + V10 + "," + 
                    V11  + "," + V12 + "," + V13 + "," + V14 + "," + V15 + "," + V16 + "," + V17
                     + "," + V18 + "," + V19 + "," + V20 + "," + V21 + "," + V22
                    FILE/CLOSE,FPTR
                    See the difference? In your case you quoted the variables, in my case I quote the comma. That causes the comma to go over as a string and then your text file ends up delimited by it. See how much easier it is to read when there are spaces? This is simply convention and does not need to be followed.

                    Craig
                    <internet bumper sticker goes here>

                    Comment


                    • #11
                      Craiger_NY

                      It works now. Thank you for the help!!

                      Duane
                      Xcel & MicroVal Pfx & Global 37mr4 thru 2012mr1sp3
                      Contura Calypso 5.4

                      Lord, keep Your arm around my shoulder and Your hand over my mouth. Amen.

                      Comment

                      Related Topics

                      Collapse

                      Working...
                      X