Function definition

dynamo
function

#1

Hi,

does any body know how it could be possible to define a function in a code block that gets a variable and return this as a project parameter something like this:

At the moment it’s impossible as you see that the function pps() returns null!!
Thank you!


#2

If you’re not obligated to define functions in DS, check out the Prorubim packages, they have some functionality for this:


#3

but unfortunately I’m reading an excel file. And I noticed as long as the variable you are setting is a number it works perfectly, but in case of a variable between the number and SetVar the variable doesn’t appear in GetVar-List anymore. look at this:

:frowning:


#4

I believe that you haven’t given your function a variable yet. Kinda like a node with no input.
Try changing the second code block to:
pps(1)


#5

#6

Thank you both. I’ll give it a try.


#7

@Dimitar_Venkov Sorry but I just can’t get what you mean. Would you please give me a hint?

Thank you.


#8

I have a similar problem and I tried to give a default value to a parameter of the function.
It works…

but only if the parameter is not a variable.

Is it something not possible or is it a bug?