Preventing list from wrapping around

Adi 's Avatar

Adi

18 Jan, 2016 06:12 AM

Hello there,

I have a list of strings that I want to output on a grid via a lookup on a csv file.

However, the list starts to wrap once all elements are exhausted instead of leaving the end blank. How do I prevent this behavior?

  1. Support Staff 1 Posted by john on 18 Jan, 2016 08:05 AM

    john's Avatar

    Hi Adi,

    If your grid is one-dimensional (a single row or column) all you have to do is make the total number of points in the grid (e.g the number of rows in a one-column grid) match the total number of strings. You could also use a stack node instead of a grid node.

    But I'm guessing you have a two-dimensional grid. In that case, the easiest way is to use a slice node. If the grid is producing more positions than you need you can simply slice off what you need and discard the rest.

    I have attached a very simple NodeBox network (and screenshot) to illustrate this. Just feed the output of the textpath node into a slice node. Set the start index of the slice to 0 and the size to the number of strings.

    In order to avoid recoding this every time you change the number of strings, you can use a count node to get the number of strings and feed that into the size node.

    In this example I have a list of 7 fruits displayed using a 3 x 3 grid. The textpath node produces nine text paths, with the first two fruits repeating. I feed this into a slice node which keeps the first 7 text paths and discards the remaining two.

    Hope this helps!

    John

  2. Support Staff 2 Posted by john on 18 Jan, 2016 08:24 AM

    john's Avatar

    P.S. In my example I put the slice node below the textpath node so that you could easily verify the wrapping behavior that occurs before the slice. But it would be slightly more efficient to feed the grid directly into the slice and then feed the slice into the textpath node. That way NodeBox doesn't waste time making unnecessary text paths that then have to be discarded.

    When I first started NodeBox it may not have occurred to me to do this. I thought of the grid as a kind of pristine abstraction, like graph paper. But it's just a list of positions like any other list.

  3. 3 Posted by Adi Ron on 18 Jan, 2016 12:19 PM

    Adi Ron's Avatar

    Thank you. I managed to figure it out with your help.

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac

Recent Discussions

19 Jun, 2024 12:57 PM
19 Jun, 2024 09:35 AM
15 Jun, 2024 01:44 PM
08 Jun, 2024 09:05 AM
08 Jun, 2024 09:00 AM