Max and min index from looped points

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

  • Max and min index from looped points

    Hey, guys.

    The code at the bottom shows 4 looped points in a WHILE loop. I'm looking to get the max and min index z values and put that value into a generic feature. I will then dimension the 2D distance to a plane.

    I can't figure out the syntax to get the values I'm looking for.

    I've tried this:

    Code:
    ASSIGN/VMAXDPNTARRAY=ARRAY(DAT_D_OUTER_PNT[1..16].Z,DAT_D_MID_PNT[1..16].Z,DAT_D_INNER_PNT[1..16].Z,DAT_D_FWDBLT_PNT[1..16].Z)
    ...to get the hits into 1 array to use the MAXINDEX commands but no joy.

    Any suggestions?...

    Code:
    WHILE/VDATDROT<360
                RECALL/ALIGNMENT,EXTERNAL,ABC_ALIGN
    DAT_D_ROTATION_ALN=ALIGNMENT/START,RECALL:ABC_ALIGN,LIST=YES
                ALIGNMENT/ROTATE_OFFSET,VDATDROT,ABOUT,ZPLUS
                ALIGNMENT/END
    DAT_D_OUTER_PNT=FEAT/CONTACT/VECTOR POINT/DEFAULT,POLAR
                THEO/<VDATDOUTRAD,V270,VFWDFLGHT>,<V0,V0,VPOS1>
                ACTL/<55.425,270,45.6>,<0,0,1>
                TARG/<VDATDOUTRAD,V270,VFWDFLGHT>,<V0,V0,VPOS1>
                SNAP=NO
                SHOW FEATURE PARAMETERS=NO
                SHOW CONTACT PARAMETERS=YES
                  AVOIDANCE MOVE=BOTH,DISTANCE=VAMMED
                SHOW HITS=NO
                ASSIGN/VFR000A="DATUM_D_OUTER_PNT"+X
                ASSIGN/VFR000B=DAT_D_OUTER_PNT.PR.NOM
                ASSIGN/VFR000C=DAT_D_OUTER_PNT.PA.NOM
                ASSIGN/VFR000D=DAT_D_OUTER_PNT.PH.NOM
                ASSIGN/VFR000E=DAT_D_OUTER_PNT.I.NOM
                ASSIGN/VFR000F=DAT_D_OUTER_PNT.J.NOM
                ASSIGN/VFR000G=DAT_D_OUTER_PNT.K.NOM
                ASSIGN/VFR000H=DAT_D_OUTER_PNT.PR
                ASSIGN/VFR000I=DAT_D_OUTER_PNT.PA
                ASSIGN/VFR000J=DAT_D_OUTER_PNT.PH
                ASSIGN/VFR000K=DAT_D_OUTER_PNT.I
                ASSIGN/VFR000L=DAT_D_OUTER_PNT.J
                ASSIGN/VFR000M=DAT_D_OUTER_PNT.K
                ASSIGN/VFR000N=""
                ASSIGN/VFR000P=""
                ASSIGN/VFRCLMWRITE=VFFR000A+","+VFFR000B+","+VFFR000C+","+VFFR000D+","+VFFR000E+","+VFFR000F+","+VFFR000G+","+VFFR000H+","+VFFR000G+","+VFFR000H+","+VFFR000I+","+VFFR000J+","+VFFR000K+","+VFFR000L+","+VFFR000M+","+VFFR000N
                FILE/WRITELINE,FPTR_FRCSV,VFRCLMWRITE
    DAT_D_MID_PNT=FEAT/CONTACT/VECTOR POINT/DEFAULT,POLAR
                THEO/<VDATDMIDRAD,V270,VFWDFLGHT>,<V0,V0,VPOS1>
                ACTL/<54.6,270,45.6>,<0,0,1>
                TARG/<VDATDMIDRAD,V270,VFWDFLGHT>,<V0,V0,VPOS1>
                SNAP=NO
                SHOW FEATURE PARAMETERS=NO
                SHOW CONTACT PARAMETERS=YES
                  AVOIDANCE MOVE=NO,DISTANCE=0.25
                SHOW HITS=NO
                ASSIGN/VFR000A="DATUM_D_MID_PNT"+X
                ASSIGN/VFR000B=DAT_D_MID_PNT.PR.NOM
                ASSIGN/VFR000C=DAT_D_MID_PNT.PA.NOM
                ASSIGN/VFR000D=DAT_D_MID_PNT.PH.NOM
                ASSIGN/VFR000E=DAT_D_MID_PNT.I.NOM
                ASSIGN/VFR000F=DAT_D_MID_PNT.J.NOM
                ASSIGN/VFR000G=DAT_D_MID_PNT.K.NOM
                ASSIGN/VFR000H=DAT_D_MID_PNT.PR
                ASSIGN/VFR000I=DAT_D_MID_PNT.PA
                ASSIGN/VFR000J=DAT_D_MID_PNT.PH
                ASSIGN/VFR000K=DAT_D_MID_PNT.I
                ASSIGN/VFR000L=DAT_D_MID_PNT.J
                ASSIGN/VFR000M=DAT_D_MID_PNT.K
                ASSIGN/VFR000N=""
                ASSIGN/VFR000P=""
                ASSIGN/VFRCLMWRITE=VFFR000A+","+VFFR000B+","+VFFR000C+","+VFFR000D+","+VFFR000E+","+VFFR000F+","+VFFR000G+","+VFFR000H+","+VFFR000G+","+VFFR000H+","+VFFR000I+","+VFFR000J+","+VFFR000K+","+VFFR000L+","+VFFR000M+","+VFFR000N
                FILE/WRITELINE,FPTR_FRCSV,VFRCLMWRITE
    DAT_D_INNER_PNT=FEAT/CONTACT/VECTOR POINT/DEFAULT,POLAR
                THEO/<VDATDINRAD,V270,VFWDFLGHT>,<V0,V0,VPOS1>
                ACTL/<54.25,270,45.6>,<0,0,1>
                TARG/<VDATDINRAD,V270,VFWDFLGHT>,<V0,V0,VPOS1>
                SNAP=NO
                SHOW FEATURE PARAMETERS=NO
                SHOW CONTACT PARAMETERS=YES
                  AVOIDANCE MOVE=NO,DISTANCE=0.25
                SHOW HITS=NO
                ASSIGN/VFR000A="DATUM_D_INNER"+X
                ASSIGN/VFR000B=DAT_D_INNER_PNT.PR.NOM
                ASSIGN/VFR000C=DAT_D_INNER_PNT.PA.NOM
                ASSIGN/VFR000D=DAT_D_INNER_PNT.PH.NOM
                ASSIGN/VFR000E=DAT_D_INNER_PNT.I.NOM
                ASSIGN/VFR000F=DAT_D_INNER_PNT.J.NOM
                ASSIGN/VFR000G=DAT_D_INNER_PNT.K.NOM
                ASSIGN/VFR000H=DAT_D_INNER_PNT.PR
                ASSIGN/VFR000I=DAT_D_INNER_PNT.PA
                ASSIGN/VFR000J=DAT_D_INNER_PNT.PH
                ASSIGN/VFR000K=DAT_D_INNER_PNT.I
                ASSIGN/VFR000L=DAT_D_INNER_PNT.J
                ASSIGN/VFR000M=DAT_D_INNER_PNT.K
                ASSIGN/VFR000N=""
                ASSIGN/VFR000P=""
                ASSIGN/VFRCLMWRITE=VFFR000A+","+VFFR000B+","+VFFR000C+","+VFFR000D+","+VFFR000E+","+VFFR000F+","+VFFR000G+","+VFFR000H+","+VFFR000G+","+VFFR000H+","+VFFR000I+","+VFFR000J+","+VFFR000K+","+VFFR000L+","+VFFR000M+","+VFFR000N
                FILE/WRITELINE,FPTR_FRCSV,VFRCLMWRITE
    VREAD      =FILE/READLINE,FPTR_DPNT,{VDBLTCIRROT}
                RECALL/ALIGNMENT,EXTERNAL,ABC_POLAR_ALIGN
    BLT_CIR_HIT_ROT=ALIGNMENT/START,RECALL:ABC_ALIGN,LIST=YES
                ALIGNMENT/ROTATE_OFFSET,VDBLTCIRROT,ABOUT,ZPLUS
                ALIGNMENT/END
    DAT_D_FWDBLT_PNT=FEAT/CONTACT/VECTOR POINT/DEFAULT,POLAR
                THEO/<VFWDBLTRAD,V270,VFWDFLGHT>,<V0,V0,VPOS1>
                ACTL/<55,270,45.6>,<0,0,1>
                TARG/<VFWDBLTRAD,V270,VFWDFLGHT>,<V0,V0,VPOS1>
                SNAP=NO
                SHOW FEATURE PARAMETERS=NO
                SHOW CONTACT PARAMETERS=YES
                  AVOIDANCE MOVE=AFTER,DISTANCE=VAMMED
                SHOW HITS=NO
                ASSIGN/VFR000A="DATUM_D_FWDBLT"+X
                ASSIGN/VFR000B=DAT_D_FWDBLT_PNT.X.NOM
                ASSIGN/VFR000C=DAT_D_FWDBLT_PNT.Y.NOM
                ASSIGN/VFR000D=DAT_D_FWDBLT_PNT.Z.NOM
                ASSIGN/VFR000E=DAT_D_FWDBLT_PNT.I.NOM
                ASSIGN/VFR000F=DAT_D_FWDBLT_PNT.J.NOM
                ASSIGN/VFR000G=DAT_D_FWDBLT_PNT.K.NOM
                ASSIGN/VFR000H=DAT_D_FWDBLT_PNT.X
                ASSIGN/VFR000I=DAT_D_FWDBLT_PNT.Y
                ASSIGN/VFR000J=DAT_D_FWDBLT_PNT.Z
                ASSIGN/VFR000K=DAT_D_FWDBLT_PNT.I
                ASSIGN/VFR000L=DAT_D_FWDBLT_PNT.J
                ASSIGN/VFR000M=DAT_D_FWDBLT_PNT.K
                ASSIGN/VFR000N=""
                ASSIGN/VFR000P=""
                ASSIGN/VFRCLMWRITE=VFFR000A+","+VFFR000B+","+VFFR000C+","+VFFR000D+","+VFFR000E+","+VFFR000F+","+VFFR000G+","+VFFR000H+","+VFFR000G+","+VFFR000H+","+VFFR000I+","+VFFR000J+","+VFFR000K+","+VFFR000L+","+VFFR000M+","+VFFR000N
                FILE/WRITELINE,FPTR_FRCSV,VFRCLMWRITE
                ASSIGN/VDATDROT=VDATDROT + 22.5
                ASSIGN/X=X+1
    L_DATDEND  =LABEL/
                END_WHILE/
    Negative, Ghostrider...the pattern is full...

  • #2
    Originally posted by Rookie View Post

    I've tried this:
    Code:
    ASSIGN/VMAXDPNTARRAY=ARRAY(DAT_D_OUTER_PNT[1..16].Z,DAT_D_MID_PNT[1..16].Z,DAT_D_INNER_PNT[1..16].Z,DAT_D_FWDBLT_PNT[1..16].Z)
    This assignment is going to give you an array of arrays (2 dimensional array) - so the MAXINDEX(VMAXDPNTARRAY) isn't going to work as you are expecting.

    You could try something like this get the min/max Z values (vb-style pseudocode):
    Code:
    VMAX = -99999999
    VMIN = 9999999
    For I=1 to 4
      For J=1 to 16
        if VMAXDPNTARRAY[I,J] > VMAX then
           VMAX=VMAXDPNTARRAY[I,J]
        end if
        if VMAXDPNTARRAY[I,J] < VMIN then
           VMIN=VMAXDPNTARRAY[I,J]
        end if
      Next J
    Next I
    ^This is just to show the method of referencing the array elements - it will have to be converted to a looping style supported by pc-dmis.

    Comment


    • #3
      Maybe you could create a feature set with (DAT_D_OUTER_PNT[1..16],DAT_D_MID_PNT[1..16],DAT_D_INNER_PNT[1..16],DAT_D_FWDBLT_PNT[1..16]), and then looking for z max ?
      I would change the name of X (X=X+1) by XX for example, because PC-DMIS should confuse the variable with a x value of anything !!!!!

      Comment


      • #4
        Originally posted by DJAMS View Post
        This assignment is going to give you an array of arrays (2 dimensional array) - so the MAXINDEX(VMAXDPNTARRAY) isn't going to work as you are expecting.
        That's what I was thinking. This is my first time playing with arrays and loops.


        Originally posted by DJAMS View Post
        You could try something like this get the min/max Z values (vb-style pseudocode):
        Code:
        VMAX = -99999999
        VMIN = 9999999
        For I=1 to 4
          For J=1 to 16
            if VMAXDPNTARRAY[I,J] > VMAX then
               VMAX=VMAXDPNTARRAY[I,J]
            end if
            if VMAXDPNTARRAY[I,J] < VMIN then
               VMIN=VMAXDPNTARRAY[I,J]
            end if
          Next J
        Next I
        ^This is just to show the method of referencing the array elements - it will have to be converted to a looping style supported by pc-dmis.
        So I will have to reference the array as a 2 dimensional, correct?
        Negative, Ghostrider...the pattern is full...

        Comment


        • #5
          Originally posted by JEFMAN View Post
          Maybe you could create a feature set with (DAT_D_OUTER_PNT[1..16],DAT_D_MID_PNT[1..16],DAT_D_INNER_PNT[1..16],DAT_D_FWDBLT_PNT[1..16]), and then looking for z max ?
          I would change the name of X (X=X+1) by XX for example, because PC-DMIS should confuse the variable with a x value of anything !!!!!
          Tried that one too, Jef. Couldn't get it to work either. Thanks for the suggestion.
          Negative, Ghostrider...the pattern is full...

          Comment


          • #6
            Originally posted by JEFMAN View Post
            Maybe you could create a feature set with (DAT_D_OUTER_PNT[1..16],DAT_D_MID_PNT[1..16],DAT_D_INNER_PNT[1..16],DAT_D_FWDBLT_PNT[1..16]), and then looking for z max ?
            This should work, and is I simpler solution to the problem.


            Sent from my SPH-L710 using Tapatalk

            Comment


            • #7
              Do you obtain an array if you just assign V1=DAT_D_OUTER_PNT[1..16].Z ? It could help us to understand why it doesn't work ?

              Comment


              • #8
                Code:
                DATUM_D_SET=FEAT/SET,CARTESIAN
                            THEO/<V0,V0,VFWDFLGHT>,<V0,V0,VPOS1>
                            ACTL/<0.0047,0.007,0>,<0,0,1>
                            CONSTR/SET,BASIC,DAT_D_OUTER_PNT[1..16],DAT_D_MID_PNT[1..16],DAT_D_INNER_PNT[1..16],DAT_D_FWDBLT_PNT[1..16],,
                            ASSIGN/VMAXDPNT=MAXINDEX(DATUM_D_SET.HIT[1..64].Z)
                Well, crap. It worked that time. I tried this yesterday and it did not.

                It returns a value of 9. The z value should be 45.6.

                Is it returning the 9th hit in the array?

                EDIT: I need the max and min z value returned, not just the instance.
                Last edited by Rookie; 08-28-2014, 11:09 AM.
                Negative, Ghostrider...the pattern is full...

                Comment


                • #9
                  The 9th array index

                  Edit: MAX () or MIN () functions will return the value instead of the index.
                  Last edited by DJAMS; 08-28-2014, 11:12 AM.

                  Comment


                  • #10
                    Originally posted by DJAMS View Post
                    The 9th array index

                    Edit: MAX () or MIN () functions will return the value instead of the index.
                    That did it!

                    Thanks for the help guys.
                    Negative, Ghostrider...the pattern is full...

                    Comment


                    • #11
                      MAXINDEX will give the number of the point which has the max value. If you want to use it to calculate the distance along z between min and max, you can ASSIGN/V1=MAXINDEX(DATUM_D_SET.HIT[1..64].Z), ASSIGN/V2=MININDEX(DATUM_D_SET.HIT[1..64].Z), then ASSIGN/DIST=DATUM_D_SET.HIT[V1].Z-DATUM_D_SET.HIT[V2].Z...
                      The best way in this case is to use directly MAX and MIN function, like DJAMS said !!!!!!

                      Comment


                      • #12
                        I would rep both of you guys, but the site won't let me. Thanks for the help. It is always much appreciated.
                        Negative, Ghostrider...the pattern is full...

                        Comment

                        Related Topics

                        Collapse

                        Working...
                        X