I’m trying to get a return value for multiple lists (within a list?) for an IF statement.
So i’m i’m doing is:
Making a script to pull in text from CAD into revit (turn that text into revit text).
Works awesome EXCEPT i can’t get it to select different size text as per what is in CAD.
So i am using the CADtext Height node to pull that info out and am doing a TRUE FALSE of the list depending on whether it is above or below a certain height.
After doing so i’m asking it to IF it is above this size and TRUE then use this Text.
Or IF below this size and TRUE then use this Text.
For some reason i can’t get the IF node to do longest lacing which i assume is the issue? I dont’ know why it is only giving me a single list return as opposed to the 5 that i start with.
Any help is appreciated.
Here is the current state of the script.
Thank you for the help and advice.
Can you repost the pic with previews turned on so we can see what you’re working with? You probably need to adjust your list structure and match lengths.
Hello @Nick_Boyts, do you mean the those little pins at the bottom of the nodes? i tried to take a pic of the preview (in dynamo) but it just shows the location of the points and not the text.
Yes. We need to see (at the very least) what you’re using as inputs for the IF node. We can’t really tell you what’s going on if we can’t see what you’re doing.
did the second image i posted show what you mean? i can add a watch node and maybe get more results to show but really all there is the first of 5 lists showing in the IF node. In the > boolean node i have well over 4000 results and 5 lists, but the IF node only returns the first one of those list and ignores the rest
We need to see the inputs your providing (still needing both
GetItemAtIndex nodes). We don’t need to see everything in the list, just the list structure.
oops, i forgot to turn those on. Those are the textnotestyle that are in revit that i am using.
So the Get at index is to make sure it selects the proper text style i need to use for that specific height. 1/8" or 3/32" depending on whether it is above or below that threshold. I don’t know if there is a better way to do so.
OK so there’s your problem. You have a multiple sublists of booleans but are providing a single sublist of text types. Your list structures match (list of sublists) but your lengths don’t. Try reducing the list of text types to a single object OR duplicate it to match the list length of your booleans.
ok. so create new lists of the same so there are a equal number of list of the text… ok i think i got it, i’m going to try it. ill be right back
In your case, since you’re only providing one true object and one false object, it would be a lot easier to get rid of the lists. But either should do the trick.
i’m sorry, i don’t actually think i got it…
should i do a list.create and create 5 sub list of the same textnotestyle?
or should i flatten the boolean list (with 4000+ results) to just a single string list (L1 L2 vs L1 L2 L3)?
In your case it would be easier to reduce each input to a single item (rather than a list of a single item).
You can also duplicate the input lists to match the length of each bool sublist. This is what you would have to do if each sublist had different true/false values. Since they all use the same text type it’s a little redundant.
You sir are awesome. Thank you for your help, it works just like you showed. I will come back with a final picture to show what i did as soon as i can, but essentially i followed your above picture. Thanks @Nick_Boyts