From the course: Paneling with Dynamo for Revit

Alignment condition - Dynamo Studio Tutorial

From the course: Paneling with Dynamo for Revit

Start my 1-month free trial

Alignment condition

- [Instructor] In this video we'll consider how to construct a paneling scheme that meets a certain criteria, specifically an alignment condition of a mullion on the inside. We'll take this surface as an example. We'll specify the number of panels in the x direction and in the y direction, and we'll construct a paneling scheme such that one of the mullion divisions lines up with this sliding condition which we're representing here by an arrow. This is important because in construction often times panel divisions must line up with structural members, expansion joints, door frames, or any other aesthetic choice. We'll start by figuring out how many panels belong on each side of the arrow. Let's start with the left side and a bit of math. We need to know what percentage of the surface is on the left side of the arrow. So, we use a code block, and I'll mark what I'm doing. I'll say, the left length, and that is, call it left, is equal to wherever that division point is. I'll call it div, minus the left edge. And these are gunna be numbers. The division point is the x value represented by the slider underneath the word alignment criteria. That's div. The left edge is given in the initial conditions also. It's at the coordinate number five. What we can tell is, right now, the distance between the alignment and the left edge is 7.7, and we would like to know what percentage of the total distance that is. I hope you'll forgive me for doing some of the math in a code block. But I also find that's sometimes easier to read and sometimes easier to write out what your intention is. You can also do the same thing in nodes. I would like to find the left percent of the surface not just the length. And to do that we'll take the length of the left side, that's left because we just found it, and we'll divide by the total length of the surface. And that's going to be the coordinate at the right edge minus the coordinate at the left edge. Depending on the project there may be different means by which you would find these pieces of information, but because that isn't the goal here, I've just provided the numbers. Now we can tell that the alignment condition is about a quarter away from the left side of the surface. We should translate that into the approximate number of panels that are required. So I can take this, and I'll search for a multiplication node with the asterisk. Multiply that percentage by the total number of panels we would like on the left side, so x. And we get 2.56 according to the values that are currently represented. Now we don't want a fraction of the panel, so what we'll do is we'll round this number with math dot round. The nice part about rounding is that if it's close to any one particular integer, so if it's close to three or if it's close to two, then it'll push that number in that direction. One potential problem with this is that if it rounds down to zero, and of course we need at least on panel on the left side. So to accommodate that we'll ask, is this number less than one? And if it is use at least one. We can do that a couple of different ways. The first is by nodes. So you can right click and ask is something less than something else. Is this number less than one? And this is a true or false, in this case false. Now we can apply that condition to something actionable with an if node. The test is the true or false, and then the input that says true is what should happen in the case that the condition is true? The false is, what should happen in the case the condition is false? If it's true that the number of panels left of the arrow is smaller than one, then we should make sure that we use at least one. So I'll use one for true. If it's false that the number of panels to the left side of the arrow is not less than one, then we should use whatever number we have in which case math dot round. The result should be, in our case we started with three, we asked is three less than one? No three is not less than one, so keep three. Another way to do this if you like code block syntax would be to say, is the number less than one question mark. If so, make it one, colon, otherwise make it the number. This looks like crazy talk to somebody who isn't familiar with this particular syntax, but in case you are you can always to that too. But nodes work just fine, and I won't judge you. Now we can find out how many panels we need on the right. So, we just take the total panels and subtract the number of panels on the left. It's worth marking with a node, control w to write, right number of panels and left number of panels. I'll group these nodes and say, number of panels on each side. Now we need to use this information to construct series of x coordinates where we'll place vertical oriented planes that will slice this surface and tell us where the divisions between the panels are. So there's a little bit of math here too. And to help make it simpler we can use series syntax. We'll start with the left side. I'd like to use a series that let's us specify a start value, a certain number of values, and step value. So then it would be start, dot dot, num, dot dot, step. Our start value is the left edge which we know because it's given. We also know now how many panels on the left side we need. Let's call it left num. Finally we need a step value, so I'll call it left step. If we click outside of the code block now we can fill in some of the missing values. The left edge comes from what's given. The left number of panels comes from something we just found. And then finally the left step. We don't have this yet, we haven't found it. So let's find it from other things that we do know. So before this part in the code block I'll say, we're gunna find the left step, I'm gunna say left step equals. So if you think about it, the step value between the divisions on the left side should be the length of the left side divided by the total number of panels on that side. And we can find that by the division point minus the left edge, all divided by the total number of panels, left num. The only thing now we need is where the division point is. Let's see how we did. Starts at five, and seven, then 10, and our division point right now is listed at 12.7, that looks pretty good. Then notice that this series does not include the division point. I did that very much on purpose, because we don't want to double count it. And indeed for the right series, now we need to include the division, so I'll say, this is the right series, and that will use a different syntax which should be start from the division point. And notice auto complete may happen when you're typing in the code block. When you site div the code block would like to complete that with something else. To get rid of this and keep typing just press escape one time. Dot dot, all the way to the right edge which we also know, dot dot pound sign, to basically divide this interval evenly into the right number, plus one, because now we have an extra spot for another panel. The right edge is given. And finally the right number we found before. Now the preview for a code block only shows you the output for the last lines, so it's not like our information from before went away. Instead we need to find it and join it together with our new list. New list dot join. The first and then the second lists. This is the list we're ultimately after. Note that it includes the first item as the left edge five. The last item is the right edge 35. And somewhere along the line we had exactly that 12.7 which is what shows up on the slider all the way to the left. Now we need to create vertical planes, so we'll say plane dot by origin normal. Now the normal by default is the Z axis. This is pointing up, but we'd actually like a vertical plane so we need a normal that's pointing to the right. So we'll use the vector dot x axis. Let's reorient that plane, good. And we just need to translate these numbers into origin points for the plane. We can do that simply with point dot by coordinates, because these are the x values of those points. Passing those points into the origin points, we now have a series of vertical planes that are organized in such a way as to cut the surface where we want it. As when you're making families in Revit, it's always a good idea to flex the definition to make sure it's doing what you want. As I move the arrow backwards and forwards we always have a plane there, and the number of planes on either side adjust accordingly. For the horizontal condition we're not using any sort of special criteria for an alignment, and this is a flat surface so we can take a shortcut and use the parameter space of the surface itself to evenly divide it. We can use get isoline on that surface together with a horizontal orientation. We use the number one to change that direction, and then a series of parameters. This will be a series in the range between zero and one like always in the parameter space of a surface. And the pound sign, how many divisions we want. So we want the number of panels in the y direction, I'll say num y, plus one, because we're looking for the corner points. That came from a slider. We should see as the result something that starts at zero and ends at one and has a certain number of divisions that are evenly spaced. There are the divisions between our panels in the horizontal direction. I'll mark that group and say horizontal isolines. Now all that remains is to find the inner section between the vertical planes which I'll mark also with a group, and the horizontal isolines. One reason to use vertical planes and not vertical lines on the surface is because we can use the geometry dot intersect node and more or less guarantee that we find an intersection between the plane and the curve. Sometimes the way a computer may think about geometry introduces small deviations in the numbers, and different curves, even though logically they should cross each other, may not cross each other in the computer's understanding. So we'll take all these isolines and intersect them with all the planes. And note that we first see a diagonal line of points show up. This is because of a lacing problem. We have a certain number of isolines in the horizontal direction, and a certain number of vertical planes, and we would like to make sure that we look for the intersections between each of the horizontal lines and all of the vertical planes. So I'll right click on geometry dot intersect and choose lacing cross product. Now we have a little bit of list clean up to do. Geometry dot intersect always, always returns a list. In fact you can tell that that's the case, because the output says geometry and then has these two square brackets which is actually Dynamo's notation for a list. Because any curve could certainly intersect any plane multiple times. We don't need that type of specificity, so what we'll do is use the flatten node and have it operate not on the full list. We don't want to get rid of all the list structure, just the part that we don't need. So we use the flatten node at level three. The result is a two dimensional point grid which we can then translate into quadrilateral sets per panel. I'll use the node point grid to quad sets from the ampersand package. Now we have a set of four points per panel, and we can visualize the results. We'll use point list dot visualize panels from the ampersand package. The blotchy pattern you see is something called Z fighting which means that we need to go back and turn off the surface that's being previewed at the same place as the colored panels. If we check our work, we can see that, according to the alignment criteria as we change it, the panels should update accordingly. So we've looked at one way to account for design criteria that would require panels to be aligned in a certain place. We've done this in a vertical sense on a flat wall, but of course the same type of logic can be applied to curvy surfaces or other design criteria. And you can apply this same logic to one project in more than one way.

Contents