How to get a Feature ID from an array

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

  • How to get a Feature ID from an array

    I have the following code in a program:

    Code:
    ASSIGN/NEWARR = ARRAY(PNT1PLANETOP.Z,PNT2PLANETOP.Z,PNT3PLANETOP.Z,PNT4PLANETOP.Z,PNT5PLANETOP.Z,PNT6PLANETOP.Z,PNT7PLANETOP.Z,PNT8PLANETOP.Z,PNT9PLANETOP.Z)
    ASSIGN/MAXATINDEX = MAXINDEX(NEWARR)
    ASSIGN/MAXARR = MAX(NEWARR)
    Works quite nice. It finds the maximum value for Z. INDEX is correct as is the MAX value.

    I would like to follow up with something as follows:
    COMMENT/REPT,"The max is at FeatID and the value is " + MAXARR

    I know where the max is (at INDEX number MAXATINDEX). It gives me an INTEGER like 4 . How can I interrogate the array so I can create a variable that has the FeatureID or name at that array location?

    The following works:
    COMMENT/REPT,"The max is at "+MAXATINDEX+" and the value is " + MAXARR

    But it reads:
    The max is at 4 and the value is -68.34589

    I would want it to say:
    The max is at PNT4PLANETOP and the value is -68.34589

    That would be a whole lot easier to read.

    I have a lot of these planes (constructed from individual vector points) that I want to output only the max and the min value. But I do like to know which point it is. So can I get to the name of that feature???


    Any words of wisdom anybody?????




    Thanks, Jan.
    Last edited by Jan d.; 08-15-2006, 03:57 PM.
    ***************************
    PC-DMIS/NC 2010MR3; 15 December 2010; running on 18 machine tools.
    Romer Infinite; PC-DMIS 2010 MR3; 15 December 2010.

  • #2
    You could create a generic point and input the assign name for one of your X,Y,Z nominals.
    sigpic.....Its called golf because all the other 4 letter words were taken

    Comment


    • #3
      I think I know what you are saying, but again. the relation between the new feature and the one where I have the MAX is lost.

      Would this be done maybe with a TUTORELEMENT? I am trying but not having a lot of success.


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

      Comment


      • #4
        I've never done a feature array but have you tried using the array as a pointer to your feature. I'm not at my CMM right now but check "feature array" in the help file. It looks neat kind of like creating an object. I do believe it is actually a pointer though.

        I think this may be the code. I might try it and see if the feat id can be pulled from it
        Code:
        Assign/V1 = Array({FEAT1})
        Craig
        Last edited by craiger_ny; 08-15-2006, 03:31 PM.
        <internet bumper sticker goes here>

        Comment


        • #5
          Joy joy: now we have Tutorelements. WOWOWOw

          Originally posted by craiger_ny
          I've never done a feature array but have you tried using the array as a pointer to your feature. I'm not at my CMM right now but check "feature array" in the help file. It looks neat kind of like creating an object. I do believe it is actually a pointer though.
          With your method, I can get everything (X,Y,Z) but the only thing missing is the feature ID.

          I tried the following code and it ALMOST ALMOST ALMOST ALMOST ALMOST worked: ARGHHHHHHHHHHH, there goes another bunch of hair.............................

          Code:
          ASSIGN/V101.MEM[1] = TUTORELEMENT("PNT1PLANETOP")
                      ASSIGN/V101.MEM[2] = TUTORELEMENT("PNT2PLANETOP")
                      ASSIGN/V101.MEM[3] = TUTORELEMENT("PNT3PLANETOP")
                      ASSIGN/V101.MEM[4] = TUTORELEMENT("PNT4PLANETOP")
                      ASSIGN/V101.MEM[5] = TUTORELEMENT("PNT5PLANETOP")
                      ASSIGN/V101.MEM[6] = TUTORELEMENT("PNT6PLANETOP")
                      ASSIGN/V101.MEM[7] = TUTORELEMENT("PNT7PLANETOP")
                      ASSIGN/V101.MEM[8] = TUTORELEMENT("PNT8PLANETOP")
                      ASSIGN/V101.MEM[9] = TUTORELEMENT("PNT9PLANETOP")
                      ASSIGN/NEWARR = ARRAY(PNT1PLANETOP.Z,PNT2PLANETOP.Z,PNT3PLANETOP.Z,PNT4PLANETOP.Z,PNT5PLANETOP.Z,PNT6PLANETOP.Z,PNT7PLANETOP.Z,PNT8PLANETOP.Z,PNT9PLANETOP.Z)
                      ASSIGN/MAXARR = MAX(NEWARR)
                      ASSIGN/MAXATINDEX = MAXINDEX(NEWARR)
                      ASSIGN/MINARR = MIN(NEWARR)
                      ASSIGN/MINATINDEX = MININDEX(NEWARR)
                      ASSIGN/MAXINDEXID = V101.MEM[MAXATINDEX].ID
                      ASSIGN/MININDEXID = V101.MEM[4].ID
                      COMMENT/REPT,*********************
                                  ,ARR VALUES
                                  ,MINARR
                                  ,MINATINDEX
                                  ,MAXARR
                                  ,MAXATINDEX
                                  ,*********************
                      COMMENT/REPT,"The min is at "+MININDEXID+" and the value is " + MINARR
                      COMMENT/REPT,"The max is at "+MAXINDEXID+" and the value is " + MAXARR
                                  ,*********************
          Where it fails is the ASSIGN/MAXINDEXID = V101.MEM[MAXATINDEX].ID. This ASSIGN/MININDEXID = V101.MEM[4].ID actually works. But again, I need to know what number where the array is at a minimum. Apparently V101.MEM[MAXATINDEX].ID does not like the variable that calls the MEM location. It has to be a number apparently.

          Secondly, this is an awful lot of coding to get to something so simple as a feature ID.

          I am about to give up.


          Jan.
          Last edited by Jan d.; 08-15-2006, 04:00 PM.
          ***************************
          PC-DMIS/NC 2010MR3; 15 December 2010; running on 18 machine tools.
          Romer Infinite; PC-DMIS 2010 MR3; 15 December 2010.

          Comment


          • #6
            The code as listed, actually works. In order to get it to work, I had to EXIT PC-DEMONS entirely, start back up again and execute. That fixed it. It is working great now.

            I guess that this is one of those DEMONS that we have to learn to live with....



            Thanks for all who tried to help!



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

            Comment


            • #7
              Jan, Craiger,
              Thank you guys for coming up with the answer to the question posed. I may not use this immediately, but, I will be printing the entire contents of this post for future reference. I did take a look at trying to answer the question but I didn't have enough time today to get a satisfactory result(not that I would have but I tried...). Thats what makes this a great forum. Now if we could just have our avatars back.
              sigpic

              James Mannes

              Comment


              • #8
                Still looking for an easier solution, but I can't find one. Implemented yesterday's on one of my programs last ight and it does the job. Problem is that if you want to add just 1 hit, it is a lot of editing. So I don't know if I will keep using it.

                You are right. Little exercises like this make this board worth while for all.

                Oops, almost forgot that this is all about the avatars of course.... I'll try to remember next time.


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

                Comment

                Related Topics

                Collapse

                Working...
                X