hexagon logo

Need help on OUTTOL.BAS file

I have used this script many time and have even made a couple minor mods.
Here is my issue. It is looking for "END OF DIMENSION" and profiles and distances do not have this. It skips over and ignore those. Anybody have an idea as to how I can mod this script to do this ???

Time is critical, I appreciate anyone who responds and helps !!

For Each Cmd In Cmds
    ' if the command of the current iteration is a dimension ...
    If Cmd.IsDimension Then
      ' and it is not a start or end dimension object ...
      If Cmd.Type <> DIMENSION_START_LOCATION And _
         Cmd.Type <> DIMENSION_END_LOCATION And _
         Cmd.Type <> DIMENSION_TRUE_START_POSITION And _
         Cmd.Type <> DIMENSION_TRUE_END_POSITION Then
        ' then get the dimensioncommand object from the command
        Set DimCmd = Cmd.DimensionCommand
        ' If it is out of tolerance, increment numberout, otherwise increment numberin
        If DimCmd.OutTol > 0 Then
          NumberOut = NumberOut + 1
        Else
  • I have used this script many time and have even made a couple minor mods.
    Here is my issue. It is looking for "END OF DIMENSION" and profiles and distances do not have this. It skips over and ignore those. Anybody have an idea as to how I can mod this script to do this ???

    Time is critical, I appreciate anyone who responds and helps !!

    For Each Cmd In Cmds
        ' if the command of the current iteration is a dimension ...
        If Cmd.IsDimension Then
          ' and it is not a start or end dimension object ...
          If Cmd.Type <> DIMENSION_START_LOCATION And _
             Cmd.Type <> DIMENSION_END_LOCATION And _
             Cmd.Type <> DIMENSION_TRUE_START_POSITION And _
             Cmd.Type <> DIMENSION_TRUE_END_POSITION Then
            ' then get the dimensioncommand object from the command
            Set DimCmd = Cmd.DimensionCommand
            ' If it is out of tolerance, increment numberout, otherwise increment numberin
            If DimCmd.OutTol > 0 Then
              NumberOut = NumberOut + 1
            Else
    

    Can you make a generic point based upon the IN/OUT of those types of dimensions, then make a dimension of the generic point that will show you in/out with a END OF DIMENSION statement?

    I always wondered WHY those didn't have the ALL IMPORTANT EOD line. Just one of the annoyances of Pcdmis.

    Let me check into a "sample" for ya....
  • Can you make a generic point based upon the IN/OUT of those types of dimensions, then make a dimension of the generic point that will show you in/out with a END OF DIMENSION statement?

    I always wondered WHY those didn't have the ALL IMPORTANT EOD line. Just one of the annoyances of Pcdmis.

    Let me check into a "sample" for ya....

    Here, this worked: 3D distance does not have the EOD line

    DIM D062A= 3D DISTANCE FROM POINT P062 TO PLANE PLN065, NO_RADIUS  UNITS=MM ,$
    GRAPH=OFF  TEXT=OFF  MULT=1.00  OUTPUT=BOTH
    AX   NOMINAL     +TOL       -TOL       MEAS        DEV      OUTTOL   
    M       1.583      0.250      0.250      0.697     -0.886      0.636 <--------
                ASSIGN/V1 = D062A.OUTTOL
    P002       =GENERIC/POINT,DEPENDENT,RECT,$
                NOM/XYZ,0,0,0,$
                MEAS/XYZ,V1,0,0,$
                NOM/IJK,0,0,1,$
                MEAS/IJK,0,0,1
    DIM D066= LOCATION OF POINT P002  UNITS=MM ,$
    GRAPH=OFF  TEXT=OFF  MULT=1.00  OUTPUT=NONE
    AX   NOMINAL     +TOL       -TOL       MEAS        DEV      OUTTOL   
    X       0.000      0.000      0.000      0.636      0.636      0.636 -------->
    END OF DIMENSION D066
    

    Send the DIM to NONE so it will not show up on the report or in the stats, but just gets used as an OOT count.
  • Jim,

    I have structured my loops a little differently. Instead of checking to see if it's not a start or end I check it to see if it is a locaton axis or TP axis and this captures distances just fine for me, but I can't remember ever trying to get it if it is a profile. I would assume though that it should pick that up also...

     
    if cmd.IsDimension then
      if cmd.DimensionCommand.IsLocationAxis or cmd.DimensionCommand.IsTurePosAxis then
        if cmd.DimensionCommand.OutTol > 0 then
          NumberOut = NumberOut + 1
        else 
          NumberIn = NumberIn +1
        end if
      end if
    end if


    This code is a modification of something else that I have done. I've never tried it in this application but I think that it will work.
  • Matt,

    I applaud you for your efforts, but too many programs, too much junk that would go to Datapage...

    Tnx for trying though...
  • Jim,

    I have structured my loops a little differently. Instead of checking to see if it's not a start or end I check it to see if it is a locaton axis or TP axis and this captures distances just fine for me, but I can't remember ever trying to get it if it is a profile. I would assume though that it should pick that up also...

     
    if cmd.IsDimension then


    Can you expand or elaborate on this for me ? Do I add this to my script then ? if so, where abouts ?
  • Matt,

    I applaud you for your efforts, but too many programs, too much junk that would go to Datapage...

    Tnx for trying though...

    NO, wouldn;'t go into datapage with the 'extra dimension' set to NONE, it shows up no where, not on the report, not in datapage, just on the screen. Of course, I have no idea if your file would capture it if it's not on the report.....

    BUT, I do get "too many progams".
  • Can you expand or elaborate on this for me ? Do I add this to my script then ? if so, where abouts ?



    Try replacing this:
    If Cmd.IsDimension Then
          ' and it is not a start or end dimension object ...
          If Cmd.Type <> DIMENSION_START_LOCATION And _
             Cmd.Type <> DIMENSION_END_LOCATION And _
             Cmd.Type <> DIMENSION_TRUE_START_POSITION And _
             Cmd.Type <> DIMENSION_TRUE_END_POSITION Then
            ' then get the dimensioncommand object from the command
            Set DimCmd = Cmd.DimensionCommand
            ' If it is out of tolerance, increment numberout, otherwise increment numberin
            If DimCmd.OutTol > 0 Then
              NumberOut = NumberOut + 1
            Else


    with this:
    if cmd.IsDimension then
      if cmd.DimensionCommand.IsLocationAxis or cmd.DimensionCommand.IsTurePosAxis then
        if cmd.DimensionCommand.OutTol > 0 then
          NumberOut = NumberOut + 1
        else 
          NumberIn = NumberIn +1
        end if
      end if
    end if
  • How can I go about adding "ProfileAxis" ?



    I'm not sure that there is a seperate profile axis. I think that it is covered under location axis. But then again the version that I wrote this for (3.7) doesn't have all of that funky XactMeasure stuff either. Is this not picking up your profiles?


    EDIT:

    I just added a line and a surface profile to a program and ran the script that I based this on and it does correctly output the profile dimensions so I think that it should be ok. Again that is in 3.7.
  • There was an example on here that Jan D. had posted that searched for dimensions differently. This alleviates the problem with profile and distances. I took this and modified it only slightly to serve my purposes. Mainly I have added in provisions to grab the reference feature names. EHines's method will also work.


    Dim objApp As Object
    Set objApp = CreateObject("PCDLRN.Application")
    Dim objPart As Object
    Set objPart = objApp.ActivePartProgram
    Dim objCmds 'As Object
    Set objCmds = objPart.Commands
    Dim objCmd 'As Object
    Dim objDimCmd As Object
    Dim dblOutTol As Long
    dblOutTol = 0
    Dim dblTotalMeas As Long
    dblTotalMeas = 0
    
    
    
    'Open newdir & "\DIMENSIONSEVALUATED.TXT" For Output As #3
    
    Dim prevIDName As String
    Dim count1
    Dim count2
    Dim prevcount1
    Dim prevcount2
    Dim prevID2Name As String 
    Dim objCmdDeviation As Double
    Dim objCmdOuttol As Double
    Dim ID As String
    Dim ID2 As String
    Dim DimensionName As String
    Dim Msg As String
    
    
    Dim cnt As Integer
      
    For cnt =1 To Objcmds.count  
     Set objcmd = objcmds.Item(cnt)
    
    If objcmd.marked = True Then   'CHECK For MARKED DIMENSIONS HERE
    
        If objcmd.IsDimension Then 
            Set Dimensionname = objcmd.DimensionCommand
            ID = Dimensionname.feat1          'capture the ID Name of the command that is being looked at. 
            count1 = cnt
            If ID = "" Then            'Make sure that commands always have a Name.      
                 ID = prevIDName
                 count1 = prevcount1
            End If
            prevIDName = ID       'Save the old Name just In Case the Next one is ""
            prevcount1 = count1
    
    
            ID2 = Dimensionname.feat2
            count2 = cnt
            If ID2 = "" Then
                 ID2 = prevID2Name
                 count2 = prevcount2
            End If
            PrevID2Name = ID2  
            prevcount2 = count2    
    
            If count1 = count2 Then       'If .feat1 And .feat2 names were found On the same Line, Then assign them both To the ID thats outtol
               ID = ID & "-" & ID2
            End If 
        End If  
    
        
            'Second Step: first possibility: hunt For legacy dimensions
            
            If objCmd.IsDimension And objCmd.Type<>1000 Then
                dblTotalMeas=dblTotalMeas+1
                Set objDimCmd=objCmd.DimensionCommand  
                If objDimCmd.OutTol<>0 Then
                    dblOutTol=dblOutTol+1
                    Msg = Msg & ID & Chr(10)
                End If 'objDimCmd.OutTol<>0
                'Print #3, "***LEGACY***" & ID & "***"
                'Print #3, "objCmd.Type: " & objcmd.Type
                'Print #3, "OUTTOL number: " & objDimCmd.OutTol
                'Print #3, "Number out of tolerance: " & dblOutTol
                'Print #3, "Total evaluated: " & dblTotalMeas
                'Print #3, ""
            End If 'objCmd.IsDimension 
    
            'Third Step: second possibility: hunt For XactMeasure GD&T dimensions    
    
            If objCmd.Type=184 Then           'this seems To be the way To find an XactMeasure GD&T Call.
    
                If objCmd.gettext(LINE1_OUTTOL,1)<>"" Then   'look In Line 1 For an OUTTOL
                    dblTotalMeas=dblTotalMeas+1
                    If objCmd.gettext(LINE1_OUTTOL,1)<>0 Then   'If there is an OUTTOL In Line 1, is it Not zero?
                        dblOutTol=dblOutTol+1
                        Msg = Msg & ID & Chr(10)
                    End If 'objCmd.gettext(LINE1_OUTTOL,1)<>0
                    'Print #3, "***XactMeasure Line1***" & ID & "***"
                    'Print #3, "OUTTOL number: " & objCmd.gettext(LINE1_OUTTOL,1)
                    'Print #3, "Number out of tolerance: " & dblOutTol
                    'Print #3, "Total evaluated: " & dblTotalMeas
                    'Print #3, ""
                End If 'objCmd.gettext(LINE1_OUTTOL,1)<>""
               
                If objCmd.gettext(LINE2_OUTTOL,1)<>"" Then   'look In Line 2 For an OUTTOL
                    dblTotalMeas=dblTotalMeas+1
                    If objCmd.gettext(LINE2_OUTTOL,1)<>0 Then   'If there is an OUTTOL In Line 2, is it Not zero?
                        dblOutTol=dblOutTol+1
                        Msg = Msg & ID & Chr(10)
                    End If 'objCmd.gettext(LINE1_OUTTOL,1)<>0
                    'Print #3, "***XactMeasure Line2***" & ID & "***"
                    'Print #3, "OUTTOL number: " & objCmd.gettext(LINE2_OUTTOL,1)
                    'Print #3, "Number out of tolerance: " & dblOutTol
                    'Print #3, "Total evaluated: " & dblTotalMeas
                    'Print #3, ""
                End If 'objCmd.gettext(LINE2_OUTTOL,1)<>""
    
                If objCmd.gettext(LINE3_OUTTOL,1)<>"" Then   'look In Line 3 For an OUTTOL
                    dblTotalMeas=dblTotalMeas+1
                    If objCmd.gettext(LINE3_OUTTOL,1)<>0 Then   'If there is an OUTTOL In Line 3, is it Not zero?
                        dblOutTol=dblOutTol+1
                        Msg = Msg & ID & Chr(10)
                    'End If 'objCmd.gettext(LINE3_OUTTOL,1)<>0
                    'Print #3, "***XactMeasure Line3***" & ID & "***"
                    'Print #3, "OUTTOL number: " & objCmd.gettext(LINE3_OUTTOL,1)
                    'Print #3, "Number out of tolerance: " & dblOutTol
                    'Print #3, "Total evaluated: " & dblTotalMeas
                    'Print #3, ""
                End If 'objCmd.gettext(LINE3_OUTTOL,1)<>""
    
    
            End If 'objCmd.Type=184
    
         End If    'objcmd.marked = True        'End marked search here
        End If
    
    Next cnt  
    
    'Close #3
    
    Dim Var
    Dim Var2 As Object
    
    If dblouttol = 0 Then
       msgbox "Part is GOOD!"  
       Set Var = objPART.GetVariableValue ("SUB_OUTTOLNUM")        'Grabs the variable SUB_OUTTOLNUM from the subroutine program
       Var.stringvalue  = dblouttol                                     'Sets variable As number of outtol dimensions. Change this To actual CMM Name/number
       Set Var2 = objPART.getvariablevalue ("SUB_ACCEPTREJECT")  'Grabs the variable Sub_ACCEPTREJECT from the subroutine program
       var2.stringvalue = "~~1 ACCEPTED"                                                                       'Sets variable As Accept, As part is good
    End If  
    
    
    If dblouttol > 0 Then 
       MsgBox "Part is BAD!" & Chr(10) & "Number of Dimensions Out of Tolerance:" & dblouttol & Chr(10) &"Features out of tolerance:" & Chr(10) & Msg ' Display the ID's that are out of tolerance
       Set Var = objPART.GetVariableValue ("SUB_OUTTOLNUM")        'Grabs the variable SUB_OUTTOLNUM from the subroutine program
       Var.stringvalue  = dblOutTol                                      'Sets variable As number of outtol dimensions. Change this To actual CMM Name/number
       Set Var2 = objPART.getvariablevalue ("SUB_ACCEPTREJECT")  'Grabs the variable Sub_ACCEPTREJECT from the subroutine program
       var2.stringvalue = "~~4 REJECTED"                                                                       'Sets variable As Accept, As part is good
                    
    End If  
    
    objPART.SetVariableValue "SUB_OUTTOLNUM", Var                  'Passes the number of outtol dimensions back To the subroutine
    objPART.SetVariableValue "SUB_ACCEPTREJECT", Var2
           
    End Sub