If conditional node act differently in Civil 3D 2021 and 2023

My company is about to move from C3D 2021 to C3D 2023 and when I started to compile my dynscript to the new environment I first received errors on the if - nodes so I changed from the older one to the new.
after that I realized that the new If-node don’t gives the same result.
Check the shipped dyn for 2021 and 2023 and 2023 don’t shows correct (at least I think).
At least the node 2021 gives me the result I am looking for :slight_smile: Maybe you can tell me what’s wrong?
Test_TextAlignment_Position_2023.dyn (26.0 KB)
Test_TextAlignment_Position_2019.dyn (22.8 KB)
text_No surface.dwg (3.8 MB)

Can you post screenshots so people don’t have to worry about matching the exact conditions of your script? The If node did change but I don’t think it should be erroring in any cases. In fact from what I remember, the change should have only added “functionality” and not had any effect on existing logic.

Of course, my bad :slight_smile:
As you see in the watch node in the picture for 2023 (the one on top) there is 5 lists with 5 object and in 2019 there is only 5 objects at top level

Regards,
Patrick


I’m assuming everything else is the same but can you show the preview bubbles in the 2019 graph as well? Also the values for the true and false inputs in both graphs, as those are pretty important.

I’m guessing that the old node was actually working “incorrectly” (at least as perceived by many people at the time) and it just happened to work in your case. Now that the node has been fixed to handle list lengths individually you’re getting a different result which, though the intended output, is not what you’re used to.

Hope this help
Maybe it is what you say, I just was lucky…
Test_TextAlignment_Position_2019|690x237

That helps for the 2019 graph. We still need to see the outputs from Text.Position and Text.AlignmentPoint as those would be the controlling factors on the If node’s output.

It the same outputs for 2019 and 2023 but it was really interesting when I tested a code block as test in 2023 and it gave me the same result as the if node in 2019


OK I see now. The old node did not have the same inherent list comprehension that other nodes did which is why it worked on specific list structures only.

Originally, the If node was for a single test with a single output. Five test conditions (booleans) meant five tests and five outputs, so you got five points.

The new node can handle sublists independently based on a single test. So now five tests is handling those lists as individual outputs and returning them five times. You can revert to the old list comprehension by setting all the list levels to @L1 to force one-to-one conditions.

1 Like