Basic list operation longest lace

hi, I am a GH user, now I am a new player of Dynamo :),
my problem is that how I can add two groups of list by longest rule in dynamo getting the result as it in GH I showed in the left picture.

Hi @yangshilun2012 welcome them to the community!

Like this?

Try with list level and Lacing



+.dyn (9.3 KB)

hi _Vijay That is probably not what I want to achive.
is it possible for example
A + B = C
0list (9,9,99) + 0list (3,2) = 0list (12,11,101)
1list (9,6,7) + 1list (3,2) = 1list (12,8,9)
2list (8) + 2list (3,2) = 2list (11,10)

You might have to change the Levels and / or Lacing. You can click then > next to x and y in the + node (in example).

i have tried, level lacing, even list map, list combine and so on. still not get what I want, It is not that easy as it is in grasshopper. Perhaps there are very different in this case, becasue it is a default setting in grasshopper.

Ah, i see what you mean now. What you want can be done. I guess the easiest way is with DesignScript, but that is not my cup of tea. It probably can be done without DesignScript but that kinda depends on a few things.

Maybe this :point_down: get you started.


Like this?

this is also default dynamo setting…

@_Vijay

Read this :point_down:.

thx bvs1982, it is very close to my aim. I am looking at it.

!

+.dyn (12.9 KB)

@_Vijay

Please look closely what OP is after. In your dyn 10 is missing (for 8+2).
A problem is that the lists have different lengths(?). Transpose is probably needed(?). List logic isn’t my strong suit :stuck_out_tongue_winking_eye:.

:roll_eyes:

t1 = [9, 9, 99, 9, 6, 7, 8];
t9 = DSCore.List.Chop(t1, 3);
a = t9;
t2 = Get.ValueAtIndex(a, 0);
t4 = [3, 2];
t10 = DSCore.List.OfRepeatedItem(t4, 3);
a1 = t10;
t3 = Get.ValueAtIndex(a1, 0);
t11 = t2<1L> + t3<1L>;
a2 = t9;
t5 = Get.ValueAtIndex(a2, 1);
a3 = t10;
t6 = Get.ValueAtIndex(a3, 1);
t12 = t5<1L> + t6<1L>;
a4 = t9;
t7 = Get.ValueAtIndex(a4, 2);
a5 = t10;
t8 = Get.ValueAtIndex(a5, 2);
t13 = t7<1L> + t8<1L>;
result = [t11,t12,t13];
2 Likes

Can this be done with nodes only? So no DesignScript?

Not sure about nodes, but can actually be done with a line of Design Script
sumLongest_2021-08-30_03-36-27

a<1><1L>+b<1><1L>;

6 Likes

@Vikram_Subbaiah

I allways really like your (DesignScript) solutions. I really need / want to get into that.
Often DesignScript is a much simpler / easier solution than using (a bunch of) nodes.
Sometimes it can only be done with DesignScript(?).

At least i was right with this :point_down:.

I guess the easiest way is with DesignScript

2 Likes

Please get started and reach out here when you heed any clarifications. Would be nice to see more Design Script related queries.

Yes. I suppose all that is possible with nodes can be done with Design Script, but the converse isn’t always true

1 Like

thx, i can not read your script, could u convert them back ot original?

looks awesome, although I can not reat it, could you explain what it means, or where I can get the knowledge to know, what <1> <1L> means, :))

Yes, can you elaborate on this? I think i might know, but i am not sure.

Also isn’t you DesignScript basicly doing the same as _Vijays first post?
Why does it work when using DesignScript, but not with nodes? @Vikram_Subbaiah

a<1><1L>+b<1><1L>