Grasshopper

algorithmic modeling for Rhino

Hi all,

i have one problem. I have 2 lists (see pic my_2_lists) and i want to add the second list to the first one.

My problem is that i want to add the first element from the second list after the last element from the first list.

Somehow i added the lists (see pic my_solution) but it is not what im looking for.

Can someone tell me please how to make this work?

Thank you,

Raul

Views: 18986

Attachments:

Replies to This Discussion

I would use a path mapper to structure each list to interleave in the merged list

 

Danny,

thank you for your replay. Your solution is nice but not the one im searching for. What i want is to add the first item of D2 after the last item of D1.

Do you have any idea how to realise this?

A C# script component also dont help...

private void RunScript(List<object> x, List<object> y, ref object A)
{
List<object> output = new List<object>();

foreach (object x_obj in x)
{
output.Add(x_obj);
}

foreach (object y_obj in y)
{
output.Add(y_obj);
}

A = output;

}

Michael,
thank you for your replay. I have one question regarding your solution. When you put in 3 values, why do you become 5 out?

Will try to explain again my problem:

First data set contains 3 items
{0} with 0/1/2 and the values 1/1/1
{1} with 0/1/2 and the values 2/2/2
{2} with 0/1/2 and the values 3/3/3

Second data set contains 3 items
{0} with 0/1/2 and the values A/A/A
{1} with 0/1/2 and the values B/B/B
{2} with 0/1/2 and the values C/C/C

After merging the 2 data sets i need as result one data set with 6 items
{0} with 0/1/2 and the values 1/1/1
{1} with 0/1/2 and the values 2/2/2
{2} with 0/1/2 and the values 3/3/3
{3} with 0/1/2 and the values A/A/A
{4} with 0/1/2 and the values B/B/B
{5} with 0/1/2 and the values C/C/C

How can i realise this?

yea wasnt really thinking there was I :p thats what happens when dont look
carefully.

Same as Danny methods above, use path mapper for jump to the next last item in D1

{A; B; C} --> {A; B; C + number of data in D1

correct me if I'm wrong

Hi Yasser,

Thank you for you answer. Almost right.

First i have a warning from my "Path Mapper". "Floating parameter Path Mapper failed to collect data".

When i right understand, your first data set contains 4 item. After this 4 items you start adding the second data set.

I don't have just 4 items, i have "i". How can i make this more flexible?

Attachments:

First, the warning because your list haven't just one path {A} but three paths {A; B; C}

And second, I'm not really expert with tree management, but you can trying with this def (attach) for sample

Notice : this isn't flexible def, but maybe can work with your list

Attachments:

Hi Yasser,

Don't be so onest! You made it man! I don't know what the expert solution is, but yours works fine and it is flexible enough. It is also a very good example for how it works.

 

Thank you very much for your help.

 

Have a nice day,

 

Raul

thanks! nice solution

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service