17 Replies Latest reply on Sep 21, 2012 11:00 AM by Muppet Mark

    Looping problem...How to create and lock a set of PathItems?

    WeishunX

      Greetings all!

      I'm a noob....a very confused one

      And I'm trying to get this thing work

      So here is what I have. The first loop grabs the geometries drawn in the current document and rotates it around itself creating duplicates. The second loop is supposed to circumvent more geometries around the newly created geometries.

      But instead of creating a radiant pattern, this code builds a tower: for the second loop everytime it grabs the last drawn geometry instead of what is in the "Original"

      Can somebody explain what is wrong? Thanks!

       

      for NumPaths = 1 to frontDocument.PathItems.count

                set myPath = frontDocument.PathItems.item(NumPaths)

       

       

                For index = 0 To 30

                          set newPath = myPath.Duplicate

                          call newPath.translate(100*sin(6.14* index/30),100*cos(6.14* index/30))

                          call newPath.rotate(360 * index/30)

                Next

      Next

       

       

      Set Original = frontDocument.PathItems

       

       

      for NumPaths = 1 to Original.count

                set myPath = Original.Item(NumPaths)

       

       

                For index = 0 To 30

                          set newPath = myPath.Duplicate

                          call newPath.translate(100*sin(6.14* index/30),100*cos(6.14* index/30))

                          call newPath.rotate(360 * index/30)

                Next

      Next