Custom Node Test(Fixed)

ahuman's Avatar


30 Mar, 2021 08:55 AM

Custom Node Test

  1. Support Staff 1 Posted by john on 30 Mar, 2021 09:44 AM

    john's Avatar

    Hi ahuman,

    This looks very interesting! I have not tried fooling around with the nodeLibrary stuff in custom nodes myself. What you've done here with retrieving all the node names looks pretty cool. I might find this useful for some upcoming projects. Are you planning on doing anything particular with it?

    As you know by now there is very little documentation about how to make custom nodes. I have about 15 in my node library; the rest of my nodes are actually subnetworks. My custom nodes are all fairly simple, but I had to do a lot of trial and error to get them to work at all. There is much fresh territory to explore here.

    Thanks for sharing this and please feel free to share your future experiments.


  2. 2 Posted by ahuman on 30 Mar, 2021 02:37 PM

    ahuman's Avatar

          I'm trying to figure out how NodeBox works by exploring NodeBox's source code. I want to make a custom nodelibrary and make referenceable node.

          By the way, I found many links of python libray in zip format on the forum is unavailable. Why? Do you know?

          And, I want to make a myown version of NodeBox. Serveral weeks ago, I try to do that, but encountering some compiling problem. After F update the NodeBox, I found the compiling tools F provided is changed. Perhaps this time the problem would be sovled. But I have to understand how NodeBox's source code works in detail first.

         I have no plan, just some thoughs.

         And I am happy to sharing. I did downlaod many of your ndbx files for learning, and thanks your sharing too.


  3. Support Staff 3 Posted by john on 30 Mar, 2021 06:25 PM

    john's Avatar


    When you say "links of python library", do you mean links to zipped attachments to notes in this forum? I am not aware of any such zip files that are unavailable. Do you mean you can't download them at all, or that you can but they come down corrupted?

    Could you please point me to some specific messages and attachments that you are having trouble with?

    I wish you luck with your efforts to fork NodeBox. It is something that others have suggested over the years. Parts of NodeBox are rather sophisticated, and other parts are outdated, and the basic structure of mostly an older version of Python atop Jython atop Java is a bit unusual these days I think. So it will be a challenge.

    Learning how to make referenceable custom nodes - and sharing that progress - is an excellent project and much needed! Thank you for embarking on that. I am eager to see what else you uncover.


  4. 4 Posted by ahuman on 30 Mar, 2021 07:56 PM

    ahuman's Avatar


           Thanks for sharing some infomation about the Python. I just knew that NodeBox is based on Jython, and didn't know it is based on an older one. Actually I am not familiar with python even Jython, but C#. I will try.
            About the links of python libraries are unavailable, I meant the problem I encountered on downloading from this link , which referred from this page .


  5. Support Staff 5 Posted by john on 30 Mar, 2021 11:22 PM

    john's Avatar

    Hi Aman,

    It looks like that link is old and as far as I could tell the URL is no longer valid.

    But I did some poking around and finally found this working link to PhotoBot source code on GitHub:

    Hope that helps.


  6. Support Staff 6 Posted by john on 02 Apr, 2021 06:19 AM

    john's Avatar


    Thanks again for finding the Python code to lookup all the Nodebox names. I expanded on your idea and produced a custom node that retrieves much more, including the node icon and port info.

    I just posted a demo with a complete Node Catalog here:

    Nice working with you!


  7. 7 Posted by ahuman on 02 Apr, 2021 12:20 PM

    ahuman's Avatar

    Hi, John,
    I just read your python code. This part is a nice demo for me:

    def getNodeIcons(context,nodeName,other):
        library = context.nodeLibrary    
        nodeRepository = library.getNodeRepository()   
        for node in nodes:
            thisNode = node.getName()
            thisCategory = node.getCategory()
            if other == True and thisCategory != 'geometry' and (nodeName == 'reflect' or nodeName == 'sort'): thisNode = 'skip'
            if nodeName == thisNode:
                all = []
                raster = bi.raster
                rType = raster.numDataElements
                w = raster.width
                h = raster.height
                for i in [int(x) for x in range(0, int(h))]:
                    for j in [int(x) for x in range(0, int(w))]:
                        c = bi.raster.getPixel(j,i,[0.0,0.0,0.0,0.0])
                return all
        return 0

    Thanks. And , you improved the appearance showing inner info of NodeBox.

  8. 8 Posted by ahuman on 02 Apr, 2021 01:05 PM

    ahuman's Avatar

              About the python library, I want to look for a image library. But After I read enough python code, I think I can create a pure python code version image node.

            Another thing I am concerning these days are creating a perfect curve which is defined by funtion. What's perfect curve? I mean it's real smooth, scalable, just like the other graphics of particular shapes. When you drawing a function curve by connecting straight lines, it's not perfect. Because the contacting point of any two lines are not smooth.
           I hope to create a node, input a function expression to it and it outputs a smooth function curve.
           I believe we can express any picture just by vector graphics, except the photos. A photo contains many infomation we don't archived. When you design something, you have to give out some enough information to form the vector graphics.

  9. Support Staff 9 Posted by john on 04 Apr, 2021 10:50 PM

    john's Avatar


    I developed a similar fascination with curves in NodeBox some years ago. I think you've seen my make_curve node, which lets you build paths our of cubic beziers instead of polylines. I use it in some of my other nodes, like waveform, that produce perfect curves. My explode node lets you disassemble paths into separate curves and line segments, which you can then work with directly.

    Internally, NodeBox uses cubic beziers (with 2 control points) extensively, so it's odd there no core node to let us make them directly. The quad node produces curves with only one control point (but is represented internally with two!). The ellipse and arc nodes build curves out of cubic curves which can only cover 90 degrees at a time, so it takes four of them to make a circle. Of course its also possible to create higher order curves with even more control points, though in practice two seems to be enough for most things (when joined to form splines).

    As I became more obsessed with using perfect curves instead of imperfect polylines, I started learning more about the mathematics of curves. It is a very deep topic with many still open questions. There are many different kinds of curves, not all of which can be defined by a function.

    After being on this journey for awhile I have recently gained a renewed appreciation for polylines, however. You say curves are perfect and polylines are not; but in fact all curves on computers are turned into polylines sooner or later, whether they are drawn with a plotter or turned into pixels to be displayed on a screen.

    I do agree with you on the primacy of vectors for pretty much everything other than photos. That's why I love NodeBox.


Reply to this discussion

Internal reply

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

Attaching KB article:


Already uploaded files

  • NodeBox_jujOLcgel8.png 109 KB
  • NodeBox_qqca8xWI2v.png 27.4 KB
  • notepad___RCMT5j58X5.png 59.6 KB
  • 187 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


? 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

16 Jun, 2022 05:30 AM
15 Jun, 2022 06:03 AM
06 Jun, 2022 01:07 PM
02 Jun, 2022 11:58 PM
30 May, 2022 07:48 AM


24 May, 2022 06:27 PM
20 May, 2022 04:12 PM
05 May, 2022 02:25 AM
03 May, 2022 04:46 AM
01 May, 2022 09:22 AM
18 Apr, 2022 09:01 PM