Grasshopper

algorithmic modeling for Rhino

I am trying out the new grasshopper .7 which by the way is awesome. I am testing the new tools and the "list insert" component is behaving oddly. I would understand if the inserted series were to be reversed but I can't figure out what is going on. Here is a screenshot




Views: 2691

Replies to This Discussion

Anyone?
At least to say that you find it odd too...
It's odd, indeed.

If you supply the same index for each item you insert, the list insersts without retaining the original order.

If you supply incremental indices, it works fine, unless the indeces exceed the base list's lenght. For example if you try to longer a larger list into a shorter one.
Yeah, it is odd. It should have randomized the inserted list. I'd expect it to insert the second list in reverse when you supply the same index over and over again.

I'll have a look.

--
David Rutten
david@mcneel.com
Poprad, Slovakia
Ok, the reason it's messing up the order is because I sort the index array. When you sort an array which contains identical values, there's no telling in what order they end up. I'll have to completely rewrite this component.

Thanks for reporting this hideous bug :)

--
David Rutten
david@mcneel.com
Poprad, Slovakia
Hi David,

Also can you have a look at the issue with adding a longer list to a shorter one as JJ mentioned above.

Best regards,
Danny
Well, you cannot supply an index higher than or equal to the original list size. That would result in overflow. All the insertion indices must be defined in original list counting.

But I just fixed the reported bug so it's now possible to supply the same index multiple times and get the correct result.

--
David Rutten
david@mcneel.com
Poprad, Slovakia
Would it not be possible to evaluate the proposed length by adding L and I's list length together to create a buffer zone?

It's not about actually fitting data into a new list, I can easily make it so that it behaves in that way. But as soon as you go down that path, you open a big can of worms. Imagine the following:

SetA = {A, B, C}
SetB = {U, V, W, X, Y, Z}
Imap = {0, 0, 2, 2, 3, 4}


If I use your proposed method, then the result would be (displayed for each insertion):

{U, A, B, C} 'insert U at index 0
{V, U, A, B, C} 'insert V at index 0
{V, U, W, A, B, C} 'insert W at index 2
{V, U, X, W, A, B, C} 'insert X at index 2
{V, U, X, Y, W, A, B, C} 'insert Y at index 3
{V, U, X, Y, Z, W, A, B, C} 'insert Z at index 4


Whenever I insert an item into the list, it bumps all subsequent items up by one. This means that the *order* in which SetB and Imap are supplied greatly affects the result.

In the current scheme, the order is irrelevant, except for when you have identical index values, then the order should remain intact.

--
David Rutten
david@mcneel.com
Poprad, Slovakia
The problem that I've been faced with when using this component is that I like to replace items in the list with other values by using a combination of Cull Index and Insert Item. But because I'm reducing the original list by culling first I don't always get the last of the intended replacements. Since I'm intending to do a direct swap culled index for Inserted Index then I don't envisage using the same integers in the Imap. Or is the best way to still do what I've shown above and increase the list first by the intended culling?
I see. I think there should also be a ReplaceItem component. It can probably be done with a bunch of existing components, but list management is a rather important part of Grasshopper so I'd like to supply as many useful list components as possible.

--
David Rutten
david@mcneel.com
Poprad, Slovakia

What is the name of the "black arrow" component?

David:

Personally I expected this component to work in the following way:

SetA = {U, V, W, X, Y, Z} ,
SetB = {1, 2, 3}
Imap = {2}

>>Result = {U, V, 1, 2, 3, W, X, Y, Z}

If Imap is higher than the SetA lenght there could be a boolean to toggle an append function.

SetA = {U, V, W, X, Y, Z} ,
SetB = {1, 2, 3}
Imap = {10}

Append = True >> Result = {U, V, W, X, Y, Z, 1, 2, 3}
Append = False >> Result = {U, V, W, X, Y, Z}

This is different from the "list insert" component that you wrote but I find it more intuitive. Maybe I just have a problem with the name, I would understand it better if it was called "Item insert"... I'm no english expert so I may be completely wrong.

Perhaps there could be two components one "Item Insert" and another "List Insert"...

ReplaceItem would also be very useful.

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service