Sub Main() ' --- Error ------------------------------------------------------------------------------ On Error GoTo ErrorHandler ' --- Dim something ------------------------------------------------------------------------------ Dim retval Dim vpcDMIS_App, vpcDMIS_Part, vpcDMIS_Cmds, vpcDMIS_Cmd As Object Set vpcDMIS_App = CreateObject("PCDLRN.Application") Set vpcDMIS_Part = vpcDMIS_App.ActivePartProgram Set vpcDMIS_Cmds = vpcDMIS_Part.Commands Set vpcDMIS_Cmd = Nothing Dim bStart As Boolean Dim iLoopIndex, iFound As Integer Dim sID, sOutput, INFOPath As String ' --- save part ------------------------------------------------------------------------------------ vpcDMIS_Part.Save ' --- search Commands ------------------------------------------------------------------------------ iLoopIndex = 0 iFound = 0 For Each vpcDMIS_Cmd In vpcDMIS_Cmds iLoopIndex = iLoopIndex + 1 ' *** user info ************** vpcDMIS_App.StatusBar = "Script: Cycling through commands. Current command: " & iLoopIndex Set vpcDMIS_Cmd = vpcDMIS_Cmds.Item(iLoopIndex) ' *** test for Marked ************** If vpcDMIS_Cmd.Marked = False Then ' ignore all Marked commands GoTo NextLoop End If ' *** find DIMENSION_START_LOCATION ************** If vpcDMIS_Cmd.Type = DIMENSION_START_LOCATION Then bStart = True sID = vpcDMIS_Cmd.GetText(ID, 0) GoTo NextLoop End If ' *** find DIMENSION_LOCATION ************** 'sOutput = "ID; AX; NOMINAL; +Tol; -Tol; DEV; OUTTOL" If bStart And vpcDMIS_Cmd.IsDimension Then iFound = iFound + 1 sOutput = sOutput & sID & ";" sOutput = sOutput & vpcDMIS_Cmd.GetText(Axis, 0) & ";" sOutput = sOutput & vpcDMIS_Cmd.GetText(Nominal, 0) & ";" sOutput = sOutput & vpcDMIS_Cmd.GetText(F_PLUS_TOL, 0) & ";" sOutput = sOutput & vpcDMIS_Cmd.GetText(F_MINUS_TOL, 0) & ";" sOutput = sOutput & vpcDMIS_Cmd.GetText(DIM_DEVIATION, 0) & ";" sOutput = sOutput & vpcDMIS_Cmd.GetText(DIM_OUTTOL, 0) sOutput = sOutput & Chr(13) & Chr(10) GoTo NextLoop End If ' *** find DIMENSION_END_LOCATION ************** If vpcDMIS_Cmd.Type = DIMENSION_START_LOCATION Then bStart = False sID = "" GoTo NextLoop End If NextLoop: Next vpcDMIS_Cmd ' --- print output -------------------------------------------------------------------------------- If sOutput <> "" Then sOutput = "ID; AX; NOMINAL; +Tol; -Tol; DEV; OUTTOL" & Chr(13) & Chr(10) & sOutput MsgBox sOutput 'Open INFOPath For Append As #1 'Print #1, sOutput 'Close #1 End If ' --- end ----------------------------------------------------------------------------------------- ErrorHandler: vpcDMIS_App.StatusBar = "Script: " & CStr(iLoopIndex) & " searched commands | Found Dimension: " & CStr(iFound) ' --- free something ------------------------------------------------------------------------------ Set vpcDMIS_Cmd = Nothing Set vpcDMIS_Cmds = Nothing Set vpcDMIS_Part = Nothing Set vpcDMIS_App = Nothing End Sub