If statement doesn't look good

Dear guys, kindly help with a following situation:
I use to learn Dynamo software by watching some videos, that made in Dynamo version 2.0.2. I do these lessons in Dynamo 2.19.3. I have uploaded two pictures, on the first picture shown how I expect command “if” to work, on the second picture is what i have)
Any ideas what is wrong there?

If didn’t used to keep list levels and lacing as an input - notice the newer build has > to the right side of the inout, and a lacing icon in the lower right, while the older build has neither of those features.

As a result there was no replication applied, and when mismatching lists lengths were provided you only got the shorter of the two. There are a BUNCH of posts about work-arounds to control that behavior in the older build, but newer ones are much less problematic and so there aren’t many examples of controlling them.

For your case, try setting the list levels for the ‘true’ and ‘false’ inputs, and set the lacing level to shortest.

1 Like

We really just need a ‘smart If’ and ‘dumb If’ node I think. Amazing that such a simple concept is still not working in principle.

If you need, I have an ‘if then else’ node in Crumple package in Python which will literally just give you the true or false branch.

I think the new If node works as both, but people need to learn how to use Dynamo to leverage it first. Sadly this does mean that people trying to learn (such as @ik-tv) need to focus on tutorials for the new builds. The “old learning content not working in new version” is likely going to rear it’s head a lot over he next year if some common packages don’t handle the .net upgrade. Think back on the year or two when everyone was looking to use Lunchbox and Bakery but they stopped being supported.

Sadly this is an out of the box node which makes it both an oddity and a larger issue… @emrullah.yildiz some stuff in here for consideration.

2 Likes

I appreciate the goal of providing nodes that work hand in hand with lacing/levels, but I’d suggest we just have a flip/flop node also which has no lacing/level inputs like the first If node if not already (thought we might have, not at desk to check now - without the list length issue of course).

Most firms I’ve worked at they just rely on Python to ensure predictable If behavior until the IP2/CP3 kicks in.

Bit of a tangent, but I think that the idea of ‘writing a graph once and not planning time to maintain/update it’ and the idea of ‘not having to manage our execution environments’ is some thing to start to move past. IMO both of these philosophies were always a myth - well the former certainly has been since the Dynamo version was tied to the Revit version anyway, and the later was worse before the tie was made… there is an alternative universe all the things that Dynamo, AEC tech and even computation in general aren’t built on a house of cards, and I am extremely jealous of that timeline.

Instead we have this: xkcd: Dependency

2 Likes

100% agree, and having had to start building libraries in Python I can see how important it is to communicate/develop for these lines in the sand. Revit is a uniquely complex beast given it splits a new build off each year to handle so it can only get harder as time goes on without a schema tying them together and handling all the quirks for us (not going to happen, but APS schema shows promise of Autodesk learning from that). I totally understand developers have to make choices and move on when building platforms like Dynamo as well, just in this case figured this is such a common gripe/confusion that providing a simple/predictable approach makes sense.

Will tie into a video I’ve got coming out Monday after next titled ‘Is Dynamo becoming too difficult to manage?’. I’ll spoil that my answer covered across the 30 or so minutes is ‘No, but…’.

On the note of ‘If’, probably the slide that ties into your points:

2 Likes

Definitely. I will be following up the .NET updates and make sure that steps are clear to the community.

Thank you guys for the answers, I really appreciate, that you do support “newbie” questions and spent your time for it. I’m not sure is it corect or not, but what I did:
I used the node “List.GetItemAtIndex” to receive lvl 1 list and avoid receiving other levels. So the result is seems to be good.

1 Like

That looks like it works. Check the results in a simple data set though.

You could also try shortest lacing for the node - that might be a quick fix.

1 Like

+1 for the xkcd link. My favourite cartoon series :smiley:

1 Like

Oh nice, but how I can do it in that case “shortest lacing” for the node. I mean I must use “if” statement anyway?

Lacing is controlled by right clicking on the node body and selecting the desired lacing in the context menu.

You can learn about this key concept here: What's a List - Dynamo

1 Like

When you learn something knew and it works, it makes you happy)
That’s a really the easiest way! Thanks a lot!

2 Likes