DesignScript conditional statement

why it returns empty list instead of point?

Hi @Ning_Zhou ,

I’ve encountered this behavior in the past aswel when trying to work with empty lists. What I did was to create the if-statement in a python node instead.

Lacing with historic design script If statements means that the shortest value will always be returned. As your have an empty list in the returned values, the return the empty list will always be returned.

As a fix:

origin = Point.Origin();
empty = List.IsEmpty(bbs);
indx = empty ? 1 : 0;
result = [bbs, origin][indx];

right, Python is more water-proof, thanks Daan

works great! thanks Jacob, well, not a fan of DesignScript

Because the rank of the players involved aren’t consistent
While empty and origin aren’t lists, BoundingBox.MinPoint is a single element list
You can resolve that like this …

origin = Point.Origin();
empty = List.IsEmpty (bbs);
min = empty ? origin : List.FirstItem(BoundingBox.MinPoint(bbs));
1 Like