hexagon logo

Script help needed - export point data to txt file

I have a program that measures 700+ points on an airfoil surface. I'm looking for an easy way to export the nominal and measured values into a txt file as feature name, X nom, Y nom, Z nom, X meas, Y meas, Z meas, X dev, Y dev, Z dev. I'm currently programming to put the values into an array and write to a file after every point measurement.

It would obviously be easier to have a script that would look for all feature names in a certain format, i.e. PNT_1, PNT_2, etc, write the data to a file, then look for the next feature. I wasn't planning on dimensioning any of the points but will if I have to. If someone can point me in the right direction I would greatly appreciate it.
Parents
  • Thank you vpt.se, worked as advertised!

    Now I'm working with the script to customize the location and filename of the output file. I'm trying to pass variable values back to the script for use in the filename. I've added the following:

    Dim txtPartNumber As Object
    Dim txtSerialNumber As Object
    
    Set txtPartNumber = PCDPartProgram.GetVariableValue ("V_PARTNUMBER")  
    Set txtSerialNumber = PCDPartProgram.GetVariableValue ("V_SERIALNUMBER")
    
    Dim strFile As String
          strFile = txtPartName.StringValue & "_" & txtSerialNumber.StringValue & "_" & "POINTDATA.TXT" 
    
    Open "J:\Quality\Enginetics Part Numbers\5000 - 5999\5313057SK01\CMM Reports\" & strFile For Append As #1
    



    The variable V_PARTNUMBER is set using an "ASSIGN" command and V_SERIALNUMBER is assigned from a user input comment command. The problem is the filename ends up being "__POINTDATA.TXT". It's supposed to be "PARTNUMBER_SERIALNUMBER_POINTDATA.TXT" but the variable values are not being passed back. What am I doing wrong?

    As a side note, the output file included "" around each data line. I changed the WRITE command to PRINT and the "" marks disappeared. Just a formatting preference I guess.
Reply
  • Thank you vpt.se, worked as advertised!

    Now I'm working with the script to customize the location and filename of the output file. I'm trying to pass variable values back to the script for use in the filename. I've added the following:

    Dim txtPartNumber As Object
    Dim txtSerialNumber As Object
    
    Set txtPartNumber = PCDPartProgram.GetVariableValue ("V_PARTNUMBER")  
    Set txtSerialNumber = PCDPartProgram.GetVariableValue ("V_SERIALNUMBER")
    
    Dim strFile As String
          strFile = txtPartName.StringValue & "_" & txtSerialNumber.StringValue & "_" & "POINTDATA.TXT" 
    
    Open "J:\Quality\Enginetics Part Numbers\5000 - 5999\5313057SK01\CMM Reports\" & strFile For Append As #1
    



    The variable V_PARTNUMBER is set using an "ASSIGN" command and V_SERIALNUMBER is assigned from a user input comment command. The problem is the filename ends up being "__POINTDATA.TXT". It's supposed to be "PARTNUMBER_SERIALNUMBER_POINTDATA.TXT" but the variable values are not being passed back. What am I doing wrong?

    As a side note, the output file included "" around each data line. I changed the WRITE command to PRINT and the "" marks disappeared. Just a formatting preference I guess.
Children
No Data