hexagon logo

Set Flag if Dimension Out-of-Tolerance

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.
  • You could run a script that parses the DEV values and displays a message box accordingly.
  • you could also only report out of tolerance features.
  • Thank you, grandpaal56, but, being a medical facility, we have to report all features. As it stands now, in Operator Mode we have to stop the program, allow the operator to preview the report window (good or bad), and then either cancel the run if anything os OOT, or proceed to print / export the data.

    I was hoping that PC-DMIS would have it's own inherent method of tracking how many "red dimensions" (as they are called around here) are generated by each Dimension command. I could then do some conditional branching based upon that flag being set.

    Zeiss Calypso does a good job of turning the icon in the clearly-visible report window red if any characteristic of a dimension is OOT - not quite what I want, but IMHO better than the way PC-DMIS handles this.
  • 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...
  • Try this:

    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


    Found it in my script repository but I don't know how good/bad it works for your applications/programs.
    Eyeball it/doublecheck the report when using it for the first time/s to see that it captures all OOT.
  • Is there another way to make this function without going into a VB code ? with only some assign and IF function ?
    I tried this but it doesn't work : (I suppose "NUMBEROUTTOL" is not recognised...). And I am not very good with those functions.
    ...
    IF/NUMBEROUTTOL==0
    PRINT/REPORT,EXEC MODE=END,$
    TO_FILE=ON,AUTO=6,$
    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/
    ELSE_IF/NUMBEROUTTOL>0
    PRINT/REPORT,EXEC MODE=END,$
    TO_FILE=OFF,AUTO=3,$
    TO_PRINTER=OFF,$
    TO_DMIS_REPORT=OFF,FILE_OPTION=INDEX,FILENAME=,$
    REPORT_THEORETICALS=NONE,REPORT_FEATURE_WITH_DIMENSIONS=NO,$
    PREVIOUS_RUNS=DELETE_INSTANCES
    END_ELSEIF/
  • 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...


    You can't access that command.

    in V2013 and later there is a SYSTEMINFO (?) parameter that can be accessed.
  • I know it doesn't help in this case but in 2013MR1 and up there is:
    ASSIGN/V1=GETPROGRAMINFO("NUMOOT","")

    which returns the number of out of tolerance since the start of full execution.
  • I just wrote a small code that only prints if something is OOT, if that helps. I know it will me thanks.
    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'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.
    Here is what you were asking for and seems to work well.
    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