Grasshopper

algorithmic modeling for Rhino

Like the title says, I'm curious - Is there a simple way to repeat a pattern of data until the list reaches a certain length?

Advice is either VB or C# would be awesome. 

Thanks,

-Brian

Views: 381

Replies to This Discussion

Ah , I think I can get it from david's stack script here with very little tweaking:

http://www.grasshopper3d.com/forum/topics/if-expression-repeat-data

Figured it out:

Private Sub RunScript(ByVal data As List(Of Integer), ByVal repeatLength As Integer, ByRef A As Object)

Dim myArray(repeatLength) As Integer

Dim k As Int32 = -1
For i As Int32 = 0 To repeatLength
k += 1
If (k >= data.Count) Then k = 0

myArray(i) = (data(k))
Next

A = myArray

End Sub

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service