Grasshopper

algorithmic modeling for Rhino

hello, guys..when we count a list of points, will the vb remenber the coordinates of those points or just remember the number of the points?

example of introduction of scripting..
-----------------------
sub runscript(byval pts as list (of on3dpoint), byval gs as integer)

dim grid as new arraylist()

dim i as integer
dim j as integer

for i =0 to pts.count()-1 step gs

dim row as new list(of on3dpoint)
for j=i to i + gs - 1
dim pt as on3dpoint
pt=pts(j)

row.add(pt)
next
grid.add(row)
next
--------------------------
I dont understand how the row and grid looks like, or how they works with coordinates of points,could someone explain this very bisic question for me? Lets say pts=(0,0,0),(0,1,0),(1,0,0),(1,1,0)    gs=2

Thanks so much..

Views: 694

Replies to This Discussion

Hi Taylor,

the above script will store the actual points as lists of points (List(Of On3dPoint) inside an ArrayList.

I would not recommend storing it this way as ArrayList is not a type-safe collection and it will be difficult to access the data inside of it (lots of casting required).

If you want to assign this grid to the output of a script component, you'll have to use a DataTree, as Grasshopper is not able to reliably parse nested lists.

I don't really understand what the script you posted is supposed to accomplish, but I added a script (using the new SDK, you'll need GH 0.7 or higher for this) that creates a Grid and stores the result in a DataTree.

--
David Rutten
david@mcneel.com
Poprad, Slovakia
Attachments:
OK, thank you David, that script I picked from Grasshopper Primer_second edition page 107..the aim is add mid point into points grid that already exists(pts). I just type half of that, because I dont know what is covert 1D array to 2D grid (the comment put in front of for i=0to pts.count()-1 step gs). Now I know how it works, thank you so much.

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service