algorithmic modeling for Rhino
Hello Everyone,
I am new to Grasshopper and teaching myself how to use it by attempting a specific project that I have in mind:
I would like grasshopper to read a text file sequentially and for each specific character it encounters in the file a specific curve would be created (a line with a particular length/orientation associated with that specific character) whose starting point is on the end of the last previous line. here is simple action list:
i am good with everything else (linking the file, building curves on the ends of things, creating line parameter w/ persistent data, etc) but I'm having a problem with the "if/then" nature of the project. I haven't found a component that has this sophistication yet... I've tried the equals component that compare lists and identify true/false scenarios and the f(x) along with dispatch to create a curve if a single situation occurs (like if x>3, then make a circle) but what about the next character?
I am wondering if I should do this in C+ (which I also don't know) but would rather create this in grasshopper.
See attached for example grasshopper file and txt file.
I would really appreciate any help you can offer - Thanks!!!
// jon
Tags:
You can use Mass Addition to solve this:
The Random component simulates your list of values from files, the Line SDL gives the list of associated lines.
To make it work the way you described, replace Random by your Read File, replace Line SDL by an appropriate list of lines (they should have origin as start point).
Wow - Thank you so much Systemig!!!
Question for you... I am a bit baffled how this system is associating the specific line type (that is generated in your example) with the specific character in the txt file. So I replaced your randomizer with my txt file link and for example, every character "14" it encounters in the text file, it is inserting a vertical line 1.5, or for every "20" it encounters, it is inserting a line that is .75" in the x dimension... Is there a way to have more control over this? I am looking at creating 66 specific curves and surfaces (lines, spheres, cubes, etc) that will be associated with 66 specific characters in the txt file.
Would you be so kind as to illustrate how several different curve and surface tools can be associated with a specific character in the text file? Attached are the grasshopper amendment and txt file...
Wish i could offer you a digital six-pack for your help/troubles!
best and many thanks!
jon
Ok, let say you define a list of 66 different lines.
This list is ordered, lines are different, so there is a bijection (= one-to-one correspondance) between the indexes of lines [0 to 65] in the list, and the lines.
That means for example index i refers to line Li, and only Li.
Using List Item, it is trivial to get Li with i.
If you provide an integer not in [0 to 65] to List Item, you can get a result if the Wrap parameter is set to true, but it has no "meaning".
If you want your txt file to be different than numbers between 0 and 65, you can use the same method to make correspondances between characters and numbers.
Now if you want to use surfaces or polysurfaces, you have to decide how they will stack together, spheres and cubes don't really have "end points".
Thank you so much!! This is giving me a ton to work with. I really appreciate your help with this!!! I'll send you a photo of the finished work ;-)
All the best Systemig!!
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by