If node not working as expected

I assume I’m not understanding how an IF node works, although it seems pretty straight-forward.

I am trying to halt the script if a boolean is set to false. The problem is, when set to true, it’s not passing along the data I’d expect.

Without the if in the script, a list is passed to FamilyType.Create and it works fine. When the boolean is true, I’d think that same list would be passed on, but it’s not. Do I have to have something on the false end of the if statement for it to work? I don’t want to give it anything if the boolean is set to false.

Is there a better way to just stop everything like this?

1 Like

Do a search for “list.Empty” and input that into false, this should make the graph run past this node.

You are missing ““False”” Value.

1 Like

Yeah, I figured it must be the missing false value. List.Empty did the trick. Thanks!

you could also use a code block, this way you dont need an empty list as false input. I could write one for you if that helps.

(Every node that you place needs to have all the inputs in the front connected, otherwise it will be light grey and your only output will be: “Function”.)

This is actually still not working. If I have the if block in place, the new types are not created whether the bool is set to true or not. If I bypass the if block, it works fine. I no longer get errors on the FamilyType.Create when using the List.Empty, but it doesn’t seem to do anything.

You could try this:

my code:
A;
B;
C = [Imperative]
{
if(A==true) {return B;
}
};

you check below link :point_down:

What error and data structure are you getting out of the other nodes around. And check if the families have already been created because that will give you a error

Also while i remember change the “If” node to a “ScopeIf” node, and give that a try.

For whatever reason, when using @Daan’s code, the script runs whether the bool is set to true or not.

@Brendan_Cassidy
I have the RFA file open as I’m testing. I can see when it does or doesn’t create the types. The only error I’m getting right now is in another if scenario where I’m building the type names. (Another example of where I want an if to either run THIS node or THAT node and not just pass on the output of one of those nodes. I don’t want one node to run at all if a condition isn’t true. Seems hard to do with if statements. - But I don’t want to splinter this thread with that conundrum).

My code should only output when your “Proceed” boolean value is set to true, i have no if statement created for false.

Yeah, exactly why I’m confused! :smiley:

I’m pretty well-versed in php and jscript, so I know my way around conditional logic in other languages. I have no idea why this thing is running regardless.

Tried the ScopeIf and now I think it’s crashed. Says “Run started…” and won’t finish. :smiley:

What version of dynamo / revit are you using? I am using Revit 2019.2.2 and Dynamo 2.0.3.

And maybe you could also post your dyn.file in this thread. (or a part of it)

Using the same versions. Gladly posting the dyn. Let me know if I can fix that if statement in the “Create Type Title from Number and Note” group.

If you guys have any suggestions on how to improve this, I’m all ears.

AP_Note Blocks_ZMASTER_Import from Excel.dyn (91.0 KB)

What package are you using? I am getting unresolved errors.

Oh, sorry. Orchid is probably the one you’re missing.

Hey i am not really familiar with the Orchid package and my dynamo keeps crashing whilst using that package.

I have made a simple boolean filter which should work just fine:

21-10-2019 Dynamo File TheMattatonAP.dyn (8.3 KB)

1 Like

But i think the problem lies not with the if statements used, they shouldnt alter the information which was input. I think your orchid package is just doing something weird.

HA! I had just screwed up when using your block, @Daan. I was hooking the value of B to the next node instead of C. :smiley:

That bit works now. Any suggestions on a better way to handle the " Create Type Title from Number and Note" portion of the script?
I want to pass the string on if it is less than 30 characters, if not, I want to do a substring limited to 30 characters. I get an error on the substring node because I am running it even if I’m not using its output. When the string is shorter than 30 it throws a warning.

Haha, i will look into that later tonight.

1 Like