We have a curtain wall facade with smaller elements. We have 6 different families to fit into the elements. We have in dynamo made a randomizer for the different families but we would like not to have two of the same family next to each other (horizontal and vertical). How do we do that?
Please show is your work so far. And maybe a quick graphic of what it is that your wish to achieve.
I’m a new user so it looks like i cannot upload anything
A dropbox-link or drive-link is quite fine
Is there any kind of logic to the placement of the panels prior to your randomization (in the order that they are loaded) so that you that way can distinguish the placement of the panels, as to not get the types next to each other?
Alternatively you can attempt to play with the boundingbox and intersect nodes to try and sort your panels of building 127 to not be next to each other.
Unfortunately I cannot do any testing as I would need the .rvt file with the families loaded
Iterating over each entire selection based off of the previously placed panel and the panel above or below it is an option.
Get all panel types,
Remove the panel type which was placed to the left
Remove the panel type which was placed below
Randomly select one of the remaining panels. Move to the next cell and repeat.
Could be a fun one…
Now I’ve uploadet the revit file in “drev”
Can you elaborate on that?
Likely not today - to say it’s gonna be a long day would be an understatement. Perhaps tomorrow.
This sounded fun so I tried it out. I kind of “brute forced” some things just to get it working so the code could probably be cleaned up and simplified but I think it does what you’re looking for.
import clr clr.AddReference('ProtoGeometry') from Autodesk.DesignScript.Geometry import * clr.AddReference('DSCoreNodes') from DSCore import * dataEnteringNode = IN panels = IN colors = IN panelColors =  rowBelow = panels for row in panels: rowColors =  rowInt =  panelLeft =  p=0 for panel in row: panelBelow = rowBelow[p] adjacent = [panelLeft,panelBelow] ints = [x for x in range(0,len(colors)) if x not in adjacent] rInt = int(Math.Round(Math.Random(-0.5,len(ints)-0.5))) i = ints[rInt] rowInt.append(i) rowColors.append(colors[i]) panelLeft = i p=p+1 panelColors.append(rowColors) rowBelow = rowInt OUT = panelColors
That’s pretty much line for line how I would have done it. Good job @Nick_Boyts!
We tried to upgrade the model with your help but we cannot figure out where the problem is. Should i change anything in the python script or just copy-paste it?
i’ve uploadet the dyn file in google drive.
This should work, though you should start out having the same amount of each “color” as I had to break up your lists to get it to work This also means that some colors are in the wrong “place” as they are handled as a group of another color.
I hope everyone enjoyed this question since I, in the end, do have some responsibility for the question was put up.
At Technical University of Denmark is both Dynamo and Grasshopper in the curriculum for students and from this year have we for some tracks included students within their freshman year and in others from their sophomore year.
The assignment is to give an alternative for sun shading panels on a façade for our Building 127 (http://www.dtu.dk/Nyheder/2012/06/Webnyhed_DTU-bygger-attraktivt-laeringsmiljoe only in Danish)
I have encouraged everyone to participate in the forum and be a part of the community, but I have also tried to state that this is not a “do my job” community. My intention is, that formulating questions and showing their work so far is also learning them something. But I must apologize for those who do not show their work so far, so as @Jonathan.Olesen do, please ask for “work so far” so it doesn’t end up as a gift shop.
Those students who asked this question has not learned Python yet, so very good answer @Nick_Boyts, but I am not sure this is fully understood. Please, @s163762 drop by my office, so we can try to help you understand the answer. Either I or @Jonathan.Olesen or some of the others sitting here in our office/lab can help you.
Ah. I apologize. I didn’t know this was specifically a learning exercise. I usually don’t like to post full solutions anyway, but this felt like something fun to try out. I was expecting multiple solutions from the forum with the hopes of a discussion around the logic. My mistake.
I think your answer was good, so no excuse for that. I should on the other hand excuse for the question was in the ball game of “do my job”
I love the idea the students had, and if you had fun doing it… then I am glad
As a continued learning exercise, rewriting that code in design script would be interesting as we could ‘race’ the two… it’s a great way to learn the concepts and logic as well.
I was actually doing this when I was coming up with a solution… but I find Python just way easier when it comes to looping, so I gave up on the DS solution half way through.