Defining Parameters in Code Block - Design Script Advice

Hi

I’ve been experimenting with trying to pull information from code blocks for commonly used parameters to cut down on lines and extra nodes to visually clean up some scripts

Does anyone know why the examples below one works and the other doesn’t work?

Does anyone have a nice workflow for doing something similar to this?

Thanks in advance :slight_smile:

@Epyns1 ,

i like Parameter-filling by conditions…


for more regular stuff you can use property wizard

KR
Andreas

1 Like

You need to run the function too, not only define it.

image

Or if you want to reuse the function:

image

4 Likes

Do you want to pull the batten depth parameter value from an element, not pull a value repeatedly? Asking as you can’t build a single definition which reads the value of another element in the graph and returns that value later on; it would need to pull the value from an input element each time (ie: move the Element.GetParameterValueByName function into the definition), as X isn’t defined in the context of the definition. Generally speaking it’s best to put the definitions into their own code blocks.

You can however define two actions, one which gets a parameter and writes to a file at a known location, and another which reads that file later on, but this is not very consistent or stable as you need to control execution sequence very carefully.

Hiding the wires from an early function call may be your best bet.

1 Like

Yeah I think you’ve understood what I wanted. I guess its not full possible within the code yet. Ill look at hiding wires that might be the closest approach