Grasshopper

algorithmic modeling for Rhino

Extract first number from a list? Is it posible?

Hi,

I will have a list of numbers, and i want to make a list of just first numbers from that list,

If i have list:

1 15,15,15

2 20,20,20

3 100,100,100

4 ...

I would like to get:

1 15

2 20

3 100

4 ...

I tryied with path mapper, not get it..

Can someone make this? Tnx!

in gh select any line.

Views: 1558

Attachments:

Replies to This Discussion

g

Problem is because this is one branch (with these numbers) and when i decompose it or ungroup it, it lose these values i need. See the gh file i put in.

Tnx

If it are verctor or point coordinates you can just get the x coordinate of them going either to point or vector decompose.

Anyway you can go to the string menu and play around, maybe decompose each string into individual characters, get the first comma index of each string and use it for splitting them with the substring component.

Attachments:

These are RGB values from gradient component, are you sure its what you really want ?

You should operate on it with string components cause these are not numbers but strings... or use split ARGB component - after splitting youll get R value (its what you ask for) but in 0 to 1 domain. To convert it back to integer value (like 71) multiply it by 255.

Path mapper is used to change Data Tree structure - get some tutorials on them cause this is essential knowledge (essential <> simple).

I made it, Tnx!!

If someone need it:

Rounding isnt necessary - just cast it to integer with integer component.

tnx!

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service