Custom Node with Variable Inputs/Outputs

Brand new to dynamo and I want to create a custom node for that will cut down on repeated nodes. I’m working through a proof of concept for automating model audits and will use the Springs.ErrorReport.Parse to parse warnings with similar threat levels, using String.Contains + List.FilterByBoolMask to quantify:

This node may only have two searchFor conditions, or it may have many, but the more conditions you add, the more cluttered with crossing wires this becomes.

It is the variability that I’m struggling with. I want static inputs for str, ignoreCase, and list, but I want those little +/- buttons to add inputs AND outputs as necessary. Ideally, all I would need to do is hit “+”; add another Code Block with a new search term (or add another line to a growing Code Block w/ multiple search terms), then connect to another item on the List.Create.

…or maybe you’ve got a way more elegant solution?


hi @rww please see this code:

note that the params modifier on the strings input is converted into a variable input list and gives the node the plus and minus buttons.


@Michael_Kirschner has got the answer, but you are in for a treat. This isn’t exactly the easiest piece of code.

Good luck!

That is impressive. @Michael_Kirschner, I sure hope you just had that in the hopper…which begs the question: isn’t this type of functionality already baked in somewhere? I can’t be the first person to be looking for something like this.

Now my next problem will be mashing this into the needed functionality. This doesn’t look like any of the sample Python code in the primer(s). Would you or @Konrad_K_Sobon be so kind as to give me a few pointers to take this huge block of code and turn it into something useful? :sweat_smile:

I do not know Python at all, but looking at what you’ve posted, I don’t see anything about String.Contains or List.FilterByBoolMask so do I need to take those two functions, turn them into a custom node, then add a Python script, using your code? And place it…where? I’m clearly out of my comfort zone here. Any pointers would be greatly appreciated!

Digging through “How to make a custom node using Python” posts now…


What @Michael_Kirschner has posted is a link to source code for one of the nodes in Dynamo that has Variable Input functionality. Those are the nodes like List.Create or Python Script node that has a little “+” sign for adding more inputs as needed.

However, depending on your coding skills, you might know what to do with the code that Michael posted or not. There is no UI for making these types of nodes. They have to be created via so called VariableInputNode functionality. That’s what I meant by you being in for a treat. Coding these nodes requires more than beginner skills in C# as well as some chops in understanding Dynamo AST functionality. It’s not something that you will just be able to “do”, if you have never coded before. Just saying.

Here’s another example of such node as used in one of my packages called Mandrill:

If this is critical for you, I might recommend that you get some professional programming help. I doubt that anyone around here will want to spend the time, coding one of these for you in their free time. :slight_smile:

I would love to see Dynamo team make it easier to make these, but at the moment they are what they are. Sorry.

1 Like

Thanks for that @Konrad_K_Sobon; no apologies needed. I’ve already grown accustomed to the magic of Dynamo and this amazing community, so I thought there’d be an easy copy/paste or package load and I’d be off to the races. This is neither critical nor something I’m going to attempt right now. My coding skills should be considered zero as far as this is concerned. Perhaps a bookmark and a return trip later.

In the absence of a simple means of coding this, do you have any suggestions for keeping the workspace clean when there is a repetition of functions? This is the sort of thing I’m trying to keep from getting crazy(-er):

I already have 3 or 4 places where I would like to implement some repetition de-cluttering. Now, maybe I’m going about all of that wrong (essentially pulling a bunch of data points from the model and pushing them into different cells in Excel, using your excellent BB Data node) and there are tidier ways to go about it. I guess experience will shine a light on that.

Many thanks again, and I’m sure it won’t be the last time I say that :smile:

@Konrad_K_Sobon atleast for variable input nodes, you should be able to simply use the params keyword on the input and that input will be turned into a set of +/- buttons.

I dont think String.Join has any customization or node model node at all, I think it’s all zero touch.

OMG! I just noticed that. It’s pretty insane. I honestly thought that they all inherited from VariableInputNode, but I guess I was wrong. So why are there two models? Is it stricte that you would inherit from VariableInputNode if you needed to output an AST object like a list? So it’s ok to just use params for things that output basic data types like integer and strings?

You could achieve this almost as elegantly if you use the list.Create node instead and a single input for your custom node. Then all you’d need to do, is make sure that the function in the node unpacks the list as needed.

Definitely not as pretty but it would save you a lot of effort trying to figure out Dynamo’s complicated ui implementation.

soooo…are we still talking about (another) python script in the custom node, or is it a means of using the OOTB nodes cleverly to achieve a similar end? I lost the thread on these last three comments…

Could one of you brilliant folks provide a synopsis for this lowly Acolyte? :sweat_smile:

The bit I posted requires you to write a c# node… or :stuck_out_tongue:

it might actually be possible to do this with python because this is ironPython, but I have never tried… you would need to emit a dll which you can actually do with pyc (iron python compiler) … then you can try importing it… no idea if it will work.

1 Like

Um I had a look at your initial screen again and I have to wonder, why do you need to do that filtering in the first place? My node already gives you each unique error type and the number of errors for each type.

If you want to group the elements by error type, you could just use something like “List.GroupByKey”:


@Michael_Kirschner that ain’t gonna happen! I really appreciate your assistance, but that’s beyond me at this point.

@Dimitar_Venkov specifically here, I’m trying to group warnings by severity/model impact so that I can apply a weighted calculation in Excel to help a model Auditor quickly determine how extensive are the warnings, their types, and their quantity.

Your fantastic node gets me most of the way there, but I don’t see another means of grouping similar warnings or grouping based on their performance impact. Please correct me if I’m mistaken!

As far as I can tell when a node is used multiple times, having at least one input in common, but having a variable, I’ll end up with repetition that can take up a lot of space:

My initial request still boils down to trying to reduce clutter, crossing wires and repetition of nodes…while maintaining the simple node connecting interface. I know I could do huge Node to Code blocks, but I’ll be damned if I can figure out how to update those to add additional inputs when necessary! If I’m missing something, please let me know. With my current ability level, clutter will just have to do, otherwise.

Thank you guys yet again!

Could you post the expected outlook of your excel file? There should definitely be a more efficient way to do this than copy the same nodes repeatedly: