How to Output Raw X,Y,Z Data

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

  • How to Output Raw X,Y,Z Data

    Hi, I'm looking to write the raw x,y,z data to a file
    i have several scans SCN1, SCN2, SCN3 that I need the raw data only
    this is what I have so far

    FPTR =FILE/OPEN,C:\PcDMIS\Programs\test\test RAW DATA REPORT.bcs,APPEND
    FILE/WRITELINE,FPTR,TITLE: test
    FILE/WRITELINE,FPTR,SERIAL NUMBER
    FILE/WRITELINE,FPTR,C1.INPUT
    FILE/WRITELINE,FPTR,PROBE BALL SIZE (MM)
    FILE/WRITELINE,FPTR,C2.INPUT
    FILE/WRITELINE,FPTR,SECTION H-H


    This is what I'm looking to have

    TITLE: test
    1 0.05878 S/N:test
    A-A
    -0.230397 -0.069555 -10.764380
    -0.230399 -0.069557 -10.764380
    -0.236842 -0.029961 -10.764350
    -0.234787 0.009051 -10.764000
    -0.220952 0.046868 -10.763330
    -0.194672 0.077128 -10.760920
    -0.160155 0.096054 -10.756480
    -0.123004 0.108559 -10.755030
    -0.085585 0.120235 -10.754250
    -0.047841 0.131212 -10.753860
    -0.010007 0.141315 -10.753770
    0.028237 0.150696 -10.753920
    0.066681 0.159161 -10.754360
    0.105386 0.166626 -10.754830
    0.144238 0.173202 -10.755550
    0.183152 0.178930 -10.757110
    0.222189 0.183967 -10.758180
    0.261242 0.188603 -10.759470
    0.300362 0.192687 -10.761010
    0.339745 0.195639 -10.762700
    0.379161 0.196760 -10.764490
    0.418340 0.195761 -10.765800

  • #2
    I don't think there is an easy way to get exactly what you want. You will probably need to make a basic script to make that task manageable.

    If you don't need to automate it, you can just export an .XYZ file. That is under File - Export - XYZ. There is an option to export scans as points. That will make a comma separated text file that has the format below for each point. It has the feature name and the measured XYZ IJK values.

    SCN1_1 -0.556177,7.484783,0.606026,0.116776,0.001958,0.993 156
    SCN1_2 -0.555795,7.524151,0.605889,0.116937,0.002721,0.993 136
    ...

    Comment


    • #3
      Thanks I will try that.

      Comment


      • #4
        If you really want to go through the trouble, you could put in a loop for each scan to output the XYZ values of each point in the format you want. Something like this:

        Code:
        ASSIGN/PNTIDX=1
        WHILE/PNTIDX <= SCN1.NUMHITS
             FILE/WRITELINE,FPTR,STR(SCN1.HIT[PNTIDX].X)+" "+STR(SCN1.HIT[PNTIDX].Y)+" "+STR(SCN1.HIT[PNTIDX].Z)
             ASSIGN/PNTIDX=PNTIDX+1
        END_WHILE/
        That is a quick example. I didn't test it or anything, but you get the idea. There may be a way to make it even easier if you use pointers so you don't have to keep typing in SCN1, SCN2, SCN3, etc.

        Comment


        • louisd
          louisd commented
          Editing a comment
          Nailed it! only other input I'd offer is to maybe add one more file/writeline before the while loop, to define the what feature the hit data belongs to. also, you might need to add .MEAS to the the end of each coordinate reference. Example: SCN1.HIT[PNTIDX].X.MEAS

      • #5
        THANKS

        I'm not using a loop, but I guess I can try the format

        Comment


        • #6
          Ok, I tried the code and it didn't work.

          I get this

          SECTION H-H
          TEST 1
          000
          000
          000
          000
          000
          000
          000
          000
          000

          Comment


          • louisd
            louisd commented
            Editing a comment
            did you try adding .meas after each axis?

        • #7
          Yes I used .MEAS

          ASSIGN/PNTIDX=1
          WHILE/PNTIDX<=SCN1.NUMHITS
          FILE/WRITELINE,FPTR,STR(SCN1.HIT[PNTIDX].X.MEAS)+""+STR(SCN1.HIT[PNTIDX].Y.MEAS)+""+STR(SCN1.HIT[PNTIDX].Z.MEAS)
          ASSIGN/PNTIDX=PNTIDX+1
          END_WHILE/

          Comment


          • #8
            Ok, this is what I found

            FPTR =FILE/OPEN,C:\PcDMIS\Programs\test\test RAW DATA REPORT.bcs,APPEND
            FILE/WRITELINE,FPTR,TITLE: test
            FILE/WRITELINE,FPTR,SERIAL NUMBER
            FILE/WRITELINE,FPTR,C1.INPUT
            FILE/WRITELINE,FPTR,PROBE BALL SIZE (MM)
            FILE/WRITELINE,FPTR,C2.INPUT
            FILE/WRITELINE,FPTR,SECTION H-H
            FILE/WRITELINE,FPTR,test1
            FILE/WRITELINE,FPTR,SCN1.HIT[1].XYZ
            FILE/WRITELINE,FPTR,SCN1.HIT[2].XYZ
            FILE/WRITELINE,FPTR,SCN1.HIT[3].XYZ
            FILE/WRITELINE,FPTR,SCN1.HIT[4].XYZ
            FILE/WRITELINE,FPTR,SCN1.HIT[5].XYZ
            FILE/WRITELINE,FPTR,SCN1.HIT[6].XYZ
            FILE/WRITELINE,FPTR,SCN1.HIT[7].XYZ
            FILE/WRITELINE,FPTR,SCN1.HIT[8].XYZ
            FILE/WRITELINE,FPTR,SCN1.HIT[9].XYZ
            FILE/WRITELINE,FPTR,SCN2.HIT[1].XYZ

            It gives me this

            TITLE: test
            SERIAL NUMBER
            N/A
            PROBE BALL SIZE (MM)
            3
            SECTION H-H
            test1
            <-0.26458, -0.097846, -0.505097>
            <-0.220063, -0.083041, -0.499872>
            <-0.178656, -0.0603, -0.497525>
            <-0.133743, -0.034792, -0.495925>
            <-0.083675, -0.013376, -0.49443>
            <-0.030138, 0.002367, -0.492325>
            <0.024671, 0.013824, -0.489739>
            <0.079934, 0.021026, -0.486433>
            <0.133736, 0.024662, -0.482934>
            <0.183665, 0.025479, -0.479654>
            <0.229604, 0.023697, -0.477205>
            <0.270412, 0.02343, -0.473599>
            <0.305685, 0.021279, -0.471294>
            <0.334935, 0.019325, -0.469298>
            <0.358264, 0.017678, -0.467556>
            <0.375934, 0.016317, -0.466243>
            <0.388395, 0.014999, -0.465422>
            <0.396685, 0.0143, -0.464813>
            <0.401663, 0.013798, -0.464456>
            <0.405002, 0.013669, -0.464113>
            <0.409502, 0.014992, -0.462474>
            <0.417803, 0.018729, -0.458342>
            <0.431424, 0.02242, -0.451956>
            <0.448105, 0.019848, -0.446366>
            <0.459778, 0.008107, -0.445137>
            <0.46147, -0.008449, -0.448977>

            is there a way to make that code shorter?

            FILE/WRITELINE,FPTR,SCN1.HIT[1].XYZ
            FILE/WRITELINE,FPTR,SCN1.HIT[2].XYZ
            FILE/WRITELINE,FPTR,SCN1.HIT[3].XYZ
            FILE/WRITELINE,FPTR,SCN1.HIT[4].XYZ
            FILE/WRITELINE,FPTR,SCN1.HIT[5].XYZ
            FILE/WRITELINE,FPTR,SCN1.HIT[6].XYZ
            FILE/WRITELINE,FPTR,SCN1.HIT[7].XYZ

            Comment


            • #9
              FILE/WRITELINE,FPTR,SCN1.HIT[1..SCN1.NUMHITS].XYZ + CHR(13)
              will give you all the points of a scan in the following format:
              (<-0.5562, 7.4848, 0.606>
              <-0.5558, 7.5242, 0.6059>
              <-0.5554, 7.5635, 0.6057>
              <-0.5539, 7.7206, 0.6048>
              )


              I don't know how to remove the '(', ')', '<', & '>' characters.
              More and more I'm feeling like this is a puzzle for JEFMAN. He may have a slick way to do this.
              Last edited by Cris_C; 10-29-2021, 01:13 PM.

              Comment


              • #10
                A little closer now. This removes the "<" and ">" characters. However, there are still parentheses around the group and spaces at the beginning of each line.

                FILE/WRITELINE,FPTR,SCN1.HIT[1..SCN1.NUMHITS].X + "," + SCN1.HIT[1..SCN1.NUMHITS].Y + "," + SCN1.HIT[1..SCN1.NUMHITS].Z + CHR(13)

                Results:
                (-0.5562,7.4848,0.606
                -0.5558,7.5242,0.6059
                -0.5554,7.5635,0.6057
                -0.555,7.6029,0.6055
                -0.5547,7.6423,0.6053
                )

                I tried to use the mid() function to remove the parentheses from the beginning and the end, but the len() function wasn't giving me the right value.

                Comment


                • #11
                  that works except it goes across the screen


                  TITLE: test
                  SERIAL NUMBER
                  N/A
                  PROBE BALL SIZE (MM)
                  3
                  SECTION H-H
                  test1
                  (<-0.26458, -0.097846, -0.505097> <-0.220063, -0.083041, -0.499872> <-0.178656, -0.0603, -0.497525> <-0.133743, -0.034792, -0.495925> <-0.083675, -0.013376, -0.49443> <-0.030138, 0.002367, -0.492325> <0.024671, 0.013824, -0.489739> <0.079934, 0.021026, -0.486433> <0.133736, 0.024662, -0.482934> )


                  I do appreciate all the help so far....

                  Comment


                  • Cris_C
                    Cris_C commented
                    Editing a comment
                    The very last part of the line "+ CHR(13)" should put a carriage return after each XYZ reporting. It was working on my system.
                    I'm not sure how much I'm helping, but I'm having fun non the less.
                    I think you should re-consider a loop. It would give you a lot more control over the format of the output.

                • #12
                  Ok i tested this loop out, it should work. Hopefully you are okay with comma separated values

                  Code:
                  ASSIGN/PNTIDX=1
                  WHILE/PNTIDX <= SCN1.NUMHITS
                  FILE/WRITELINE,FPTR,SCN1.HIT[PNTIDX].X) + ", " + SCN1.HIT[PNTIDX].Y + ", " + SCN1.HIT[PNTIDX].Z
                  ASSIGN/PNTIDX=PNTIDX+1
                  END_WHILE/
                  Make sure the "SCN1" syntax is actually the name of your scan.

                  Comment


                  • Cris_C
                    Cris_C commented
                    Editing a comment
                    About the commas, I ran into that problem too. The string did not concatenate properly with spaces (" ") as delimitators unless I used the STR() command force it to recognize each value as a text string. That is why my looping suggestion had this format: STR(SCN1.HIT[PNTIDX].X)+" "+....

                • #13
                  Originally posted by Cris_C View Post
                  FILE/WRITELINE,FPTR,SCN1.HIT[1..SCN1.NUMHITS].XYZ + CHR(13)
                  will give you all the points of a scan in the following format:
                  (<-0.5562, 7.4848, 0.606>
                  <-0.5558, 7.5242, 0.6059>
                  <-0.5554, 7.5635, 0.6057>
                  <-0.5539, 7.7206, 0.6048>
                  )


                  I don't know how to remove the '(', ')', '<', & '>' characters.
                  More and more I'm feeling like this is a puzzle for JEFMAN. He may have a slick way to do this.
                  Just use "FORMAT" function.
                  With the code of louisd , it gives :

                  Code:
                  ASSIGN/PNTIDX=1
                  WHILE/PNTIDX <= SCN1.NUMHITS
                  FILE/WRITELINE,FPTR,FORMAT("%3.6f,%3.6f,%3.6f",SCN1.HIT[PNTIDX].XYZ)
                  ASSIGN/PNTIDX=PNTIDX+1
                  END_WHILE/
                  Even if I usually code it with a loop.
                  You can also create a COP on the scan, and then export it, but I'm not sure it easilly auto execute...

                  ​​​​​​​Happy weekend, all !

                  Comment


                  • Cris_C
                    Cris_C commented
                    Editing a comment
                    Yup, very slick!

                • #14
                  THAT WAS IT

                  louisd... in your code you have a ) after the .X and that didn't work.
                  so I removed it and it worked

                  TITLE: test
                  SERIAL NUMBER
                  N/A
                  PROBE BALL SIZE (MM)
                  3
                  SECTION H-H
                  test1
                  -0.26458, -0.097846, -0.505097
                  -0.220063, -0.083041, -0.499872
                  -0.178656, -0.0603, -0.497525
                  -0.133743, -0.034792, -0.495925
                  -0.083675, -0.013376, -0.49443
                  -0.030138, 0.002367, -0.492325
                  0.024671, 0.013824, -0.489739
                  0.079934, 0.021026, -0.486433
                  0.133736, 0.024662, -0.482934


                  THANK YOU
                  louisd
                  and everyone who chimed in

                  Comment

                  Related Topics

                  Collapse

                  Working...
                  X