Sorting curves by name

unhandled

#1

Hi everybody

I gat to sort curves by name to assign them different tube diameters.
my object are name with such name :
A344-611-7216
A344-231-6211

there is approximatly 200 object by files who have all a different name, every files have a different name to from A300 to A550 and more
what will be perfect for me here is to be able to pick some information and the whole name to apply my diameters.
so first I need probably to cut the name of the object then to sort it.
here I want to kill the A344 starting number, because I want the grasshopper file to works with any other files. then as an example the first number 6 in A344-611-7216 mean vertical tube and the first 2 in A344-231-6211 mean horizontal tube.

so basically, I want all the object who have a 6in the same position to be one diameter and all the one who have a 2 an other diameter…

any solution or tutorials to help ?



thanx


(Rickson) #2

no problem but please post files of some sort with the text to sort

i will be using the elefront plugin an assigning userdata to filter if thats ok.


(Riccardo Majewski) #3

You can use the “Characters” (Chars) component that split a string text and give also the unicode value.
Or also you can use “Text Split” to divide it in sub-strings.
See the tab “Sets”>“Text”.
With simple boolean logic (equality + dispatch) you can do whatever you want.


#4

thanks you very much, I have tried elefront but I a beginner and its a bit harder to solve this case for me, thanks a lot !A344_Branche_NE-TEST-MEP-ANTHO-grasshopper3.3dm (575.5 KB)
tube-sur-lignes.gh (10.2 KB)


(Riccardo Majewski) #5

tube-sur-lignes_re.gh (10.9 KB)
Have a look at attached definition and see if it helps.
I don’t know the logic you want to use with those numbers… I did a simple sort.

(I didn’t have your plugin, so I made a small c# script to get the Names of the curves.)


(Rickson) #6

Hopefully this illustrates the process enough so that you can create the custom sorts you require.

Apply and Sort By Attributes.gh (12.7 KB)


#7

hi guys, thank you very much for your helps, very nice !
combining both of your ideas I have built something who exactly look like what I had on my mine, but… it don’t work ! :slight_smile:
apparently since I have split the text I’am no longer working on geometry but only on informations/attributes, and I definitly don’t know how to get back to geometry to pipe them…
any idea ?
tx
A344_Branche_NE-TEST-MEP-ANTHO-grasshopper3.3dm (575.5 KB)
tube-sur-lignes-reponse-02.gh (10.5 KB)


(Rickson) #8

you will also have to sort the geometry, its an asynchronous sort, and since you might need the other split text i sorted those as well.

You actually don’t have any usertext (attributes) on the rhino geometry to use the sort by attributes component.

This works, but i would recommend the original version or try another method.

fyi, The match text will do the same thing the include component does, but on numbers and text.

tube-sur-lignes-reponse-02-fix.gh (10.7 KB)


#9

AWESOME !

thanks you very much !!