hexagon logo

Find max, min dia for 'N' numbers of holes

we are using following code to find max and min dia among 93 holes inspected
can someone suggest any alternate way?
ASSIGN/COUNT=0
ASSIGN/NUM_OF_DIM=93
ASSIGN/MMPROF1=0
ASSIGN/MMPROF2=0
ASSIGN/MAX_DIM=0
ASSIGN/MIN_DIM=0
ASSIGN/MAX_PROF=0
ASSIGN/MIN_PROF=0
DO/
ASSIGN/COUNT=COUNT+1
ASSIGN/ID="LOC"+COUNT
ASSIGN/MMPROF1[COUNT]=ID.D.MEAS
ASSIGN/MMPROF2[COUNT]=MMPROF1[COUNT]
UNTIL/COUNT==NUM_OF_DIM
ASSIGN/MAX_DIM=MAXINDEX(MMPROF2)
ASSIGN/MIN_DIM=MININDEX(MMPROF2)
ASSIGN/MAX_PROF=MMPROF2[MAX_DIM]
ASSIGN/MIN_PROF=MMPROF2[MIN_DIM]
F1 =GENERIC/POINT,DEPENDENT,CARTESIAN,$
NOM/XYZ,<1,0,0>,$
MEAS/XYZ,<MAX_PROF,0,0>,$
NOM/IJK,<0,0,1>,$
MEAS/IJK,<0,0,1>
DIM LOC94= LOCATION OF POINT F1 UNITS=IN ,$
GRAPH=OFF TEXT=OFF MULT=10.00 OUTPUT=BOTH HALF ANGLE=NO
AX NOMINAL +TOL -TOL MEAS DEV OUTTOL
X 1.0000 0.0200 0.0200 1.0000 0.0000 0.0000 --#--
END OF DIMENSION LOC94
F2 =GENERIC/POINT,DEPENDENT,CARTESIAN,$
NOM/XYZ,<1,0,0>,$
MEAS/XYZ,<MIN_PROF,0,0>,$
NOM/IJK,<0,0,1>,$
MEAS/IJK,<0,0,1>
DIM LOC95= LOCATION OF POINT F2 UNITS=IN ,$
GRAPH=OFF TEXT=OFF MULT=10.00 OUTPUT=BOTH HALF ANGLE=NO
AX NOMINAL +TOL -TOL MEAS DEV OUTTOL
X 1.0000 0.0200 0.0200 1.0000 0.0000 0.0000 --#--
END OF DIMENSION LOC95
  • good day,


    looks good to me,


    (a script would be faster but thats it)


    what seams to be the problem with this ?
  • good day Slight smile
    i was just trying to simplify it, if possible
  • you can put it in a "group" and dont show it .. than you dont see the commands, it looks less complicated this way
    and copy and paste it in a new programm if needed
  • good day,

    if you are interested in a script for min max, then i have something for you.

    Highlights are it is much faster than the pcDMIS loop
    and you have less pcDMIS code


    1) See attachement
    (File must be renamed to *.bas to work)


    2) ARG1 = non-numeric part of the feature name
    ARG2 = String-Name of the pcDMIS variable for MAX
    ARG3 = String-Name of the pcDMIS variable for MIN

    3) note that it only works with auto circles, but can be rewritten for other elements

    4) note that it doesn't work with pcDMIS loops, but i can add that as well if interested

    5) the two variables (Max and Min) must be assigned somewhere before the script is called
    (with a random value)
    (the script then overwrites the value of the variable)


    here is an example of how the script is used in pcDMIS:
    
    $$ NO,
    MOVE/CLEARPLANE
    
    LOC_1 =FEAT/CONTACT/CIRCLE/DEFAULT,CARTESIAN,IN,LEAST_SQR
    THEO/<-2,42,17.5>,<1,0,0>,7
    ACTL/<-2,41.759,17.516>,<1,0,0>,7.019
    TARG/<-2,42,17.5>,<1,0,0>
    START ANG=0,END ANG=360
    ANGLE VEC=<0,0,-1>
    DIRECTION=CCW
    SHOW FEATURE PARAMETERS=NO
    SHOW CONTACT PARAMETERS=NO
    
    MOVE/CLEARPLANE
    
    LOC_2 =FEAT/CONTACT/CIRCLE/DEFAULT,CARTESIAN,IN,LEAST_SQR
    THEO/<-2,42,-17.5>,<1,0,0>,7
    ACTL/<-2,41.769,-17.487>,<1,0,0>,7.013
    TARG/<-2,42,-17.5>,<1,0,0>
    START ANG=0,END ANG=360
    ANGLE VEC=<0,0,-1>
    DIRECTION=CCW
    SHOW FEATURE PARAMETERS=NO
    SHOW CONTACT PARAMETERS=NO
    
    MOVE/CLEARPLANE
    
    LOC_3 =FEAT/CONTACT/CIRCLE/DEFAULT,CARTESIAN,IN,LEAST_SQR
    THEO/<-2,92,17.5>,<1,0,0>,7
    ACTL/<-2,91.772,17.516>,<1,0,0>,7.008
    TARG/<-2,92,17.5>,<1,0,0>
    START ANG=0,END ANG=360
    ANGLE VEC=<0,0,-1>
    DIRECTION=CCW
    SHOW FEATURE PARAMETERS=NO
    SHOW CONTACT PARAMETERS=NO
    
    MOVE/CLEARPLANE
    
    LOC_4 =FEAT/CONTACT/CIRCLE/DEFAULT,CARTESIAN,IN,LEAST_SQR
    THEO/<-2,92,-17.5>,<1,0,0>,7
    ACTL/<-2,91.77,-17.479>,<1,0,0>,7.013
    TARG/<-2,92,-17.5>,<1,0,0>
    START ANG=0,END ANG=360
    ANGLE VEC=<0,0,-1>
    DIRECTION=CCW
    SHOW FEATURE PARAMETERS=NO
    SHOW CONTACT PARAMETERS=NO
    
    MOVE/CLEARPLANE
    
    ASSIGN/VARMAX=0
    ASSIGN/VARMIN=0
    
    CS1 =SCRIPT/FILENAME= C:\USERS\QS\DESKTOP\DMISMAXMIN.BAS
    FUNCTION/Main,SHOW=NO,ARG1="LOC",ARG2="VARMAX",ARG3="VARMIN",,
    STARTSCRIPT/
    
    DMAX =GENERIC/CIRCLE,DEPENDENT,CARTESIAN,OUT,$
    NOM/XYZ,<0,0,0>,$
    MEAS/XYZ,<0,0,0>,$
    NOM/IJK,<0,0,1>,$
    MEAS/IJK,<0,0,1>,$
    DIAMETER/LOC_1.TD,VARMAX
    
    DMIN =GENERIC/CIRCLE,DEPENDENT,CARTESIAN,OUT,$
    NOM/XYZ,<0,0,0>,$
    MEAS/XYZ,<0,0,0>,$
    NOM/IJK,<0,0,1>,$
    MEAS/IJK,<0,0,1>,$
    DIAMETER/LOC_1.TD,VARMIN
    
    DIM LAGE1= LOCATION OF CIRCLE DMAX UNITS=MM ,$
    GRAPH=OFF TEXT=OFF MULT=10.00 OUTPUT=BOTH HALF ANGLE=NO
    AX NOMINAL MEAS +TOL -TOL DEV OUTTOL
    D 7.000 7.019 0.100 -0.100 0.019 0.000
    END OF DIMENSION LAGE1
    
    DIM LAGE2= LOCATION OF CIRCLE DMIN UNITS=MM ,$
    GRAPH=OFF TEXT=OFF MULT=10.00 OUTPUT=BOTH HALF ANGLE=NO
    AX NOMINAL MEAS +TOL -TOL DEV OUTTOL
    D 7.000 7.008 0.100 -0.100 0.008 0.000
    END OF DIMENSION LAGE2
    
    
  • This was something new Slight smile
    Thanks for sharing, will try it...
  • Hello,

    the script now also processes
    (Auto - Constructed - measured)

    circles,
    cylinders,
    spheres,
    cones (angles),
    slots (width),
    square slots (width)
    round slots (length),
    torus (primary Ø),
    ellipse (first Ø)
    generic construction (dia or radi)


    Notes:
    File must be renamed to *.bas to work
    it doesn't work with features within a pcDMIS loop (it only processes the first index)
  • Hello,

    the script now also processes
    (Auto - Constructed - measured)

    circles,
    cylinders,
    spheres,
    cones (angles),
    slots (width),
    square slots (width)
    round slots (length),
    torus (primary Ø),
    ellipse (first Ø)
    generic construction (dia or radi)


    Notes:
    File must be renamed to *.bas to work
    it doesn't work with features within a pcDMIS loop (it only processes the first index)


    Thanks @
  • good day,

    i updated the script for pcDMIS loops aswell:

    Notes:
    File must be renamed to *.bas to work


    here is an example of how the script is used if a loop is present in pcDMIS:
    [...]
    
    V1 =LOOP/START,ID=YES,NUMBER=3,START=1,SKIP=,
    OFFSET:XAXIS=0,YAXIS=0,ZAXIS=0,ANGLE=45
    
        ZYL1 =FEAT/CONTACT/CYLINDER/DEFAULT,CARTESIAN,IN,LEAST_SQR
        THEO/<-354.3,0.5,0>,<-1,0,0>,33,186.96
        ACTL/<-354.3,0.5,0>,<-1,0,0>,33,186.96
        TARG/<-354.3,0.5,0>,<-1,0,0>
        START ANG=0,END ANG=360
        ANGLE VEC=<0,0,1>
        DIRECTION=CCW
        SHOW FEATURE PARAMETERS=NO
        SHOW CONTACT PARAMETERS=NO
    
    LOOP/END
    
    ASSIGN/VMAX=0
    ASSIGN/VMIN=0
    
    CS1 =SCRIPT/FILENAME= C:\USERS\QS\DESKTOP\DMISMAXMIN.BAS
    FUNCTION/Main,SHOW=YES,ARG1="ZYL",ARG2="VMAX",ARG3="VMIN",,
    STARTSCRIPT/
    ENDSCRIPT/
    
    DMAX =GENERIC/CIRCLE,DEPENDENT,CARTESIAN,IN,$
    NOM/XYZ,<0,0,0>,$
    MEAS/XYZ,<0,0,0>,$
    NOM/IJK,<0,0,1>,$
    MEAS/IJK,<0,0,1>,$
    DIAMETER/ZYL1.TD,VMAX
    
    DMIN =GENERIC/CIRCLE,DEPENDENT,CARTESIAN,IN,$
    NOM/XYZ,<0,0,0>,$
    MEAS/XYZ,<0,0,0>,$
    NOM/IJK,<0,0,1>,$
    MEAS/IJK,<0,0,1>,$
    DIAMETER/ZYL1.TD,VMIN
    
    DIM LOC1= LOCATION OF CIRCLE DMAX UNITS=MM ,$
    GRAPH=OFF TEXT=OFF MULT=100.00 OUTPUT=BOTH HALF ANGLE=NO
    AX NOMINAL +TOL -TOL MEAS DEV OUTTOL
    X 0.000 0.010 -0.010 0.000 0.000 0.000 ----#----
    Y 0.000 0.010 -0.010 0.000 0.000 0.000 ----#----
    D 33.000 0.010 -0.010 33.000 0.000 0.000 ----#----
    END OF DIMENSION LOC1
    
    DIM LOC2= LOCATION OF CIRCLE DMIN UNITS=MM ,$
    GRAPH=OFF TEXT=OFF MULT=100.00 OUTPUT=BOTH HALF ANGLE=NO
    AX NOMINAL +TOL -TOL MEAS DEV OUTTOL
    X 0.000 0.010 -0.010 0.000 0.000 0.000 ----#----
    Y 0.000 0.010 -0.010 0.000 0.000 0.000 ----#----
    D 33.000 0.010 -0.010 33.000 0.000 0.000 ----#----
    END OF DIMENSION LOC2
    
    [...]
    
  • I don't use a lot of scripts, even if it looks nice ! ( : maybe I'm not really a robot ?)
    I believe you can simplify the code without crating generic points (or circles !), just using existing circles...
    V1 =LOOP/START,ID=YES,NUMBER=93,START=1,SKIP=,
    OFFSET:XAXIS=0,YAXIS=0,ZAXIS=0,ANGLE=0
    ASSIGN/V2="CIR"+V1
    ASSIGN/V3[V1]=V2.D
    LOOP/END
    ASSIGN/V4="CIR"+MAXINDEX(V3)
    ASSIGN/V5="CIR"+MININDEX(V3)
    DIM LOC94= LOCATION OF CIRCLE V4 UNITS=IN ,$
    GRAPH=OFF TEXT=OFF MULT=10.00 OUTPUT=BOTH HALF ANGLE=NO
    AX NOMINAL +TOL -TOL MEAS DEV OUTTOL
    D 1.0000 0.0200 0.0200 1.0000 0.0000 0.0000 --#--
    END OF DIMENSION LOC94
    DIM LOC95= LOCATION OF CIRCLE V5 UNITS=IN ,$
    GRAPH=OFF TEXT=OFF MULT=10.00 OUTPUT=BOTH HALF ANGLE=NO
    AX NOMINAL +TOL -TOL MEAS DEV OUTTOL
    D 1.0000 0.0200 0.0200 1.0000 0.0000 0.0000 --#--
    END OF DIMENSION LOC94
  • I don't use a lot of scripts, even if it looks nice ! ( : maybe I'm not really a robot ?)
    I believe you can simplify the code without crating generic points (or circles !), just using existing circles...
    V1 =LOOP/START,ID=YES,NUMBER=93,START=1,SKIP=,
    OFFSET:XAXIS=0,YAXIS=0,ZAXIS=0,ANGLE=0
    ASSIGN/V2="CIR"+V1
    ASSIGN/V3[V1]=V2.D
    LOOP/END
    ASSIGN/V4="CIR"+MAXINDEX(V3)
    ASSIGN/V5="CIR"+MININDEX(V3)
    DIM LOC94= LOCATION OF CIRCLE V4 UNITS=IN ,$
    GRAPH=OFF TEXT=OFF MULT=10.00 OUTPUT=BOTH HALF ANGLE=NO
    AX NOMINAL +TOL -TOL MEAS DEV OUTTOL
    D 1.0000 0.0200 0.0200 1.0000 0.0000 0.0000 --#--
    END OF DIMENSION LOC94
    DIM LOC95= LOCATION OF CIRCLE V5 UNITS=IN ,$
    GRAPH=OFF TEXT=OFF MULT=10.00 OUTPUT=BOTH HALF ANGLE=NO
    AX NOMINAL +TOL -TOL MEAS DEV OUTTOL
    D 1.0000 0.0200 0.0200 1.0000 0.0000 0.0000 --#--
    END OF DIMENSION LOC94


    Thanks for sharing the code it will work like a charm.
    can we use this method to fine the 2nd max value ?