List Process, list map in python

Tomasz,

The ProcessList() method takes care of zipping the two arguments from lists. You don’t have to perform that inside your Intersection() method. Basically change it to:

def Intersection(elA, elB):
    return elA.DoesIntersect(elB) 

Then call it like so:

OUT = ProcessList(Intersection, ducts, walls)

Make sure that the two lists ducts and walls are exactly of the same structure. It works like this:

ducts = [duct1, duct2, duct3]
walls = [wall1, wall2, wall3]

Calling ProcessList(Intersection, ducts, walls) would result in a list [bool, bool, bool] where bool is a true/false if duct1 intersected wall1, duct2 intersected wall2 and duct3 intersected wall3.

It WILL NOT run duct1 against ALL walls, just pair them up. That’s how Zip() works.

1 Like