Computational Logic Part 1 – June 15, 2015 In this lesson we will look at how to create a computational attractor system using environmental data from Revit using Dynamo. As you can see in the background 3d preview of my workspace, the orientation of different panels are changing as my sun path in Revit updates. To get started I am going to close Dynamo and my current Revit document to return to the Revit browser window. Since we will be using the sun path system it is important to note that we will need to create a new project file. I'll turn on my sun path by clicking on the sun icon located at the bottom left corner of the Revit viewport. The sun path is a visual representation of the suns range of movement across the sky at geographic location you specify for a project. Using the sun paths on-screen controls the sun can be positioned to any point along its daily path. You may also modify the sun settings by clicking the manage-settings-sun settings and clicking on sun settings. Click any of the presets and select OK to confirm. Browsing to the add-ins tab I will click on the Dynamo plugin. To get started I am going to locate the “number” node. I will use this to quickly define the sequence of X and Y coordinates of a point. To define the sequence I will use a start value “0”, variable for my count let's call this X “count”, and a variable for my increment, I will call this “spacing”. Notice that the inputs are created on the fly as variables that are used in our number string. Copy and paste the number node and change the X count variable to Y count. From the search field in the node browser I will add a “double” slider and two “integer” sliders to my workspace. Rename the “integer” sliders X count and Y count so that it is easier to identify their associated use later. To do this right click on the “integer” slider and select rename node. I will repeat this process for the “double” slider giving it a new name, “spacing”. Connect the output ports of each slider to their corresponding input ports. Next, I will add a point by XY coordinates to the workspace. I will do this by browsing to geometrypoint-create. I will choose the “point-by-coordinate” specifying X and Y. Let's connect the output of our “number” nodes to the X and Y input ports our “point-by-ordinance”. Remember that you may use ctrl+G to navigate the background 3d preview. Pressing ctrl+G once more will return to the definition. Lowering my spacing value to a value of 3, I can now see my sequence points. I would like for my points be structured as a grid so I will right click on the “point-by-coordinate” node and change its lacing to “cross product”. Changes made to either the X or Y count will now be displayed automatically. I will use this collection of points to define the center point of a circle. Browsing to geometry-circle-create I will add a “circle-by-center-point-radius-normal”. This node provides an easy way to orient the circle using a directional constraint. Let's connect the output of our “point-by-coordinate” to the center point and add a “number” node to define the radius of our circle. To define the orientation of the circle I will browse to geometry-factor-create. I will use the Z-axis to define the world up. Although I was successful in creating my great circles, the ultimate goal is to create a field of diamonds. In this case the “circle-by-center-point-radius-normal” is really just an intermediary geometry that I will use to circumscribe a polygon. Browsing up to polygon, I will create a “regular-polygon”. “Regularpolygon” requires a circle input and a number of sides to define. I will use a “number” node to define four sides. To manage what is seen in the background 3d preview I will right click on my “circle-by-center-pointradius-normal” node and turn its preview off. Navigating the background 3d preview of my workspace I can see that my polygon preview has gaps. I would like to fill the gaps with additional polygons to form a continuous field of geometry. Using ctrl+G I will return to my definition and try to determine how to best accomplish this. To create a continuous grid of polygons I will need to create a second grid of offset points and add them to my list “center points”. Let’s start by selecting first few nodes in our definition and moving them over. I will copy my “number” nodes and my “point-by-coordinate” and paste them. Notice that in order to be able to define an offset grid of points I need to first understand that my “spacing” is establishing the distance between each point. In order to create a new point offset in I will need to be able to establish a relationship between the “spacing” and the “points”. I will disconnect the input ports of both my copy “number” nodes and make a slight modification to my number string. I will add the variable “offset” to replace the start point of my sequence. I will do this for both the sequence that defines my X coordinates and my Y coordinates of my point. With this new port created reconnect the corresponding “count” and “spacing” sliders. To define the offset amount I will need to multiply the “spacing” value by 0.5. This will ensure that our second grid of points is offset by a value related to the global grid spacing. The multiply node is located in the “operators” category of the node library. Using a “number” node I will define a value of 0.5. I will now multiply the spacing output by 0.5 and connect this to the offset in both the X and Y sequence. Once this is connected you will see that there is a new sequence of points. Make sure at the bottom right hand corner of our new point by coordinate node the lacing icon indicates that the “cross product” is selected. If it is not, right click on the “point-by-coordinate” node and change its lacing functionality to “cross product”. We will now see that by selecting either the offset grid or the original grid the background of our workspace will show the current selection. Right clicking on either of these point nodes and turning the preview on and off will also make changes to the workspace. Now that we have two grids of points we can create a new list merging them together. This will allow us to send both sequences to the circle node simultaneously. I will disconnect the input port of the center point and search for the list create node. The plus or minus icons on the list create node allow you to create additional input ports connecting the output of our “point-by-coordinate” node into index 0 and then index 1. We will create a new list composed of both sets of points. We can now connect the output of this list to the center point input port of our “circle-by-center-point-radius-normal”. This basic definition automates the task of creating a grid of diamonds. Navigating the background 3d preview we can see that making changes to any of our number bodies will result in a new solution. In this case I have now triangles or quads and I can modify their “spacing”. Additionally I can make changes to the number of panels in both the X and Y directions. I would now like to replace the constant Z direction in this definition with a more dynamic input. Searching for sun path I'll see that Dynamo has a node to select the Revit sun and return its direction. Click to add this node to the current workspace. Pressing the use sun path from current view button we can see that dynamo has loaded the sun path information from Revit. (may need modification) Let's use the “sun-path-direction” to define the normal direction of the circle node. I will do this by replacing the vector Z-axis with my “sun-path-direction”. I will also connect the output port of the “regular-polygon” node to a “surface-patch” node to more clearly represent the oriented panels. Browsing to geometry-surface-create I will click on “by patch” to add this node to the workspace. Let's connect the output of the “regular-polygon” to closed curve. Navigate the background 3d preview I can now see my panels more clearly. To thicken the panels I will add a “surface-thicken” node. From surface I will open up the sub category “actions” and browse to “thicken”. I will connect the output port of my “surface-by-patch” node to the input surface of “surface-thicken”. Using a “number” node I will modify the amount that the surface is thickening. In this example I will use a value of .1 to define the thickness of the panel. now that I can clearly see my panels I will zoom out my workspace 3d preview, return to my definition, and increase the count and both X and Y. Additionally, I will resize my dynamo window so I can see both Revit and Dynamo simultaneously. Collapsing my library I will have a little more screen real estate in dynamo to see the updates that I'm about to make. In Revit, I will modify the sun settings by clicking on the view control bar and selecting sun settings. Clicking on the various presets I will hit OK and see the changes computed in the background 3d preview of Dynamo. I will repeat that process once more, this time by browsing to the manage tab – settings – and sun settings. Let's change the position of the sun so it corresponds to the summer solstice. I hit okay and once again we will see these updates live in Dynamo. This will allow me to quickly understand the impact of the suns position on my array of panels.