Design Script If Statement Not working


I am having trouble with this designscript code. For some reason, this conditional statement isn’t working.

Link to Script below:

Thanks for the help. I am just confused on what to do.

For people who do not want to open the script, here is the original script:

The focus is the codeblock starting with f; g; b; c; at the end.

Your main problem is that you have return = pt; at the end, outside of the Imperative statement. This is saying you want to make a variable return with the value pt, but you do not have a variable named pt so it is waiting for an input (check the input side of the node, it has an empty pt variable).

Your imperative statement already has return inside of it, so you do not need that line. Also d=[Imperative] can be just [Imperative].
The output you want to use is the arrow to the right of the [Imperative] line, that will contain the info you need.

What is the end goal or use case for this? You can probably just use a normal if statement with the boolTest? ifTrue : ifFalse; syntax. For here, it would be:

c < 13? b.Curve.PointAtParameter(b, 0.5) : Line.ByStartPointEndPoint(f, g);

But b.Curve.PointAtParameter is not a valid command, try Curve.PointAtParameter(b,0.5)

The goal of the codeblock is to create a condition when a crv is a certain length, it’ll create a line, or else it will just make a point at a parameter.

So would I just move the return=pt inside the conditional statement.

What is pt? It is not referenced anywhere else in the codeblock so there is no reason for it to be there. Just remove the line like my picture shows and it should work.

It says its working, but when I change variable “c”, it doesn’t create that point on parameter.

See above. Make sure the outputs of your if statement work outside of the if statement first.