I am pulling my hair out in frustration. I’m trying to nest the logic of vector math in a design script function. I want the input HostTypeString to check if it is “Wall” if so do the vector math and return 1 angle double.
some how it says my input of true does not equal true (or the string wall when I rearrange it to remove the == node block.) and returns more items and sub lists somehow. if I remove the [0] indexing in the function it returns a list of 2 nulls for some reason. Does any one have any ideas on why a function with an if logic returns more list items then items to check for the if statement for?
if(HostTypeString[0] == true)
Your input is a single value of true
but your function is looking for a list with a 0 index value of true
. That’s why it’s failing. This is the same reason your output is two sublists (not sure if that’s on purpose or not).
Thanks for the guess @Nick_Boyts but with out the index call on the HostTypeString i get nulls instead
That’s because the body of your function isn’t working correctly. I’m guessing you have to define your input as a list (unfortunately I don’t know how to do that for DS off the top of my head.) Right now you’re feeding a list (two points) as a singular input, but there’s nothing telling your function to use the entire list as the input, so it’s trying to loop through two values.
I think i get what you saying. Like when you lace with Auto and it sees 2 items in a list so it might jump to longest due to the Auto setting vs shortest
Correct. Easiest thing to do in this scenario would be to use three separate inputs. That way you can feed it the boolean, start point, and end point directly.
the way to mark an input as a list is like this:
def myFunc(aSingleItem:var, alist:var[], aCrazyNestedList: var[]..[] () {}
the var[]..[]
is an arbitrary rank array and it means the function will not replicate over that input, ever.