hexagon logo

Assign the Average Deviation and Standard Deviation of a Profile

Hi Y'all.

I have a simple question with a long-winded lead up, so please bear with me.

I have a customer that would like us to start reporting the Average Deviation and Standard Deviation of profile measurements. They even want to apply tolerances to these metrics. So, I'm looking for a way to display these on the report with a tolerance applied. That way our CMM operators can make a quick pass/fail judgment on each part.

I see that PC-DMIS has the option to display these metrics in a DIMINFO box, but I don't see a way to make them appear directly on the report. Even so, what I would really like to do is assign those values to some variables so I can go the route of putting them in generic features and reporting them with tolerances applied.

For example. Here is a Legacy Profile Dimension from the Edit Window:


And how it appears on the report:


From the DimInfo Box Dialog window I have access to the metrics I want.


And I can see from the Graphics Display Window that the values are being calculated:


I found that I can get the Standard Deviation using the GetText command:

However, I just can't seem to find a way to get the Mean value.

​Does anyone know how I can assign the Mean value to a variable? Or possibly an easier way to get the Standard Deviation value?
Or can you think of any other routs I may take to report these metrics with tolerances applied?


  • Why don't they just assign a Cpk and/or Ppk value to the profile measurements and control it with SPC?
  • Why don't they just assign a Cpk and/or Ppk value to the profile measurements and control it with SPC?


    That might be an option. We don't currently use SPC software where I work, but we could change that.

    Can SPC software do stats on the form deviations of individual features on individual parts? How does that work? I'm only familiar with doing SPC on many parts.
  • You said assignment ?Rolling eyes
    DISPLAYPRECISION/6 (or 7 in inches)
    ASSIGN/T_VALUE=DOT(DSCN01.HIT[1..DSCN01.NUMHITS].XYZ-DSCN01.HIT[1..DSCN01.NUMHITS].TXYZ,DSCN01.HIT[1..DSCN01.NUMHITS].TIJK)
    ASSIGN/MEAN=AVERAGE(T_VALUE)
    ASSIGN/STD_DEV=SQRT(SUM(T_VALUE^2-MEAN^2)/(DSCN01.NUMHITS-1))


    If there's no AVERAGE in your version, just

    ASSIGN/AVERAGE=SUM(T_VALUE)/DSCN01.NUMHITS


  • That might be an option. We don't currently use SPC software where I work, but we could change that.

    Can SPC software do stats on the form deviations of individual features on individual parts? How does that work? I'm only familiar with doing SPC on many parts.


    Standard Deviation is how wide the sigma is. This is based on many hits or part measurements.

    You'd have to investigate how to run the math behind doing the standard deviation.
  • You said assignment ?Rolling eyes
    DISPLAYPRECISION/6 (or 7 in inches)
    ASSIGN/T_VALUE=DOT(DSCN01.HIT[1..DSCN01.NUMHITS].XYZ-DSCN01.HIT[1..DSCN01.NUMHITS].TXYZ,DSCN01.HIT[1..DSCN01.NUMHITS].TIJK)
    ASSIGN/MEAN=AVERAGE(T_VALUE)
    ASSIGN/STD_DEV=SQRT(SUM(T_VALUE^2-MEAN^2)/(DSCN01.NUMHITS-1))


    If there's no AVERAGE in your version, just

    ASSIGN/AVERAGE=SUM(T_VALUE)/DSCN01.NUMHITS


    Thank you JEFMAN. That does the trick.
    I was hoping to be able to just grab the value that PC-DMIS can calculate itself, but that doesn't seem to be an option. At least with your method I know for sure that the math is right Wink.

    For what it's worth, your code returned the same exact value as I saw in the Diminfo box. It's nice to be able to double check PC-DMIS's math. After you post a while back that questioned the math behind outlier removal, I was a little concerned if the software would calculate the standard deviation the way I would expect. I'm happy to see that in this case it does.

    I am trying to modify your code to make something that I can easily cut and paste after each profile feature. I am using the GETTEXT and GETCOMMAND functions to automatically get the referenced feature from the profile feature that precedes it. I'm able to assign a pointer to that feature, but I'm having trouble getting data about individual hits from that pointer. Here is some code:

    DIM DIM44_1= PROFILE OF SURFACE OF SET DSCN01    FORMANDLOCATION  UNITS=IN ,$
    GRAPH=OFF  TEXT=OFF  MULT=100.00  ARROWDENSITY=100  OUTPUT=BOTH
    AX    NOMINAL       +TOL       -TOL       MEAS        MAX        MIN        DEV     OUTTOL
    M      0.00000    0.00500    0.00500    0.00693    0.00377   -0.00316    0.00693    0.00000 #-|-#
                ASSIGN/PRO_FEAT={GETTEXT("REFERENCE ID",0,GETCOMMAND(1105,"UP",1))}     <--------------Returns a pointer to "DSCN01".  Good!
                ASSIGN/T_VALUE=DOT(PRO_FEAT.HIT[1..PRO_FEAT.NUMHITS].XYZ-PRO_FEAT.HIT[1..PRO_FEAT.NUMHITS].TXYZ,PRO_FEAT.HIT[1..PRO_FEAT.NUMHITS].TIJK)   <----------Returns 0? No data
                ASSIGN/V1=PRO_FEAT.HIT[1].XYZ   <----------Tried to get XYZ of just one point. Also returns 0?  
                ASSIGN/V1=PRO_FEAT.HIT[1].X     <----------Tried to get X of just one point. Also returns 0?  
    ​            ASSIGN/V1=PRO_FEAT.XYZ          <----------Tried to get XYZ of centroid of scan, Returns "<8.4955, 21.8442, 1.6928>".  So at least that works.  
                ASSIGN/V1=PRO_FEAT.NUMHITS      <----------Tried to get number of hits, Returns "5904".  That is correct too.
    


    Any ideas what I am doing wrong?
  • Sometimes, using assignments with .HIT doesn't work, maybe it depends on version...
    I would use in this case something like :
    ASSIGN/V1=PRO_FEAT+"HIT[1.."+PRO_FEAT.NUMHITS+"]"
    Then use V1.XYZ, V1.IJK...
    Not sure it works, I really think it's depends on the version or a setting...
  • Sometimes, using assignments with .HIT doesn't work, maybe it depends on version...
    I would use in this case something like :
    ASSIGN/V1=PRO_FEAT+"HIT[1.."+PRO_FEAT.NUMHITS+"]"
    Then use V1.XYZ, V1.IJK...
    Not sure it works, I really think it's depends on the version or a setting...


    That's a cool idea. I'll give it a try.

    Even if I can't figure out how to use pointers to semi-automate this, I will still be able to do it manually. Thanks again for your solution.