Material color randomizer

But those selected elements are all individual parts right? They need to be grouped by location - one sublist per row.

So i am trying to get the x,y, and z coordinates to do the sublist, but dynamo does not seem to be extracting the points.

If they’re not point-based families or systems they won’t have a location point. You’ll probably have to look at the location curves.

So I was able to extract the surface geometry. How do you do a sub-list to have it sort?

You can use Surface.PointAtParameter to get the center point of the surfaces then sort them by location like you were originally attempting to do.

I was able to extract and sort the list by Point.X, but when i plug that information into the python script i am still getting an error. See snip below.

They need to be sorted and grouped. The python script has to know which row each part is in as well so it knows which parts are adjacent above and below. Each row should have its own sublist in the list of parts. This part is going to be tricky because your wall is not at 90 degrees.

Since I am not to savvy at Dynamo and am not sure how to continue I think I am going to abandon this project. Thanks for the help.

You’re so close. You have your parts sorted by X, but you need to first group them by Z.


I use Sort/GroupByKey but you can use Sort/GroupByFunction as well. Once they’re grouped by elevation you need to sort the sublists by X coordinate (using list levels).

I sorted by Z coordinates first then sorted my X coordinates. What I noticed is out of the 63 panels selected only 9 are showing up after the acquiring the Point.X coordinates. I think I got all the inputs correct, but when I run the script I still have the same colors next to each other.




I’m only showing part of my graph there. You’d have to figure out how it fits into what you already have. You’ll also need to sort and group the actual elements the same way otherwise you haven’t actually made any changes when you apply the materials.

Here’s everything working.


2 Likes

Just wanted to say thank you for all of the help. I was able to get the script to work, but still had some issues with some of the panels having the same color next to them. I assume there was something different when I translated the script from the example to project.

If you share your graph and code I can take a look at it.