hexagon logo

my solution to .CSV output

Since it has come up a few times I thought I would share my solution to outputting data to a .csv file. I originally wrote this in VB express but I have converted it and tested it in 3.7's basic script editor and it works.

The output will be formatted as such: Dimension name, feature name, measured axis, nominal, + tolerance, - tolerance, measurement.

LOC1,LIN1,Y,-0.415,0.5,0.5,-0.40984622932167

Any other work that I need to do with the data I do in Excel after I import the file.

The data will output to the c:\ in a file named PCD Output.csv but with a little tweaking you can change this as you like.

I have done a lot more with this in VBE, but as far as the basics go it get's the job done.


There is a function call in the program but that makes it too long for a single post so you will need to get that from the next post.
[SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Sub main[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]      'Delare variable for file name to write to[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]      Dim strFileName As String[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]      'connect to PCD program[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]      Dim ObjApp As Object[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]      Dim ObjPP As Object[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]      Dim ObjCmds As Object[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]      Dim ObjCmd As Object[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]      Dim ObjPart As Object[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]      Dim lngNumCmds As Long[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]      Set ObjApp = CreateObject("PCDLRN.Application")[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]      Set ObjPart = ObjApp.ActivePartProgram[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]      Set ObjCmds = ObjPart.Commands[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]      set lngNumCmds = ObjCmds.Count[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]      'Declare variables used for gather output info[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]      Dim StrDimID As String[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]      Dim StrDimFeature As String[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]      Dim StrDimType As String[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]      Dim StrDimNominal As String[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]      Dim StrDimUTol As String[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]      Dim StrDimLTol As String[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]      Dim StrDimMeasure As String[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]      'Declare variable for creating CSV text like[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]      Dim StrOutputLine As String[/COLOR][/SIZE]
 
[SIZE=2][COLOR=#0000ff]              'Build and assign file name[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]      strFileName = "C:\PCD output.txt"[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]      Open strFileName For Output As #1[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]      For Each ObjCmd In ObjCmds[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]          If ObjCmd.IsDimension Then[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]              If Not (ObjCmd.DimensionCommand.IsLocationAxis Or ObjCmd.DimensionCommand.IsTruePosAxis) Then[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]                  StrDimID = ObjCmd.DimensionCommand.ID[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]                  StrDimFeature = ObjCmd.DimensionCommand.Feat1[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]              End If[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]              StrDimType = FncCmdType(ObjCmd.Type)[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]              StrDimNominal = CStr(ObjCmd.DimensionCommand.Nominal)[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]              StrDimUTol = CStr(ObjCmd.DimensionCommand.Plus)[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]              StrDimLTol = CStr(ObjCmd.DimensionCommand.Minus)[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]              If StrDimType <> "TPDM" Then[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]                  StrDimMeasure = CStr(ObjCmd.DimensionCommand.Measured)[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]              Else[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]                  StrDimMeasure = CStr(ObjCmd.DimensionCommand.Deviation)[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]              End If[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]              If Not (StrDimType = "Start_Loc" Or StrDimType = "Start_TP") Then[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]                  StrOutputLine = StrDimID + "," + StrDimFeature + "," + StrDimType + "," + StrDimNominal + "," + StrDimUTol + "," + StrDimLTol + "," + StrDimMeasure[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]                  print #1, StrOutputLine[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]              End If[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]          End If[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]      Next[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]      Close #1[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]      MsgBox("File save complete")[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]End Sub[/COLOR][/SIZE]
[/COLOR][/SIZE]
Parents
  • function called in .csv output script.

    Here is the function that is called in my .csv output script. You will need to copy and paste this into your basic script editor along with the previous script.

    [SIZE=2][COLOR=#0000ff]Function FncCmdType(ByVal intCmdTypeFunc As Double) As String[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]    Dim StrFunCmd As String[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]    Select Case intCmdTypeFunc[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]        Case 1200 'start of TP dimension[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]            StrFunCmd = "Start_TP"[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]        Case 1201 'end of TP dimension[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]            StrFunCmd = "End_TP"[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]        Case 1000 'start of location dimension[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]            StrFunCmd = "Start_Loc"[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]        Case 1001 'end of location dimension[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]            StrFunCmd = "End_Loc"[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]        Case 1002 'x location[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]            StrFunCmd = "X"[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]        Case 1003 'y locatio[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]            StrFunCmd = "Y"[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]        Case 1004 'z location[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]            StrFunCmd = "Z"[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]        Case 1005 'diameter location[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]            StrFunCmd = "D"[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]        Case 1006 'radius location[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]            StrFunCmd = "R"[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]        Case 1007 'angle location[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]            StrFunCmd = "A"[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]        Case 1008 't vector location[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]            StrFunCmd = "T"[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]        Case 1011 'vector location[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]            StrFunCmd = "V"[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]        Case 1012 'length location[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]            StrFunCmd = "L"[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]        Case 1017 'height location[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]            StrFunCmd = "H"[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]        Case 1009 'polar raduis location[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]            StrFunCmd = "PR"[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]        Case 1010 'polar angle location[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]            StrFunCmd = "PA"[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]        Case 1013 'pin diameter location[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]            StrFunCmd = "PD"[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]        Case 1014 'deviation along report vector[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]            StrFunCmd = "RT"[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]        Case 1015 'surface deviation[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]            StrFunCmd = "S"[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]        Case 1016 'surface deviation along report vector[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]            StrFunCmd = "RS"[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]        Case 1100 'straightness[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]            StrFunCmd = "STRT"[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]        Case 1101 'roundness[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]            StrFunCmd = "RND"[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]        Case 1102 'flatness[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]            StrFunCmd = "FLAT"[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]        Case 1103 'perpendicularity[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]            StrFunCmd = "PERP"[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]        Case 1104 'parallelism[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]            StrFunCmd = "PARA"[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]        Case 1105 'profile of surface[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]            StrFunCmd = "SPRF"[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]        Case 1118 'profile of line[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]            StrFunCmd = "LPRF"[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]        Case 1106 '3d distance[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]            StrFunCmd = "DIST"[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]        Case 1107 '2d distance[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]            StrFunCmd = "DIST"[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]        Case 1108 '3d angle[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]            StrFunCmd = "ANGL"[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]        Case 1109 '2d angle[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]            StrFunCmd = "ANGL"[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]        Case 1110 'runout[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]            StrFunCmd = "RNOT"[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]        Case 1111 'concentricity[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]            StrFunCmd = "CONC"[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]        Case 1112 'angularity[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]            StrFunCmd = "ANTY"[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]        Case 1113 'keyin[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]            StrFunCmd = "KEY"[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]        Case 1202 'TP x location[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]            StrFunCmd = "TPX"[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]        Case 1203 'TP y location[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]            StrFunCmd = "TPY"[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]        Case 1204 'TP z location[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]            StrFunCmd = "TPZ"[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]        Case 1205 'datum(?) diameter[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]            StrFunCmd = "TPDD"[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]        Case 1206 'diameter of feature[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]            StrFunCmd = "TPDF"[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]        Case 1207 'TP polar radius location[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]            StrFunCmd = "TPPR"[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]        Case 1208 'TP polar angle location[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]            StrFunCmd = "TPPA"[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]        Case 1209 'TP location [/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]            StrFunCmd = "TPDM"[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]        Case 1115 'symmetry[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]            StrFunCmd = "SYMT"[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]        Case 1114 'Coaxiality [/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]            StrFunCmd = "COAX"[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]        Case Else 'Everything else[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]            StrFunCmd = "UNKN"[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]    End Select[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]    FncCmdType = StrFunCmd[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]End Function[/COLOR][/SIZE]


    I have used this a couple of different times in a couple of different programs so I thought that it would be easier to write this as a function. That's why I have done this the way I have.
Reply
  • function called in .csv output script.

    Here is the function that is called in my .csv output script. You will need to copy and paste this into your basic script editor along with the previous script.

    [SIZE=2][COLOR=#0000ff]Function FncCmdType(ByVal intCmdTypeFunc As Double) As String[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]    Dim StrFunCmd As String[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]    Select Case intCmdTypeFunc[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]        Case 1200 'start of TP dimension[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]            StrFunCmd = "Start_TP"[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]        Case 1201 'end of TP dimension[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]            StrFunCmd = "End_TP"[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]        Case 1000 'start of location dimension[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]            StrFunCmd = "Start_Loc"[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]        Case 1001 'end of location dimension[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]            StrFunCmd = "End_Loc"[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]        Case 1002 'x location[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]            StrFunCmd = "X"[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]        Case 1003 'y locatio[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]            StrFunCmd = "Y"[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]        Case 1004 'z location[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]            StrFunCmd = "Z"[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]        Case 1005 'diameter location[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]            StrFunCmd = "D"[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]        Case 1006 'radius location[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]            StrFunCmd = "R"[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]        Case 1007 'angle location[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]            StrFunCmd = "A"[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]        Case 1008 't vector location[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]            StrFunCmd = "T"[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]        Case 1011 'vector location[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]            StrFunCmd = "V"[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]        Case 1012 'length location[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]            StrFunCmd = "L"[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]        Case 1017 'height location[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]            StrFunCmd = "H"[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]        Case 1009 'polar raduis location[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]            StrFunCmd = "PR"[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]        Case 1010 'polar angle location[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]            StrFunCmd = "PA"[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]        Case 1013 'pin diameter location[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]            StrFunCmd = "PD"[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]        Case 1014 'deviation along report vector[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]            StrFunCmd = "RT"[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]        Case 1015 'surface deviation[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]            StrFunCmd = "S"[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]        Case 1016 'surface deviation along report vector[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]            StrFunCmd = "RS"[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]        Case 1100 'straightness[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]            StrFunCmd = "STRT"[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]        Case 1101 'roundness[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]            StrFunCmd = "RND"[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]        Case 1102 'flatness[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]            StrFunCmd = "FLAT"[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]        Case 1103 'perpendicularity[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]            StrFunCmd = "PERP"[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]        Case 1104 'parallelism[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]            StrFunCmd = "PARA"[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]        Case 1105 'profile of surface[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]            StrFunCmd = "SPRF"[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]        Case 1118 'profile of line[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]            StrFunCmd = "LPRF"[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]        Case 1106 '3d distance[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]            StrFunCmd = "DIST"[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]        Case 1107 '2d distance[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]            StrFunCmd = "DIST"[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]        Case 1108 '3d angle[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]            StrFunCmd = "ANGL"[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]        Case 1109 '2d angle[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]            StrFunCmd = "ANGL"[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]        Case 1110 'runout[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]            StrFunCmd = "RNOT"[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]        Case 1111 'concentricity[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]            StrFunCmd = "CONC"[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]        Case 1112 'angularity[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]            StrFunCmd = "ANTY"[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]        Case 1113 'keyin[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]            StrFunCmd = "KEY"[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]        Case 1202 'TP x location[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]            StrFunCmd = "TPX"[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]        Case 1203 'TP y location[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]            StrFunCmd = "TPY"[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]        Case 1204 'TP z location[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]            StrFunCmd = "TPZ"[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]        Case 1205 'datum(?) diameter[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]            StrFunCmd = "TPDD"[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]        Case 1206 'diameter of feature[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]            StrFunCmd = "TPDF"[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]        Case 1207 'TP polar radius location[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]            StrFunCmd = "TPPR"[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]        Case 1208 'TP polar angle location[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]            StrFunCmd = "TPPA"[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]        Case 1209 'TP location [/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]            StrFunCmd = "TPDM"[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]        Case 1115 'symmetry[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]            StrFunCmd = "SYMT"[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]        Case 1114 'Coaxiality [/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]            StrFunCmd = "COAX"[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]        Case Else 'Everything else[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]            StrFunCmd = "UNKN"[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]    End Select[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]    FncCmdType = StrFunCmd[/COLOR][/SIZE]
    [SIZE=2][COLOR=#0000ff]End Function[/COLOR][/SIZE]


    I have used this a couple of different times in a couple of different programs so I thought that it would be easier to write this as a function. That's why I have done this the way I have.
Children
No Data