Join line to closed shape.

michal's Avatar

michal

03 Jun, 2016 09:45 PM

Hello
I make a diagram and I would like add color to area between curves.
Is possible connect the curve or line to closed shape?
Thanks

  1. Support Staff 1 Posted by john on 04 Jun, 2016 12:53 AM

    john's Avatar

    Hi Michaelo,

    This is not obvious, but fairly easy once you figure it out.

    All you have to do is, from the output of the combine node combining your four curves, attach the following 3 nodes in succession:

    - point (converts each path to its points)
    - connect (connects them together - be sure to set "closed" to true)
    - colorize (set fill color and stroke width/color)

    You can see the results in the attached screenshot.

    Hope that helps!

    John

  2. michal closed this discussion on 04 Jun, 2016 12:59 PM.

  3. michal re-opened this discussion on 04 Jun, 2016 12:59 PM

  4. 2 Posted by michal on 05 Jun, 2016 05:12 AM

    michal's Avatar

    Hi John.
    Thank you very much for your solution is very nice and simple, but when I need to fill more of shapes itdosn`t work. I have tried different variations of your script, but I not have a result.
    Thanks

  5. 3 Posted by michal on 05 Jun, 2016 05:15 AM

    michal's Avatar
  6. Support Staff 4 Posted by john on 05 Jun, 2016 07:47 AM

    john's Avatar

    Hi Michal,

    Your note said you were having trouble getting my solution to work with more than one shape.

    The secret to solving problems like this is making a subnetwork. To make my nodes output a different filled curve for each row of your table, all I did was was group everything from the four make point nodes down to the connect node into a subnetwork (with the connect node as the rendered node). I left this network with its default name, but you should probably rename it to something more descriptive like "make_shape".

    Each time you feed this network a set of four points, it spits out a single filled curve. I wasn't sure how many curves you wanted, and what you wanted to do with them. But I noticed you made a palette of 9 colors. So I added a numbers node near the top of your network that lets you control how many curves you want and set it to 9. The network slices off the first 9 rows, feeds them into the network, then feeds those 9 curves and the 9 colors into a colorize node. Each curve is now filled with a different color.

    I also wasn't sure whether you wanted to superimpose them, stack them, put them in a grid, or what. So I made a quick 3 x 3 grid and added a translate node so that you could clearly see each separate curve. I also sliced the grid with the same number so that if you set it to less than 9 you will see the correct number of curves. If you set it to more than 9, additional curves will be superimposed. If you don't like that you can adjust the grid or stack the curves instead.

    If you want to superimpose all the curves into a single diagram, just render the colorize node instead of the translate node. For superimposing you might also want to reduce the alpha number to make the curves translucent.

    I am attaching the modified network and a screenshot showing the 3 x 3 grid. You should be able to take it from there.

    Please let me know if that solves your problem.

    Thanks,

    John

  7. Support Staff 5 Posted by john on 05 Jun, 2016 08:06 AM

    john's Avatar

    Michal,

    If you do want to superimpose all 33 rows, as it appears in your projected result, you can delete all the slice nodes along with the number, grid and translate nodes. To make it general purpose, you can hook a count node to the sample node so it will work with any size file.

    The result is much simpler. I am attaching that along with a screenshot.

    Enjoy!

    John

  8. 6 Posted by michal on 06 Jun, 2016 08:41 AM

    michal's Avatar

    Hi John.
    Many thanks for the prompt reply. Both of your solutions are perfect and very inspiring and also clarify my some of the features and functioning of Nodebox. I use solutions with overlapping shapes for my project and if I have final version of work, will share of the forum.
    Many thnaks
    Michal

Reply to this discussion

Internal reply

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

Attaching KB article:

»

Already uploaded files

  • zuza_data.csv 1.16 KB
  • diagram_1.ndbx 5.69 KB

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 Apr, 2024 04:41 AM
16 Apr, 2024 06:18 PM
16 Apr, 2024 04:23 AM
08 Apr, 2024 01:28 AM
07 Apr, 2024 11:50 PM

 

05 Apr, 2024 11:47 PM
05 Apr, 2024 12:30 AM
25 Mar, 2024 08:48 PM
14 Mar, 2024 07:40 PM
14 Mar, 2024 07:38 PM
12 Mar, 2024 06:14 AM