Hello,
i wanna merge 2 lists based a condtion x == 0 ? y : x
But for any reson it does not work, what can i do?
KR
Andreas
Hello,
i wanna merge 2 lists based a condtion x == 0 ? y : x
But for any reson it does not work, what can i do?
KR
Andreas
Can you show us the output? Right now you’re showing just the input y
.
The preview of a code block only shows the last line. Right now your last line is just y;
so you’re essentially just returning the input again. Your condition may already be working correctly, you just aren’t looking at it.
Change your code block to just this:
x >= 0.0 ? y : x;
it does not work…
is there a pythonway ?
#if 0 take Item from List2 else remain in List1
Are you sure both inputs are numbers?
The python you have should work but you’re only checking for ==
and not >=
.
all clean doubles
What does your python error say? It looks like you haven’t zipped your inputs.
for i,x in zip(IN[0],IN[1]):
And that goes for both inputs?
i used these nodes, for any reason i had “empty values” as string… right no they are clean!
KR
Andreas
in python works!
# Phython-Standard- und DesignScript-Bibliotheken laden
import sys
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
# Die Eingaben fĂĽr diesen Block werden in Form einer Liste in den IN-Variablen gespeichert.
dataEnteringNode = IN
# Code unterhalb dieser Linie platzieren
lis1 = IN[0]
lis2 = IN[1]
output = []
for i,x in zip(lis1,lis2):
if i == 0:
output.append(x)
else:
output.append(i)
OUT = output
@staylor ,
yes you i right… for any reason in this variation it works…