Your Products have been synced, click here to refresh
Sub CheckOOT() Dim PCDApp, PCDPartPrograms, PCDPartProgram, PCDCommands, PCDCommand, PCDDimension Set PCDApp = CreateObject("PCDLRN.Application") Set PCDPartPrograms = PCDApp.PartPrograms Set PCDPartProgram = PCDApp.ActivePartProgram Set PCDCommands = PCDPartProgram.Commands Dim cnt As Integer Dim state As Integer Dim ID As String Dim Msg As String State = 1 ' Set state To 'Normal' For cnt = 1 To PCDCommands.Count Set PCDCommand = PCDCommands.Item(cnt) If PCDCommand.IsDimension Then Set PCDDimension = PCDCommand.DimensionCommand Select Case State Case 1 ' If it is a 'normal' dimension evaluation ID = PCDDimension.ID If (PCDCommand.Type = DIMENSION_TRUE_START_POSITION) Then State = 2 ' If we reached a TP dimension, Set state To 'True Position' (2) ElseIf (PCDCommand.Type = DIMENSION_START_LOCATION) Then State = 3 ' If we reached a LOCation dimension, Set state To 'LOCation' (3) End If If (State = 1) Then ' If it is a 'normal' dimension And out of tol, Do stuff below If (Abs(PCDDimension.OutTol) > 0.00005) Then Msg = Msg & ID & Chr(10) ' Adds the ID To our message End If Case 2 ' If it is a TP dimension evaluation And out of tol, Do stuff below If (Abs(PCDDimension.OutTol) > 0.00005) Then Msg = Msg & ID & Chr(10) ' Adds the ID To our message Case 3 ' If it is a LOCation dimension evaluation And out of tol, Do stuff below If (Abs(PCDDimension.OutTol) > 0.00005) Then Msg = Msg & ID & Chr(10) ' Adds the ID To our message End Select Set PCDDimension = Nothing ' Reset the PCDDimension Object ElseIf (PCDCommand.Type = DIMENSION_TRUE_END_POSITION) Then State = 1 ' Return state To 'Normal' As we have encountered the End of the TP dimension ElseIf (PCDCommand.Type = DIMENSION_END_LOCATION) Then State = 1 ' Return state To 'Normal' As we have encountered the End of the LOCation dimension End If Set PCDCommand = Nothing ' Reset the PCDCommand Object Next cnt ' Move To the Next command MsgBox Msg ' Display the ID's that are out of tolerance End Sub
The very bottom of the Edit Window reports Total # of meas and # out of tol.
Ought to be a way to grab that info...
We don't use Operator Mode so I don't know if it is visible.
ClayT - good thinking... Thanks to you, I remembered the file "elogo.dat", opened it, and found the variable I need to be "#NOUT"... Now, my good friends, how would I use that within the body of a program (and not just at the end) ??? I'll have to experiment until someone within the DMIS hierarchy might respond...
ASSIGN/V1=GETPROGRAMINFO("NUMOOT","") IF/V1=="1" PRINT/REPORT,EXEC MODE=END,$ TO_FILE=ON,AUTO=1,$ TO_PRINTER=ON,$ TO_DMIS_REPORT=OFF,FILE_OPTION=INDEX,FILENAME=,$ REPORT_THEORETICALS=NONE,REPORT_FEATURE_WITH_DIMENSIONS=NO,$ PREVIOUS_RUNS=DELETE_INSTANCES END_IF/ IF/V1=="0" PRINT/REPORT,EXEC MODE=END,$ TO_FILE=ON,AUTO=1,$ TO_PRINTER=OFF,$ TO_DMIS_REPORT=OFF,FILE_OPTION=INDEX,FILENAME=,$ REPORT_THEORETICALS=NONE,REPORT_FEATURE_WITH_DIMENSIONS=NO,$ PREVIOUS_RUNS=DELETE_INSTANCES END_IF/ PRINT/REPORT,EXEC MODE=END,$ TO_FILE=OFF,AUTO=1,$ TO_PRINTER=OFF,$ TO_DMIS_REPORT=OFF,FILE_OPTION=INDEX,FILENAME=,$ REPORT_THEORETICALS=NONE,REPORT_FEATURE_WITH_DIMENSIONS=NO,$ PREVIOUS_RUNS=DELETE_INSTANCES
Here is what you were asking for and seems to work well.Here's what I'm trying to do - Display a message, prior to printing results, that says "There are N dimensions out-of-tolerance, do you still want to print the report?" Of course, I could accomplish this by doing a whole lot of computations with expressions, but I'd thought I'd first inquire if PC-DMIS can set a flag, based upon the Dimension command, that I can convert into a counter.
ASSIGN/V1=GETPROGRAMINFO("NUMOOT","") IF/V1=="1" PRINT/REPORT,EXEC MODE=END,$ TO_FILE=ON,AUTO=1,$ TO_PRINTER=ON,$ TO_DMIS_REPORT=OFF,FILE_OPTION=INDEX,FILENAME=,$ REPORT_THEORETICALS=NONE,REPORT_FEATURE_WITH_DIMENSIONS=NO,$ PREVIOUS_RUNS=DELETE_INSTANCES END_IF/ IF/V1=="0" C1 =COMMENT/YESNO,NO,FULL SCREEN=NO,AUTO-CONTINUE=NO, No features are out of tolerence, would you like to print this report? IF/C1.INPUT=="YES" PRINT/REPORT,EXEC MODE=END,$ TO_FILE=ON,AUTO=1,$ TO_PRINTER=ON,$ TO_DMIS_REPORT=OFF,FILE_OPTION=INDEX,FILENAME=,$ REPORT_THEORETICALS=NONE,REPORT_FEATURE_WITH_DIMENSIONS=NO,$ PREVIOUS_RUNS=DELETE_INSTANCES END_IF/ IF/C1.INPUT=="NO" PRINT/REPORT,EXEC MODE=END,$ TO_FILE=ON,AUTO=1,$ TO_PRINTER=OFF,$ TO_DMIS_REPORT=OFF,FILE_OPTION=INDEX,FILENAME=,$ REPORT_THEORETICALS=NONE,REPORT_FEATURE_WITH_DIMENSIONS=NO,$ PREVIOUS_RUNS=DELETE_INSTANCES END_IF/ PRINT/REPORT,EXEC MODE=END,$ TO_FILE=OFF,AUTO=1,$ TO_PRINTER=OFF,$ TO_DMIS_REPORT=OFF,FILE_OPTION=INDEX,FILENAME=,$ REPORT_THEORETICALS=NONE,REPORT_FEATURE_WITH_DIMENSIONS=NO,$ PREVIOUS_RUNS=DELETE_INSTANCES
© 2024 Hexagon AB and/or its subsidiaries. | Privacy Policy | Cloud Services Agreement |