hexagon logo

Code to mark/unmark out of tolerance dimensions

I am trying to figure out a way to automatically mark or unmark feature dimensions that are out of tolerance.
I have a program that includes some if/then statements where it re-measures a diameter at a different depth if the first one is OOT.
So my problem is that in the reporting portion of the program, I want the program to only reflect the in tolerance measurement and not the failed measurements.

I can post the code if it helps.
I am slightly familiar with using vb scripts.


  • Create 2 dimensions for the same feature. LOC1 and LOC1_OOT.
    change the output from REPORT to NONE or STATS on the first LOC1.
    then use a if/end if with a comment ( the comment being the second dimension LOC1_OOT) with output to REPORT.

    Now when you measure the feature, if its in tolerance, it will not be reported but it will send stats. If its OOT, it will display the second dimension on the report notifying the operator of the out of tolerance condition.

    Only shows if the out of tolerance is greater than zero.

    DIM LOC1= LOCATION OF CIRCLE [B][U]CIR1[/U][/B]  UNITS=MM ,$
    GRAPH=OFF  TEXT=OFF  MULT=10.00  OUTPUT=[U][B]STATS  [/B][/U]HALF ANGLE=NO
    AX    NOMINAL       +TOL       -TOL       MEAS        DEV     OUTTOL
    D       30.000      0.051      0.051     30.000      0.000      0.000 ----#----
    END OF DIMENSION LOC1
                IF/LOC1.D.OUTTOL>0
      DIM LOC1_OOT= LOCATION OF CIRCLE [U][B]CIR1[/B][/U]  UNITS=MM ,$
      GRAPH=OFF  TEXT=OFF  MULT=10.00  OUTPUT=[U][B]BOTH  [/B][/U]HALF ANGLE=NO
      AX    NOMINAL       +TOL       -TOL       MEAS        DEV     OUTTOL
      D       30.000      0.051      0.051     30.000      0.000      0.000 ----#----
      END OF DIMENSION LOC1_OOT
                END_IF/
    
  • I did this for a while until we decided that if they are not critical, don't check them as often or not at all. So all I check now are just critical dimensions. There was some comments on another thread about why remeasure the feature again. Would the second check be more accurate? If so, why not measure it like that from the beginning? Which kind of takes you back to square 1.
  • Yeah I'm gonna try that right now.

    In my post in the above comment, i tried to explain a little bit of my particular problem.

    My main thing is to have it all be in dcc and not manually controlled.

    I can go through a finished program myself and revise the report as I need; its just i wont be able to do that as much in the future with operators running my programs.
  • I tried this and it works fine for me so far.

    PROF1 =SURFACE PROFILE : CABLEFACE1
    FEATCTRLFRAME/SHOWPARAMS=YES,SHOWEXPANDED=YES
    CADGRAPH=OFF,REPORTGRAPH=OFF,TEXT=OFF,MULT=0.00,ARROWDENSITY=100,OUTPUT=STATS,UNITS=MM
    COMPOSITE=NO,
    CUSTOMIZED DRF=NO
    STANDARDTYPE=ASME_Y14_5
    PRIMARY DIMENSION/PROFILE OF SURFACE,1,<UZ>,<UTol>,A,B,C,<MC>
    NOTE/PROF1
    FEATURES/CABLEFACE1,,

    IF/PROF1.OUTTOL > 0
    GOTO/DIMREC
    END_IF/

    QCI1 =LABEL/

    QCI7 =SURFACE PROFILE : CABLEFACE1
    FEATCTRLFRAME/SHOWPARAMS=YES,SHOWEXPANDED=YES
    CADGRAPH=BOTH,REPORTGRAPH=OFF,TEXT=OFF,MULT=10.00,ARROWDENSITY=100,OUTPUT=BOTH,UNITS=MM
    COMPOSITE=NO,
    CUSTOMIZED DRF=NO
    STANDARDTYPE=ASME_Y14_5
    PRIMARY DIMENSION/PROFILE OF SURFACE,1,<UZ>,<UTol>,A,B,C
    NOTE/QCI7
    FEATURES/CABLEFACE1,,

    DIMREC =LABEL/

    IF/QCI7.OUTTOL < 1
    GOTO/QCIPASS
    END_IF/

    QCIPASS =LABEL/
  • I tried this and it works fine for me so far.
    PROF1 =SURFACE PROFILE : CABLEFACE1
    FEATCTRLFRAME/SHOWPARAMS=YES,SHOWEXPANDED=YES
    CADGRAPH=OFF,REPORTGRAPH=OFF,TEXT=OFF,[U][B][COLOR=#FF0000]MULT=0.00[/COLOR][/B][/U],ARROWDENSITY=100,OUTPUT=STATS,UNITS=MM
    COMPOSITE=NO,
    CUSTOMIZED DRF=NO
    STANDARDTYPE=ASME_Y14_5
    PRIMARY DIMENSION/PROFILE OF SURFACE,1,<UZ>,<UTol>,A,B,C,<MC>
    NOTE/PROF1
    FEATURES/CABLEFACE1,,
    
    IF/PROF1.OUTTOL > 0
    GOTO/DIMREC
    END_IF/
    
    QCI1 =LABEL/
    
    QCI7 =SURFACE PROFILE : CABLEFACE1
    FEATCTRLFRAME/SHOWPARAMS=YES,SHOWEXPANDED=YES
    CADGRAPH=BOTH,REPORTGRAPH=OFF,TEXT=OFF,[U][B][COLOR=#FF0000]MULT=10.00[/COLOR][/B][/U],ARROWDENSITY=100,OUTPUT=BOTH,UNITS=MM
    COMPOSITE=NO,
    CUSTOMIZED DRF=NO
    STANDARDTYPE=ASME_Y14_5
    PRIMARY DIMENSION/PROFILE OF SURFACE,1,<UZ>,<UTol>,A,B,C
    NOTE/QCI7
    FEATURES/CABLEFACE1,,
    
    DIMREC =LABEL/
    
    IF/QCI7.OUTTOL < 1
    GOTO/QCIPASS
    END_IF/
    
    QCIPASS =LABEL/


    this is kind of what I was talking about. I'm not familiar with profiles so i'm not sure what this MULT is but why measure it with 0.0 and if it fails, measure it again with MULT at 10.00? Why not start with 10.00 from the get go? Just trying to understand and learn.

    Also, when posting code, type [cod*e] on your first line, second line paste your code and last line [/cod*e] and it will appear much neater for others to read. Leave out the * in the words code.
  • If I understood you correctly:

    CIR5       =FEAT/CONTACT/CIRCLE/DEFAULT,CARTESIAN,IN,LEAST_SQR
                THEO/<4.8819,1.9685,0>,<0,0,1>,2.3819
                ACTL/<4.8819,1.9685,0>,<0,0,1>,2.3819
                TARG/<4.8819,1.9685,0>,<0,0,1>
                START ANG=0,END ANG=360
                ANGLE VEC=<1,0,0>
                DIRECTION=CW
                SHOW FEATURE PARAMETERS=NO
                SHOW CONTACT PARAMETERS=YES
                  NUMHITS=3,DEPTH=-0.14,PITCH=0
                  SAMPLE METHOD=SAMPLE_HITS
                  SAMPLE HITS=0,SPACER=0
                  AVOIDANCE MOVE=NO,DISTANCE=0.3937
                  FIND HOLE=NOCENTER,ONERROR=NO,READ POS=NO
                SHOW HITS=NO
                ASSIGN/[COLOR=#FF0000]IOFLAG1="BOTH"[/COLOR]
                IF/CIR5.D > 2.380 OR CIR5.D < 2.375
                  ASSIGN/[COLOR=#FF0000]IOFLAG1="NONE"[/COLOR]
                END_IF/
    DIM D1= LOCATION OF CIRCLE CIR5  UNITS=IN ,$
    GRAPH=OFF  TEXT=OFF  MULT=10.00  OUTPUT=[COLOR=#FF0000]IOFLAG1[/COLOR]  HALF ANGLE=NO
    AX    NOMINAL       +TOL       -TOL       MEAS        DEV     OUTTOL
    D       2.3875     0.0025     0.0025     2.3819    -0.0056     0.0031 <--------
    END OF DIMENSION D1
    
  • Question? How can you change the Output to Assign value?
    I figured it out "Space bar"
  • It's weird to 'write' in there. I tab into it and type carefully, any mistake and you'd have to start all over. It doesn't accept spaces or backspaces and stuff. Play around with it. Make sure you have an ASSIGNMENT ready with "BOTH", "REPORT", "NONE", etc. and don't just type anything in there.
  • Yeah thats exactly what I was trying to do, thanks for the help on this. Really liking the forum