Code to Output Min/Max Values

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Code to Output Min/Max Values

    Hello Everybody,

    We use checksheets at my place of employment, and often these checksheets have dimensions which apply to many features - say, the diameter of many holes (the same size) on a housing. We are supposed to enter the minimum and maximum value for these dimensions on the checksheet. However, sometimes there are quite a few features, and it becomes impractical to search through the report manually for the high and low values. Can anybody suggest a strategy or copy/paste some code which might help me output the minimum and maximum size of a set of holes? Or the min/max of a set of distances? I've found ways to do this in the past but they felt clumsy, slow, and awkward, and I feel certain there is a better way. Any help would be greatly appreciated.

    Thanks,
    Adam

  • #2
    I hate to reply to my own post, but for the sake of others who might be looking for a way to do the same thing, I thought I would post what I came up with:
    Code:
    DIM ANGL1= 2D ANGLE (TRUE) FROM LINE ANGLE LINE41 TO   YAXIS ,$
    GRAPH=OFF  TEXT=OFF  MULT=10.00  OUTPUT=NONE
    AX    MEAS      NOMINAL     +TOL       -TOL        DEV      OUTTOL   
    A    -50.2345   -50.0000     0.0000     0.0000    -0.2345     0.2345 <
    DIM ANGL2= 2D ANGLE (TRUE) FROM LINE ANGLE LINE42 TO   YAXIS ,$
    GRAPH=OFF  TEXT=OFF  MULT=10.00  OUTPUT=NONE
    AX    MEAS      NOMINAL     +TOL       -TOL        DEV      OUTTOL   
    A    -50.2123   -50.0000     0.0000     0.0000    -0.2123     0.2123 <
    DIM ANGL3= 2D ANGLE (TRUE) FROM LINE ANGLE LINE43 TO   YAXIS ,$
    GRAPH=OFF  TEXT=OFF  MULT=10.00  OUTPUT=NONE
    AX    MEAS      NOMINAL     +TOL       -TOL        DEV      OUTTOL   
    A    -50.1574   -50.0000     0.0000     0.0000    -0.1574     0.1574 <
    DIM ANGL4= 2D ANGLE (TRUE) FROM LINE ANGLE LINE44 TO   YAXIS ,$
    GRAPH=OFF  TEXT=OFF  MULT=10.00  OUTPUT=NONE
    AX    MEAS      NOMINAL     +TOL       -TOL        DEV      OUTTOL   
    A    -50.1039   -50.0000     0.0000     0.0000    -0.1039     0.1039 <
    DIM ANGL5= 2D ANGLE (TRUE) FROM LINE ANGLE LINE45 TO   YAXIS ,$
    GRAPH=OFF  TEXT=OFF  MULT=10.00  OUTPUT=NONE
    AX    MEAS      NOMINAL     +TOL       -TOL        DEV      OUTTOL   
    A    -50.0470   -50.0000     0.0000     0.0000    -0.0470     0.0470 <
    DIM ANGL6= 2D ANGLE (TRUE) FROM LINE ANGLE LINE46 TO   YAXIS ,$
    GRAPH=OFF  TEXT=OFF  MULT=10.00  OUTPUT=NONE
    AX    MEAS      NOMINAL     +TOL       -TOL        DEV      OUTTOL   
    A    -49.9230   -50.0000     0.0000     0.0000     0.0770     0.0770 >
                ASSIGN/ARRAY1 = ARRAY(ANGL1.MEAS, ANGL2.MEAS, ANGL3.MEAS, ANGL4.MEAS, ANGL5.MEAS, ANGL6.MEAS)
                ASSIGN/MAX1 = -MIN(ARRAY1)
                ASSIGN/MIN1 = -MAX(ARRAY1)
    GEN_MAX1   =GENERIC/NONE,DEPENDENT,RECT,OUT,$
                NOM/XYZ,-13.8497,-11.9294,12.3014,$
                MEAS/XYZ,-13.8497,-11.9294,12.3014,$
                NOM/IJK,0,0.0005,1,$
                MEAS/IJK,0,0.0005,1,$
                RADIUS/0,0,$
                ANGLE/50,MAX1,$
                DISTANCE/0,0
    GEN_MIN1   =GENERIC/NONE,DEPENDENT,RECT,OUT,$
                NOM/XYZ,-13.8497,-11.9294,12.3014,$
                MEAS/XYZ,-13.8497,-11.9294,12.3014,$
                NOM/IJK,0,0.0005,1,$
                MEAS/IJK,0,0.0005,1,$
                RADIUS/0,0,$
                ANGLE/50,MIN1,$
                DISTANCE/0,0
    DIM LOC165= LOCATION OF PLANE GEN_MAX1  UNITS=IN ,$
    GRAPH=OFF  TEXT=OFF  MULT=10.00  OUTPUT=BOTH
    AX    MEAS      NOMINAL     +TOL       -TOL        DEV      OUTTOL   
    A     50.2345    50.0000     0.0000     0.0000     0.2345     0.2345 >
    END OF DIMENSION LOC165
    DIM LOC166= LOCATION OF PLANE GEN_MIN1  UNITS=IN ,$
    GRAPH=OFF  TEXT=OFF  MULT=10.00  OUTPUT=BOTH
    AX    MEAS      NOMINAL     +TOL       -TOL        DEV      OUTTOL   
    A     49.9230    50.0000     0.0000     0.0000    -0.0770     0.0770 <
    END OF DIMENSION LOC166
    This seems to work well until you get enough elements in the array that it won't fit on one line (I'm running 3.7MR3, might not be a problem with later versions). I got around the problem with multiple arrays, as shown in the snippet below:
    Code:
    ...
    ...
    ...
    DIM LOC36= LOCATION OF CIRCLE 0.099 THRU52  UNITS=IN ,$
    GRAPH=OFF  TEXT=OFF  MULT=10.00  OUTPUT=NONE
    AX    MEAS      NOMINAL     +TOL       -TOL        DEV      OUTTOL   
    D      0.0991     0.0990     0.0050     0.0050     0.0001     0.0000 #
    END OF DIMENSION LOC36
    DIM LOC37= LOCATION OF CIRCLE 0.099 THRU53  UNITS=IN ,$
    GRAPH=OFF  TEXT=OFF  MULT=10.00  OUTPUT=NONE
    AX    MEAS      NOMINAL     +TOL       -TOL        DEV      OUTTOL   
    D      0.0981     0.0990     0.0050     0.0050    -0.0009     0.0000 #
    END OF DIMENSION LOC37
    DIM LOC38= LOCATION OF CIRCLE 0.099 THRU54  UNITS=IN ,$
    GRAPH=OFF  TEXT=OFF  MULT=10.00  OUTPUT=NONE
    AX    MEAS      NOMINAL     +TOL       -TOL        DEV      OUTTOL   
    D      0.0998     0.0990     0.0050     0.0050     0.0008     0.0000 #
    END OF DIMENSION LOC38
                ASSIGN/ARRAY5_1A = MAX(ARRAY(LOC1.D.MEAS, LOC2.D.MEAS, LOC3.D.MEAS, LOC4.D.MEAS, LOC5.D.MEAS, LOC6.D.MEAS, LOC7.D.MEAS, LOC8.D.MEAS, LOC9.D.MEAS, LOC10.D.MEAS, LOC11.D.MEAS, LOC12.D.MEAS, LOC13.D.MEAS, LOC14.D.MEAS, LOC15.D.MEAS))
                ASSIGN/ARRAY5_1B = MIN(ARRAY(LOC1.D.MEAS, LOC2.D.MEAS, LOC3.D.MEAS, LOC4.D.MEAS, LOC5.D.MEAS, LOC6.D.MEAS, LOC7.D.MEAS, LOC8.D.MEAS, LOC9.D.MEAS, LOC10.D.MEAS, LOC11.D.MEAS, LOC12.D.MEAS, LOC13.D.MEAS, LOC14.D.MEAS, LOC15.D.MEAS))
                ASSIGN/ARRAY5_2A = MAX(ARRAY(LOC16.D.MEAS, LOC17.D.MEAS, LOC18.D.MEAS, LOC19.D.MEAS, LOC20.D.MEAS, LOC21.D.MEAS, LOC22.D.MEAS, LOC23.D.MEAS, LOC24.D.MEAS, LOC25.D.MEAS, LOC26.D.MEAS, LOC27.D.MEAS, LOC28.D.MEAS, LOC29.D.MEAS, LOC30.D.MEAS))
                ASSIGN/ARRAY5_2B = MIN(ARRAY(LOC16.D.MEAS, LOC17.D.MEAS, LOC18.D.MEAS, LOC19.D.MEAS, LOC20.D.MEAS, LOC21.D.MEAS, LOC22.D.MEAS, LOC23.D.MEAS, LOC24.D.MEAS, LOC25.D.MEAS, LOC26.D.MEAS, LOC27.D.MEAS, LOC28.D.MEAS, LOC29.D.MEAS, LOC30.D.MEAS))
                ASSIGN/ARRAY5_3A = MAX(ARRAY(LOC31.D.MEAS, LOC32.D.MEAS, LOC33.D.MEAS, LOC34.D.MEAS, LOC35.D.MEAS, LOC36.D.MEAS, LOC37.D.MEAS, LOC38.D.MEAS))
                ASSIGN/ARRAY5_3B = MIN(ARRAY(LOC31.D.MEAS, LOC32.D.MEAS, LOC33.D.MEAS, LOC34.D.MEAS, LOC35.D.MEAS, LOC36.D.MEAS, LOC37.D.MEAS, LOC38.D.MEAS))
                ASSIGN/ARRAY5 = ARRAY( ARRAY5_1A, ARRAY5_1B, ARRAY5_2A, ARRAY5_2B, ARRAY5_3A, ARRAY5_3B)
                ASSIGN/MAX5 = MAX(ARRAY5)
                ASSIGN/MIN5 = MIN(ARRAY5)
    GEN_MAX5   =GENERIC/NONE,DEPENDENT,RECT,OUT,$
                NOM/XYZ,0.2361,-18.2776,12.3014,$
                MEAS/XYZ,0.2361,-18.2776,12.3014,$
                NOM/IJK,-0.0004,0.0003,1,$
                MEAS/IJK,-0.0004,0.0003,1,$
                DIAMETER/0.099,MAX5,$
                ANGLE/0.0998,0,$
                DISTANCE/0,0
    GEN_MIN5   =GENERIC/NONE,DEPENDENT,RECT,OUT,$
                NOM/XYZ,-13.8497,-11.9294,12.3014,$
                MEAS/XYZ,0.236,-18.2776,12.3014,$
                NOM/IJK,0,0.0005,1,$
                MEAS/IJK,-0.0004,0.0003,1,$
                DIAMETER/0.099,MIN5,$
                ANGLE/0.0961,0,$
                DISTANCE/0,0
    DIM LOC173= LOCATION OF PLANE GEN_MAX5  UNITS=IN ,$
    GRAPH=OFF  TEXT=OFF  MULT=10.00  OUTPUT=BOTH
    AX    MEAS      NOMINAL     +TOL       -TOL        DEV      OUTTOL   
    D      0.0998     0.0990     0.0050     0.0050     0.0008     0.0000 #
    END OF DIMENSION LOC173
    DIM LOC174= LOCATION OF PLANE GEN_MIN5  UNITS=IN ,$
    GRAPH=OFF  TEXT=OFF  MULT=10.00  OUTPUT=BOTH
    AX    MEAS      NOMINAL     +TOL       -TOL        DEV      OUTTOL   
    D      0.0961     0.0990     0.0050     0.0050    -0.0029     0.0000 #
    END OF DIMENSION LOC174
    I hope that's useful!

    Comment


    • #3
      A schoolbook example!
      PC-DMIS CAD++ 2o22.2 SP1

      Comment


      • #4
        Matt will tell you but I'm going to beat him to it. Never, ever use anything in a feature or tolerance label but numbers, letters and the underscore. Too many issues can arise when the DEMON has the possibility of seeing the decimal point (in your situation) as part of a math equation.

        IMHO, for the min/max diameter you could cut the array code in half by using the actual feature label and ".DIA" instead of tolerancing and using the dimension labels...... just sayin'
        Xcel & MicroVal Pfx & Global 37mr4 thru 2012mr1sp3
        Contura Calypso 5.4

        Lord, keep Your arm around my shoulder and Your hand over my mouth. Amen.

        Comment


        • #5
          Originally posted by dwade View Post
          Matt will tell you but I'm going to beat him to it. Never, ever use anything in a feature or tolerance label but numbers, letters and the underscore. Too many issues can arise when the DEMON has the possibility of seeing the decimal point (in your situation) as part of a math equation.

          IMHO, for the min/max diameter you could cut the array code in half by using the actual feature label and ".DIA" instead of tolerancing and using the dimension labels...... just sayin'
          Never ever use anything but...
          Oh, dang, dwade BEAT ME to it......

          Yeah, numbers, letters and the underscore, nothing else.
          sigpic
          Originally posted by AndersI
          I've got one from September 2006 (bug ticket) which has finally been fixed in 2013.

          Comment


          • #6
            Originally posted by Matthew D. Hoedeman View Post
            Never ever use anything but...
            Oh, dang, dwade BEAT ME to it......

            Yeah, numbers, letters and the underscore, nothing else.
            You're sleeping on us O Great Super Duper Ultra Guru of the Demon
            Xcel & MicroVal Pfx & Global 37mr4 thru 2012mr1sp3
            Contura Calypso 5.4

            Lord, keep Your arm around my shoulder and Your hand over my mouth. Amen.

            Comment


            • #7
              Originally posted by dwade View Post
              You're sleeping on us O Great Super Duper Ultra Guru of the Demon
              Hey, I start at 6:30, look at the time of my post....
              sigpic
              Originally posted by AndersI
              I've got one from September 2006 (bug ticket) which has finally been fixed in 2013.

              Comment


              • #8
                Just something I use in naming a feature.
                Instead of cir feature name 0.099

                try cir feature name CIR_9p099

                B&S CHAMELEON/PCDMIS CAD++ V2011

                There are no bugs, only "UNDOCUMENTED ENHANCEMENTS!"

                sigpic

                Comment

                Related Topics

                Collapse

                Working...
                X