How to retrieve information from a python block

Hi,

I have a small concern about making a Python node.
I can not get the list out of the program. I obtain only an “Empty List”…

However, this is very simple block of code, it intended to create a list from the conditions imposed by two separate lists.

Code Below :

#2018/01/03
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
# Import méthode extension
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)

#Entry
A = IN [0]
B = IN [1]
C = IN [2]

#Definition
i=0
j=0
x=0
imax=len(A)
jmax=len(C)

l = []

#Creation
for j in range(jmax):
    for i in range(imax):
        if C[j]==A[i]:
            C[j]=B[j]
            break

#Exit
OUT = l

Thank you !

A French guy

Hi @Blond,

I can’t quite figure out what you are trying to do, but your output in an empty list (l).

The values you want out of the python script, you need to append to the outlist, by using the append() method.

Good luck :slight_smile:

Hi martin,

thank you for your reply.

I tested with the append method and I get to the same problem.

I have the impression that the list (l) is not modified…
May be an computer reason (pointer) ?

:

Sacrebleu

Can you post your dyn file so we don’t have to recreate the code?

I try but it seem impossible for new user on this forum.

Sorry

ah. Can you post them to a dropbox, google drive, or other file share service? Even if you could just post the formatted python code (use the </> button in the toolbar of the reply composition box) it helps us help you. :slight_smile:

Okay !
No problem

Python Code below :

#2018/01/03
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
# Import méthode extension
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)

#Entry 
A = IN [0]
B = IN [1]
C = IN [2]


i=0
j=0
imax=len(A)
jmax=len(C)


l = []

for j in range(jmax):
    for i in range(imax):
        if C[j]==A[i]:
            C[j]=B[j]
            break

#Exit
OUT = l

@Blond
Just write there what is result list you want to see?

In this case, I’d like to get a list containing {30,30,30,30}.
And no an empty list.

The fact that the OUT doesn’t return anything is a mystery for me…

lst=[]
for i in zip(IN[0],IN[1]):
	for x in IN[2]:
		if i[0]==x:
			lst.append(i[1])	

OUT=lst
3 Likes

Awesome. Thank you.