Add value in sublist

Hi All, i am trying to add A,B,C,D… to my sublist as per no of elements in that sublist.
But i don’t want add any value to the sublist which only has one element.

Can anyone help me out to sort it.

Try this:

m= n==1 ? 0 : m; //replaces a value of 1 with a value of 0. 
lists = “A”..#m..1;
1 Like

Thanks @jacob.small for your quick response, i needed to change the wording a bit but it worked well.
is there anyother way to remove empty list with ( " ") , i have used node “List.ReplaceEmptyLists”.

Much appreciated

1 Like

Hi


cordially
christian.stan

2 Likes

And now I see the intent. :slight_smile:

This would be a great custom node.

List.BuildSuffix which takes a nested list as the first input, and a list containing the suffix sequence…

2 Likes

Hi Mr. @christian.stan , it worked
Legend :saluting_face:

1 Like

Mr. @jacob.small , It worked as well
thanks for your quick response

I have marked it as a solution :slight_smile:

1 Like

I tried in python but I think I still have work to do

script
import sys
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *

def pref(a):
    alphabet="ABCDEFGHIJKLMNOPQRSTUVWXYZ"
    if a>1:
        return [alphabet[i] for i in range(a)]
    else:
        return [""]

elt=UnwrapElement(IN[0])

OUT = [pref(len(elt[j])) for j in range(len(elt))]

cordially
christian.stan

2 Likes

yes it is working get thanks, finally i am able to sort my pile as per coordinates with the help of SpLine

Many thanks

1 Like