Absolute Dynamo nube here, but I’m trying to bend my brain around this. I’m sure it’s easier than I’m making it, but I don’t know what I don’t know.
I need to compare two lists (“Rough Width” and “Width”) and create a new list of values based on highest value from each, then use that new list to govern the “Width” of my newly placed family instance. The lists will always have the same number of responses, so my thought was to have a Python script compare line by line and return the greater value but I think I’m running into an issue with some of the values since they have an extensive decimal extension. Maybe? I dunno, I’m guessing…
The ultimate goal is to place a family instance in Revit at each door/window opening that matches the width of the overall opening. Since some families use a governing parameter of “Width” and some use “Rough Width”, I need to accommodate for both. My script works great for one or the other but not both. The value field for “Rough Width” is empty if it is not governing, which means I need the script to default to the “Width” value.
Here is a screen shot of what I currently have and the error I’m getting for my Python script:
Join the two lists into one with a List.Create node. Then use a List.Transpose node to get value pairs, and finally use a List.MaximumItem with level set to @L2 in order to get the larger of the two values.
You would provide the Rough Width and Width as the variables a and b and the result would be the higher value. You would then pass on that value to the instance as the new Width.
You changed the list structure with AllIndicesOf (it returns a list).
You can use something like ReplaceByCondition (which would require you to address both null and empty conditions separately) or use another nested conditional statement for values equal to null or empty ("").
Thank you! I tried it and it still seemed to return only the highest values, not the highest value per line, but I will store the information that I can specify the level like that.
That does work but you’re better off just not adding the extra level to begin with. Instead, convert your non-numeric values to 0 with a conditional statement.
List.MaximumItem node with the list input set to @L2 to start. This will get the largest area from each sublist.
List.SetDifference with the list of sublists for list A and the individual maximum values as list B. Set list A to @L2 and list B to @L1.
If you want to remove the surface, not the area from the list use a List.MaximumItemByKey node set to @L2 for the list input and with a key input of the Surface.Area node with nothing wired into it. That becomes the list B input in the List.SetDifference node.
If you can’t make that work please start a new topic so we don’t get deviations in conflicting solutions. Be sure to include a dyn and relevant source data.