Grasshopper

algorithmic modeling for Rhino

Hi,
Does anyone have any advice regarding scope of rhino objects (eg Online,OnArc etc)? Specifically, within a loop, is there a way to redefine what an Online or OnArc is? I find that I have to declare a new variable if I want to draw another object of similiar type within a loop. Otherwise, the last declaration sticks and doesn't clear.

Is there a way to clear the definition of the object and use Line.Create again within a loop?

Thanks.

'START OF LOOP
Dim Line As New online(Pt1, Pt2)
HSSLong.Add(Line)

Dim Line2 As New OnLine(Pt2, Pt3)
HSSDiagonal.Add(Line2)

LOOP

Views: 346

Replies to This Discussion

Hi Kermin,

are you sure "scope" is what you are talking about? An OnLine is a class, so when you make a single instance of it (New OnLine()) you can add that one instance thousands of times to a list, but it will always be the same instance. If you then change the start or end points of one of those list elements, it will change everywhere.

If you want to create a list with 200 unique lines, you'll have to declare a new line 200 times.

--
David Rutten
david@mcneel.com
Robert McNeel & Associates
Hello Kermin,

this GH definition contains a VB.NET component with a loop. The loop is commented particularly with respect to variables and references.
Hope it helps,

Giulio
Attachments:
Thanks.
I'm coming from a VBA background and your comments in the ghx file helped a lot.

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service