Color override for list of elements on list of views

I started going down a rabbit hole when I couldn’t find packaged nodes that can do the following:

My EE wants a set of PDFs with smoke dampers and fire/smoke dampers indicated. I intend to do this by identifying all Duct Accessories elements with the family name containing “Smoke” on my duct plans. I’ve managed to get to two lists: (1) containing a list of 31 views on sheets containing these prescribed dampers and (1) list of 31 sublists of elements that require the color override. The longest lacing would do the trick here (E.g. item 5 on the first list contains all the elements of sublist 5 on the second list). I want to change the color of all of items on the sublist on the corresponding view. See the image below:
image

I tried a Python script laid out by @Konrad_K_Sobon in this post:

I get an error that the List[object] does not have an Id. I find @Nick_Boyts post identifying the root of the issue: 'List[Object]' has no attribute 'Id' - #41 by Nick_Boyts

Unfortunately, my Python prowess is next to nil. Can you help clear up my Python illiteracy?

Have to wonder… would it be better to use a filter here instead of a manual override in each view? The former can quickly be removed by a non-Dynamo user, while the later requires selection of each of the 197 elements in the view to disable.

In any case, that error message means that you’re iterating over the list of lists, but not the list of elements.

Your element data looks like this [ [ thing1, thing2 ], [ thing3, thing4 ] ] and the Python code to override the display of [ thing1, thing2 ] instead of thing1, then proceeding to thing2.

To get the code to iterate over thing1 and thing2, and then proceed to iterate over thing3 and thing4 you will need to add a nested loop inside of the current loop for the [ thing 1, thing2 ] loop. This isn’t too hard, and can be accomplished with another for statement, or with list comprehension.

I am typing these directly in my browser, so there may be a typo or two, but the structure should get you started. Change the current ForLoop

For Statement:

for objectList, view in zip(in[0], in[3]):
   for object in objectList:
      output.append(OverrideColorPattern(object, c, IN[2], view))

and with List Comprehension:

for objectList, j in zip(in[0], in[3]):
   [ output.append(OverrideColorPattern(object, c, IN[2], view)) for object in objectList ]
1 Like

Hi,

If you absolutely want color overrides in a list of views, you can use the View SetElementOverrides node of the Genius Loci package.
To use with the Create OverrideGraphicSettings node of the same package.

1 Like

I tried applying a filter based on common criteria, and I’ve tried the line color override, and nothing happened. When I tried a manual override of an individual element, it worked as expected. I don’t know what to make of it. I figured I’d start putting together a graph, then I hit this wall. I’m going to make updates the script based on your suggestion.

1 Like

If you get stuck post a sample RVT and DYN and the larger community will do what we can to square you away. :slight_smile:

After some butchering of the script, I implemented the updated “for” statement and got what I was looking for. My “introduction to variables and types” instruction for Python was being tested. Thanks for your help, @jacob.small and @Alban_de_Chasteigner

1 Like