Array question

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

  • Array question

    Hello!
    I am measuring 36 points in a circle and trying to find the point that have the largest polar value
    i can do this by using MAX and ARRAY in Expression builder
    But i want pc dmis to return me what point it is and all its data not only the polar radius value

    Example: 4 points in a circle measured
    point 3 at 45 degree angle has the max polar radius

    i want pcdmis to show me :
    Id point 3, polar radius 45.235, polar angel 45 degree


    I hope someone can help me
    sigpic
    4.2mr3 CAD++ "Mr buggy(er) as we call it"

  • #2
    Not sure but you may need to make an array of pointers to the features or TUTORELEMENTS. Then you might be able to querry the max index for the radius and get other pertinent data from that same index number.

    Not sure I've never done it before but it may be a start.
    <internet bumper sticker goes here>

    Comment


    • #3
      Try something like this:

      Code:
      ASSIGN/V1 = DATUMHSH3E7.HIT[1..DATUMHSH3E7.NUMHITS].Z
      COMMENT/REPT,"Max: "+ MAX(V1)+"; Min: "+MIN(V1)
      This works for a constructed plane. I presume something similar works for a circle.

      I guess you could write dome IF..THEN looping logic to find the exact location where the MIN and MAX are located in V1. If MAX is located at location 10 and min at location 20, you know that MAX is at 100 degrees and min at 200 degrees.


      Jan.
      ***************************
      PC-DMIS/NC 2010MR3; 15 December 2010; running on 18 machine tools.
      Romer Infinite; PC-DMIS 2010 MR3; 15 December 2010.

      Comment


      • #4
        Wow, I misunderstood the question. Don't try my answer. Try what Jan said or I might even sugest not doing a circle but points. They might be easier to evaluate.
        <internet bumper sticker goes here>

        Comment


        • #5
          You could try something like this, I just typed this into wordpad, so some of the sytax might not be right...this might give you something to work from.This is setup with polar hits, and a radius of 10, but that is easy to change.

          ASSIGN COUNTER1 = 1
          ASSIGN COUNTER2 = 0
          ASSIGN ANGLE1 = 0
          ASSIGN MAXPR1 = 0
          ASSIGN RAD1 = 10

          WHILE ANGLE1 <= 360
          F2 =AUTO/VECTOR POINT,SHOWALLPARAMS = YES
          THEO/RAD1,ANGLE1,0,0,-1,0
          ACTL/RAD1,ANGLE1,0,0,-1,0
          TARG/RAD1,ANGLE1,0,0,-1,0
          THEO_THICKNESS = 0,POLAR,SNAP = NO,$
          AUTO MOVE = NO,DISTANCE = 0
          IF F2.PR > MAXPR1
          ASSIGN MAXPR1=F2.PR
          ASSIGN COUNTER2=COUNTER1
          END IF
          ASSIGN ANGLE1 = ANGLE + 10
          ASSIGN COUNTER1 = COUNTER1 + 1
          END WHILE
          sigpic
          "You cant vote 'present' as the President of the United States"

          Comment


          • #6
            Possible Solution using Arrays

            I have a need to see the feature that is out of spec. for symmetry based on the 'Balloon' numbers we use for our layouts. I use arrays to collect all the individual features and then query for the Min. & Max. values. Here is an example of what I did. It requires alot of code (i.e., I use IF/ENDIF to test every single value in the array to find the the Item # that matches the minimum value), but I am sure there is an easier way. I write alot of code and we do not use CAD, so its all learned/taught (doesn't leave much time to experiment). I wrote ~800 lines of code to test 41 items in this particular program in about 2 hours (it checks for Min. and Max. values).

            ASSIGN/V25 = ARRAY(PNT273.X,PNT274.X,PNT275.X,PNT276.X,PNT277.X ,PNT278.X,PNT279.X,PNT280.X,PNT281.X,PNT282.X,PNT2 83.X,PNT284.X,PNT285.X,PNT286.X,PNT287.X,PNT288.X, PNT289.X,PNT292.X,PNT293.X,PNT294.X,PNT295.X,PNT29 6.X)
            ASSIGN/V32 = MIN(V31)
            COMMENT/REPT,
            ,Item 277 Symmetrical W/I 1.0 to -Z-
            ,
            , (Min, then Max)
            ,
            PNT315 =GENERIC/POINT,DEPENDENT,RECT,$
            NOM/XYZ,0,151,56,$
            MEAS/XYZ,V32,PNT313.Y,PNT313.Z,$
            NOM/IJK,0,0,1,$
            MEAS/IJK,0,0,1
            DIM LOC178= LOCATION OF POINT PNT315 UNITS=MM ,$
            GRAPH=OFF TEXT=OFF MULT=1.00 OUTPUT=BOTH
            AX MEAS NOMINAL +TOL -TOL MAX MIN DEV OUTTOL
            X -0.553 0.000 0.500 0.500 -0.553 -0.553 -0.553 0.053 <--------
            END OF DIMENSION LOC178
            IF/V32==PNT273.X
            COMMENT/REPT,
            ,Min Symmetry is based on Item 11
            ,
            END_IF/
            IF/V32==PNT274.X
            COMMENT/REPT,
            ,Min Symmetry is based on Item 2, Green Sand
            ,
            END_IF/


            Hope this helps,

            Doug Wells

            Comment


            • #7
              I would creat a vector pt, copy it, pattern it with every 10 degrees,
              35 times that will show you what you want

              Comment


              • #8
                Originally posted by vektor View Post
                Hello!
                I am measuring 36 points in a circle and trying to find the point that have the largest polar value
                i can do this by using MAX and ARRAY in Expression builder
                But i want pc dmis to return me what point it is and all its data not only the polar radius value
                This should work for the Max and then do the same for the min - just reverse the operand in the if-statement and change the initial assignment of MINRADIUS to 999.

                You can then use the point number to get the rest of the data. The rest of the data is only the X,Y and z values.

                Code:
                CIR1       =AUTO/CIRCLE,SHOWALLPARAMS = NO,SHOWHITS = NO
                            THEO/2,2,5,0,0,1,25
                            ACTL/2,2,5,0,0,1,25
                            TARG/2,2,5,0,0,1
                            ANGLE VEC = 1,0,0
                            ASSIGN/MAXHIT = 0
                            ASSIGN/MAXRADIUS = 0
                V1         =LOOP/START, ID = YES, NUMBER = CIR1.NUMHITS, START = 1, SKIP = ,
                               OFFSET: XAXIS = 0, YAXIS = 0, ZAXIS = 0, ANGLE = 0
                            IF/MAXRADIUS < SQRT((CIR1.HIT[V1].X-CIR1.X)^2+(CIR1.HIT[V1].Y-CIR1.Y)^2)
                            ASSIGN/MAXRADIUS = SQRT((CIR1.HIT[V1].X-CIR1.X)^2+(CIR1.HIT[V1].Y-CIR1.Y)^2)
                            ASSIGN/MAXHIT = V1
                            END_IF/
                            LOOP/END
                            COMMENT/OPER,NO,"Max Radius= " + MAXRADIUS
                                           ,"Max Hit= " + MAXHIT
                                           ,"X= " + CIR1.HIT[MAXHIT].X
                                           ,"Y= " + CIR1.HIT[MAXHIT].Y
                                           ,"Z= " + CIR1.HIT[MAXHIT].Z
                Last edited by cmmguy; 03-22-2007, 12:46 AM.
                Links to my utilities for PCDMIS

                Comment

                Related Topics

                Collapse

                Working...
                X