2 Replies Latest reply on May 22, 2012 11:06 AM by Head1

    Very small question: How do I remove an item from a collection ?

    Head1

      Hello everybody,

       

         Let's say I have a collection of some objects.

        For example:  All selected vias in design which I call My_Vias.

       

        I would like to remove from the collection, a certain via, if a condition happens.

        For example:

            If the X coordinated of a  via is equal or greater to some value.

       

        How can I do it ?

       

           Thanks in advance,

       

                        Head1.

      --------------------------------------------------------------------------------

        • 1. Re: Very small question: How do I remove an item from a collection ?
          Satoru

          Hi Head1-san,

           

          Is the thing which you want to do this?

           

              Set My_Vas = pcbDoc.Vias(epcbSelectPlaced)

              For i = My_Vas.Count To 1 Step -1

                  Set My_Va = My_Vas.Item(i)

                  If My_Va.PositionX = XX And My_Va.PositionY = YY Then

                      My_Vas.Remove (i)

                  End If

              Next

           

          Regards,

          Satoru

          • 2. Re: Very small question: How do I remove an item from a collection ?
            Head1

            Hi Satoru,

             

               Thanks for your quick answer.

                This was exactly what I was looking for.

             

                 Looping inside a collection I know, with "for each" or "For" with a counter.

                 What I did not know was the instruction: my_via.remove(i).

                  Sometimes I am lazy to read the manuals.

             

                 Thanks again,

             

                             Head1.

            -------------------------------------------------------------------------------------------------