But now i have to get this to work with lists and specific list levels
First try/fail:
Vector1ListList = IN[0]
Vector2List = IN[1]
outlist = []
for Vector1List in Vector1ListList:
for Vector1 in Vector1List:
for Vector2 in Vector2List:
almostEqual = Vector1.IsAlmostEqualTo(Vector2,0.01);
outlist.append(almostEqual)
OUT = outlist
# Phython-Standard- und DesignScript-Bibliotheken laden
import sys
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
clr.AddReference('RevitNodes')
import Revit
# Adds ToProtoType, ToRevitType geometry conversion extension methods to objects
clr.ImportExtensions(Revit.GeometryConversion)
# Die Eingaben für diesen Block werden in Form einer Liste in den IN-Variablen gespeichert.
Vector1ListList = IN[0]
Vector2ListList = IN[1]
outlistlistlistlist = []
for Vector1List in Vector1ListList:
outlistlistlist=[]
for Vector2List in Vector2ListList:
outlistlist=[]
for Vector1 in Vector1List:
outlist=[]
for Vector2 in Vector2List:
almostEqual = Vector1.IsAlmostEqualTo(Vector2,0.01);
outlist.append(almostEqual)
outlistlist.append(outlist)
outlistlistlist.append(outlistlist)
outlistlistlistlist.append(outlistlistlist)
OUT = outlistlistlistlist
I’d recommend a different approach without Python if lists are all over the place. Maybe get the X/Y/Z components of the vector, round to nearest factor and you can then compare the vectors in a ‘rounded’ format. This essentially brings them into a limited number of orientations for comparison, even if they are slightly different. Groupbykey is used here to demonstrate the concept, but would not be used for uneven lists. In that case you’d need to run the list across an equals comparison for many vs 1. If you want to check for parallelism as well, I’d run two checks, one for the reversed vector. You can then run the two outcomes across an ‘or’ check to see if either direction is equal.