Sub main 'Delare variable For file Name To Write To Dim strFileName As String 'connect To PCD program Dim ObjApp As Object Dim ObjPP As Object Dim ObjCmds As Object Dim ObjCmd As Object Dim ObjPart As Object Dim lngNumCmds As Long Set ObjApp = CreateObject("PCDLRN.Application") Set ObjPart = ObjApp.ActivePartProgram Set ObjCmds = ObjPart.Commands Set lngNumCmds = ObjCmds.Count 'Declare variables used For gather Output info Dim StrDimID As String Dim StrDimFeature As String Dim StrDimType As String Dim StrDimNominal As String Dim StrDimUTol As String Dim StrDimLTol As String Dim StrDimMeasure As String Dim StrDimDeviation As String 'Declare variable For creating CSV text like Dim StrTraceLine As String Dim StrOutputLine As String 'Build And assign file Name strFileName = "C:\PCD output.txt" Open strFileName For Output As #1 For Each ObjCmd In ObjCmds If ObjCmd.IsDimension Then If Not (ObjCmd.DimensionCommand.IsLocationAxis Or ObjCmd.DimensionCommand.IsTruePosAxis) Then StrDimID = ObjCmd.DimensionCommand.ID StrDimFeature = ObjCmd.DimensionCommand.Feat1 End If StrDimType = FncCmdType(ObjCmd.Type) StrDimNominal = CStr(ObjCmd.DimensionCommand.Nominal) StrDimUTol = CStr(ObjCmd.DimensionCommand.Plus) StrDimLTol = CStr(ObjCmd.DimensionCommand.Minus) StrDimDev = CStr(ObjCmd.DimensionCommand.Deviation) If StrDimType <> "T" Then StrDimMeasure = CStr(ObjCmd.DimensionCommand.Measured) Else StrDimMeasure = CStr(ObjCmd.DimensionCommand.Deviation) End If If Not (StrDimType = "Start_Loc" Or StrDimType = "Start_TP") Then StrOutputLine = StrDimID + "," + StrDimType + "," + StrDimDev + "," + "0" + "," + StrDimUTol + "," + "-" + StrDimLTol Print #1, StrOutputLine End If End If Next Close #1 MsgBox("File save complete") End Sub Function FncCmdType(ByVal intCmdTypeFunc As Double) As String Dim StrFunCmd As String Select Case intCmdTypeFunc Case 1200 'start of TP dimension StrFunCmd = "Start_TP" Case 1201 'End of TP dimension StrFunCmd = "End_TP" Case 1000 'start of location dimension StrFunCmd = "Start_Loc" Case 1001 'End of location dimension StrFunCmd = "End_Loc" Case 1002 'x location StrFunCmd = "X" Case 1003 'y locatio StrFunCmd = "Y" Case 1004 'z location StrFunCmd = "Z" Case 1005 'diameter location StrFunCmd = "D" Case 1006 'radius location StrFunCmd = "R" Case 1019 'roundness location StrFunCmd = "F" Case 1007 'angle location StrFunCmd = "A" Case 1008 't vector location StrFunCmd = "T" Case 1011 'vector location StrFunCmd = "V" Case 1009 'polar raduis location StrFunCmd = "U" Case 1010 'polar angle location StrFunCmd = "V" Case 1013 'pin diameter location StrFunCmd = "PD" Case 1101 'roundness StrFunCmd = "F" Case 1102 'flatness StrFunCmd = "F" Case 1103 'perpendicularity StrFunCmd = "D" Case 1104 'parallelism StrFunCmd = "D" Case 1106 '3d distance StrFunCmd = "D" Case 1107 '2d distance StrFunCmd = "D" Case 1108 '3d angle StrFunCmd = "A" Case 1109 '2d angle StrFunCmd = "A" Case 1111 'concentricity StrFunCmd = "D" Case 1112 'angularity StrFunCmd = "A" Case 1113 'keyin StrFunCmd = "D" Case 1202 'TP x location StrFunCmd = "X" Case 1203 'TP y location StrFunCmd = "Y" Case 1204 'TP z location StrFunCmd = "Z" Case 1205 'datum(?) diameter StrFunCmd = "D" Case 1206 'diameter of feature StrFunCmd = "D" Case 1207 'TP polar radius location StrFunCmd = "U" Case 1208 'TP polar angle location StrFunCmd = "V" Case 1209 'TP location StrFunCmd = "T" Case 1218 'TP roundness StrFunCmd = "F" Case 1115 'symmetry StrFunCmd = "D" Case 1114 'Coaxiality StrFunCmd = "D" Case Else 'Everything Else StrFunCmd = "D" End Select FncCmdType = StrFunCmd End Function