hexagon logo

Code to pull Theo, Target, and Dimension nominals from PC-DMIS

I'm looking at developing a vba script in Excel to pull the theo, target, and dimension nominal values and generate a worksheet showing them. I would then apply conditional formatting to highlight the Target and Theo values that do not match the nominal values in the dimension statement. We have hundreds of CMM Programs that have been used and modified over many years and versions of PC-DMIS. I have been manually auditing data and finding points here and there where the T does not correlate with the XYZ coordinate deviations. I have found many auto vector features where the target and theo do not match the nominal in the dimension. A script that actually grabbed all the nominal, including the ijk vectors would be very useful to identify these issues. The operator would need to then verify the feature and correct the nominal that was deemed incorrect. Maybe there is such a tool within PC-DMIS to check for this. If that is the case, maybe one of the Guru's on here can point me to it. I am not a PC-DMIS user myself, so I cannot poke around in PC-DMIS to look for such a tool, but I work very closely with a group that does offline programming.
  • If all of your programs have random Target deviations, then it sounds like you have/had a systemic issue. The target value should match the THEO, unless it is specifically changed in the edit window, or it could mean that the alignments are not fully constraining the part. If the latter then, even when the target values are fixed, it will just keep happening.

    The 'T' value is not directly affected by the Target value. Target deals with telling the probe where to go physically. The deviation is calculated by comparing THEO to MEAS. If the dimension nominal does not match the THEO, then that is a whole other issue. Those should be directly linked, and should only change by purposefully modifying the dimension nominal, or updating a feature and saying "NO" to update dimension nominals.

    If the programmer for these still works there, I would recommend getting them additional training.
  • If all of your programs have random Target deviations, then it sounds like you have/had a systemic issue. The target value should match the THEO, unless it is specifically changed in the edit window, or it could mean that the alignments are not fully constraining the part. If the latter then, even when the target values are fixed, it will just keep happening.


    Not necessarily - the target values may have changed when the feature is so off that the CMM can't find it/hits it too early and the user/operator ansers "yes" to the question "update target values..." after measuring the feature.
  • Not necessarily - the target values may have changed when the feature is so off that the CMM can't find it/hits it too early and the user/operator ansers "yes" to the question "update target values..." after measuring the feature.


    That is true also, but is again indicative of someone who needs training. If it is across the board throughout their programs, either the parts they make are consistently garbage, or a programmer/operator has no idea what they're doing. IMHO.

    I would never answer yes to update the hit targets or a feature, just because it happened to be out on 1 part (or even a full run).
  • These are just sporadic and most likely operator errors. I want to create a script that will retrieve Theo and Target for all features and the nominal for all dims and generate an Excel Worksheet showing all the XYZ and ijk values for each. Then I will use conditional formatting to shade the values in the Target and Dims that are not equal to the values for the Theo. This will make it easy for the operator to see where there are differences. They would need to then review these and determine if the difference is intended, a feature that is so far from nominal that the target had to be different, or if they are errors.
  • These are just sporadic and most likely operator errors. I want to create a script that will retrieve Theo and Target for all features and the nominal for all dims and generate an Excel Worksheet showing all the XYZ and ijk values for each. Then I will use conditional formatting to shade the values in the Target and Dims that are not equal to the values for the Theo. This will make it easy for the operator to see where there are differences. They would need to then review these and determine if the difference is intended, a feature that is so far from nominal that the target had to be different, or if they are errors.


    this should get you started.

    you can always look in the help doc for some more documentation on the commands used below.

    hth

    -cappy

    
          dim app as object
          dim prog as object
          
          progName$ = "test.prg"
    
          set app = CreateObject("PCDLRN.Application")
          set prog = app.PartPrograms.Open(progName$,"Offline")
          dim cmd as object
          numCmds = prog.Commands.Count
                 for n = 1 to numCmds
                      cmd = prog.Commands.Item(n)
                      theox = cmd.GetFieldValue(THEO_X,0)
                      targx = cmd.GetFieldValue(TARG_X,0) 
                 next n
    
  • Thanks Cappy. That helped point me in the right direction. I believe I figure out what I was looking for to retrieve the ijk values used for dimensions. This is my little piece of code to grab the report vectors.

                Select Case DmisCommand.TypeDescription
                    Case "AUTO_EDGE_FEATURE"
                        Vec_I = DmisCommand.GetFieldValue(EDGEVEC_THEO_I, 0)
                        Vec_J = DmisCommand.GetFieldValue(EDGEVEC_THEO_J, 0)
                        Vec_K = DmisCommand.GetFieldValue(EDGEVEC_THEO_K, 0)
                    Case Else
                        Vec_I = DmisCommand.GetFieldValue(REPORTVEC_I, 0)
                        Vec_J = DmisCommand.GetFieldValue(REPORTVEC_J, 0)
                        Vec_K = DmisCommand.GetFieldValue(REPORTVEC_K, 0)
                End Select