Custom Node Input Value Range

I haven’t found too many references about the custom node input setting. Is it possible to set upper and lower number limits like integer slider on the Input node? or I should add if . . else node inside the custom node to filter out the input values beyond the limits?

hi @Joseph_C_Lee

If you are not going to do your custom node in via Dynamo’s custom UI node development, you will always filter the inputs to your bounds/limits. You will have to use IF (or equivalent logic/method) statements either you make nodes via python script, zero touch node development or custom node through OOTB.

-biboy

1 Like

I can add a Python node on each of the input.

1 Like

hi @Joseph_C_Lee

you can use this script: input_bounds.dyn (22.6 KB)

it can also check if your input is also a list,
check this:

python code:

input = IN[0]
output = None

minValue = IN[1]
maxValue = IN[2]

if isinstance(input, list):
	output = list()
	
	for a in input:
		if a < minValue:
			output.append(minValue)			
		elif a > maxValue:
			output.append(maxValue)		
		else:	
			output.append(a)
		

else:
	if input < minValue:
		output = minValue		
	elif input > maxValue:
		output = maxValue	
	else:	
		output = input


OUT = output

-biboy

1 Like

Let me try this script. It looks more professional coding than my version.