Grasshopper

algorithmic modeling for Rhino

Hi All

 

I have a general question regarding how to control the behaviour of components when 'longest list' is selected, with a specifc example where I have run into problems. For some custom components, certain combinations of inputs can create a huge number of permutations when 'longest list' is selected which results in Grasshopper hanging for a long time (e.g. for over an hour before I switch off!). My question is whether it is possible for components to contain code that modify longest list behaviour, or whether my approach is wrong in terms of accepting a mixture of 'items' and 'lists' to my component. This specific example hopefully makes my question clearer:

 

I've created a suite of components for creating double layer gridshells, one of which adds a connector at each intersection point. This basically works by taking a curve (as an item), a list of curve parameters, a list of orientation vectors and the connectors as items.

 

If the component receives one curve, one list of curve parameters and one list of vectors it works fine. It also works fine if it receives a tree of curves (where each branch contains one item, achieved by grafting the input curve list in the attached example image), and trees of lists for the curve parameters and vectors. However, if it receives a list of curves and trees for the curve parameters and vectors it uses all of the curve parameters contained in all the tree branches for the 1st curve in the list, then again for the 2nd curve etc. For a small model this results in each intersection having multiple connectors, but for a big model it results in GH hanging due to the huge number of permutations.

 

Any pointers on how best to resolve this would be appreciated. I guess I could set the component up to expect datatrees and then sort everything out within my code, but I'm hoping there's a simpler way to control this.

 

Thanks!

Alex

Views: 5593

Attachments:

Replies to This Discussion

Hi Alex,

LongestList is the default way of combining data. I'm very unhappy with the three options as they are now, which is why they will no longer be available in the next release. LongestList will remain the default mechanism, but it will only be possible to disable ShortestList and CrossReference matching on old components that already had them set. There are now components that will modify data using more advanced and flexible algorithms than SL, LL, CR.

Now that this logic is available as components rather than menu toggles, it will also be easier to add functionality in the future.

I realize this doesn't answer your question, but I figured you'd be interested in it anyway.

--

David Rutten

david@mcneel.com

Poprad, Slovakia

Hi David, 

This looks great. It's a good a time as any to to put the seed in your mind about a "cycle" data matching we discussed years ago.

List A = 0,1,2,3,4,5,6,7,8

List B = A,B,C

Data Matching

0 --> A

1 --> B

2 --> C

3 --> A

4 --> B

5 --> C

6 --> A

7 --> B

8 --> C

I think it would be great to include the Trim(Start/End) of List A options as well as the Repeat (Start/End) of List B.

The Wrap option does that I think.

--

David Rutten

david@mcneel.com

Poprad, Slovakia

You're right! This is fantastic.... now all you have to do is compile and post :)

Thanks David, useful to know where you're going with this. Looks a lot more flexible than the current system.

Thinking through my problem again, I'm going to tweak my component so that it takes lists for all three main inputs, then include some checking to make sure it's not attempting too many different combinations.

Cheers

Alex

But why would there be too many different combinations? What if people want different combinations?

It should be possible to abort a running solution by pressing Escape. Is this not working for you?

--

David Rutten

david@mcneel.com

Poprad, Slovakia

In this particular case it only makes sense to use one curve against one list of points and one list of vectors, which results in one set of connectors:

Too many combinations looks like this!:

I've had a bit of a play, and the hold up seems to be Rhino rather than GH. The component timers register seconds for processing time and the GH screen refreshes, but Rhino takes an age to refresh and the hard drive sees a lot of activity. Not sure why this is, but only occurs when the number of connectors generated is large so presumably related to that. Pressing escape doesn't stop the hard drive activity or get Rhino running again, so again looks like a Rhino problem in processing the amount of data rather than GH.

 

I'll upload my GHA file in a few days for people to have a play.

 

Cheers

Alex

 

I'm guessing the problem is creating the preview meshes. If your Rhino is paging at the same time because you're out of physical RAM, it really will take forever. Does it speed up when you switch off shaded previews?

--

David Rutten

david@mcneel.com

Poprad, Slovakia

Yep, that makes a huge difference. I hadn't realised there was potentially so much more memory usage with the shaded preview. Preview times are back in the seconds again rather than minutes.

 

Thanks

Alex

David, this means that before matching the data in our components (for example: matching the points to form a line - Line component) we can use the above components, to arrange the list in a way we want, before we input it into the Line component?

Of course I am talking about 0.9.0001+ Grasshopper versions.


Can you please explain the component "Intepolate" (third one from above). What does it do?

Yes, as I understand it you will have to use these data matching components if you are trying anything apart from the default behaviour which I think is Longest List (repeat last)

and the Interpolate fixes the two first items and the last two items and then tries to best fit an even spacing along the list.

Yes, you'd apply these components to data before they are plugged into the actual components. The big benefit is that there are now more options to adjust data, it's easier to pick which data is affected (in the old scheme, all inputs were always taken into account) and it's more obvious what happens to the data just by looking at an image. Also, it clears out the component menu and it's easier to add more functionality later on without creating too much confusion.

Interpolate will 'sample' the data at equally spaced intervals. Let's say you have a list of 8 fruits, as I used in my example. What happens if you interpolate this list using 4 samples? Well, the first and last sample are always centered on the first and last items in the original list. The in between samples are distributed at equidistant intervals:

So you'd end up with a list containing {Lemon, Bergamot, Mandarin, Tangerine}. If you interpolate this list using 12 equally spaced samples, it will look like this:

and it results in a list containing {Lemon, Lime, Lime, Bergamot, Grapefruit, Grapefruit, Orange, Orange, Mandarin, Rangpur, Rangpur, Tangerine}. Of course interpolating a list may result in weird sampled intervals because of the rounding of sample parameter to list indices.

Interpolation does not sample in between values. It will not return a value that is 30% Grapefruit and 70% Orange. This kind of interpolation is only possible on a subset of data types (numbers, vectors, points, colours etc.) but these components must operate on all data types. I added a specific interpolation component as well, that performs numeric sampling using 4 possible interpolation functions, but this is a wholly different kind of interpolation.

--

David Rutten

david@mcneel.com

Poprad, Slovakia

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service