I cannot give you an answer
Let me see more
I want the whole graph or at least the inputs (preview and all) with what you feed this node
You make us guess
5 million possibilities
From the error message, it seems that ‘true’ is getting a string value and ‘false’ is getting the list (variable). If this is the case try throwing the data that goes to ‘true’ into a list first.
@Marcel_Rijsmus is right, in order to know for sure we need to see more than just one of the three node that is feeding the “If” node.
List of random numbers some negative other positive, bool list is true for negative numbers, and I want to replace them by empty list for each negative number and keep the others that are positive. List structure as the list of empty shown
The If node cannot handle Empty Lists. Python is your best option, and probably required if you have varying list structure. Otherwise, you can use this workaround:
The issue has to do with list rank and not recognizing the empty list as on object, but a list with no objects. The common workaround of combining lists and getting the list of a specific index ([trueResult,falseResult][test?0:1]) is a way to get around the issue of a single empty list or lists of varying length, but does not iterate properly through sublists. Honestly, the easiest and most straight forward solution is python, but there are ways to make it work with ootb nodes, as I’ve shown.
this my weird solution but it worked, if number is negative convert it to Empty list, but now the problem is that I cannot flatten the list with empty lists haha, any solution for that new issue?
That’s the issue with rank reduction. You can’t replace an item with an empty list while still also keeping your list structure because one is a list and one is an item.
In my first example I create a full list structure of Empty items as the original and the issue was other, if the node IF had the option to set Long Lacing would be possible as well, that can be done with custom package nodes of Crumple for example.
I’m not saying it’s impossible, I’m saying it’s specifically not possible with the If node and other functions that attempt to replace items in a similar way. Dynamo has to assume a rank to iterate over when given a list. It cannot handle both lists (empty or otherwise) and items at the same rank when applying a function. This is why your current solution is forcing your other values into a list (of a singular item).
well I do not care, just want to see results. I got other workaround more stupid than before but I get exact result as needed,I can replace negative number by Null and replace those Null by Empty List:
P.S. I totally agree with @Vikram_Subbaiah , with DesignScript you can do pretty much anything you want, except accessing the Revit API directly. In that case, Python comes to the rescue.
I am curious, with DesignScript, is possible to compress that code with few lines? too many “{ }” symbols. I have not tried the solution given by @Nick_Boyts and it may work in Designscript also