Learn about modifying and reparameterizing script inputs to test logic and expand usefulness.
- [Instructor] To really use a prototype, to explore the solution landscape, you need to give it a variety of inputs, flexing its capabilities. In this video, we'll walk through the process of testing and setting up inputs to make repetitive testing easier. We can see that the primary design input is a list of flat meshes. To make it easier to see what we're doing, I'm going to turn the rest of the visualization off. And now I'm seeing three input meshes on top of one another.
I know that there's three meshes here because if I hover over the input parameter, I can see the three objects. We can easily add other design configurations as mesh objects for testing by creating geometry in Rhino and adding it in as a param. I've already added an example as internalized geometry in the exercise file. To see it, I'm going to turn off the existing inputs and turn on the new input. Test this input, I'm going to connect it in to the rest of the script, replacing the existing inputs.
To make this easier, I'm going to add a mesh param beginning of the script. Mesh param consolidates the input process. Now I'm going to connect the new input. If I want to see this calculate, I need to go to the right side of the script and turn the visualization on for the 3D Kangaroo output. So, I can see that this design alternative is offering a significantly different solution than the existing design alternatives.
We can easily add this new option in to our input list by baking all the alternatives and reinputting them into our sample input mesh. So, first I'm going to bake the new input. Now I'm going to bake the old input list. I'm going to hide all the inputs. Now I'm going to select all of these mesh objects and input them into the sample input meshes param. Once they're all inputted into the sample input meshes param, I can delete them from the model file, only after I've checked to make sure that I've internalized the data.
Again, internalizing the data stores the objects in the script, rather than in the Rhino model. And I can go back to the model and delete those objects. Now, if I reconnect my list item input, I should be able to toggle through four design alternatives rather than three. I need to Double Click on the input and change the max to three so I can scroll between all four alternatives. I can now remove the new mesh input model from the canvas. Alternatively, you may have a range of continuous alternatives that can be parameterized.
For example, perhaps the area of the catenary shell is set, but different aspect ratios may be considered. You can set up a parametric boundary based on a set area and a varying aspect ratio. First, let's establish the area. We'll get a panel and we'll say we're going to do 50 thousand square feet. Now let's get the square root of that number by going to Math, under Polynomials, Square Root. And we'll use that to calculate the two starting sides. So, we'll get Curve, Primitive, Rectangle, and we'll plug the square root into the X and the Y values.
So, we're generating a square. And we want to be able to vary the aspect ratio. So, let's say we'll vary it from half the square root to one and a half the square root. So, let's go back to Math. We're going to divide the square root by two. Go to Params, Panel, and we'll enter two and connect that to the division component. Now we're going to get a slider from Params, Input, Slider, and we're going to multiply the slider times the square root.
So, Math, Multiplication. We want to vary the side from half the square root to one and a half the square root. So, we're going to add half the square root to this multiplication component, which varies from zero to the square root. This now is going to be the first side of our rectangle. To get the other side of the rectangle, we're going to divide the total area by the first side.
Now we can check this by scrolling back and forth, and we should see a rectangle that varies in aspect ratio. We can confirm the area's calculating correctly by setting an output by going to Surface, Area, inputting the rectangle, and then displaying the area. The output area should always match the input area. For our simulation to make sense, we need this rectangle to be centered in the same location as our other input meshes.
In order to ensure any arbitrary rectangle will be centered, we're going to use the Orient tool to move it from centroid to centroid. We're already calculating the centroid of our rectangle, so now let's calculate another centroid, and we'll use a bounding box around our other inputs. So, we'll go to Surface, Bounding Box, and I'll grab the bounding box of the sample input meshes we already have in the file. I just want one box. So, I'm going to Right Click and change it to Union Box.
We'll get the centroid of that input. And now I'm going to create an orient. So, I'll go to Transform, Orient. I'm going to orient from the first centroid, the second centroid. And the geometry that I'm orienting will be the rectangle. I'm going to hide these other components so I can see if my orient is working. And it looks like as I scroll through the aspect ratio, the rectangle is staying in its proper place.
The last step is to generate a mesh object from the rectangle. So, first I'm going to create a surface using Planar Surface. Then I'm going to convert the surface into a mesh by using Mesh Surface. You can adjust the number of faces in the mesh by going to set the integer values for the U and the V inputs. I'm going to do a 10 by 10 mesh.
Now we can hide this other geometry. I can see that I'm generating a mesh. Now I'm going to move all this new functionality back so it's not overlapping with my existing inputs. And I can plug the new mesh into the existing mesh input. I can test this out by scrolling the aspect ratio slider. I see that I now have smooth control over the aspect ratio of my catenary form.
Let's say we want to have two sliders controlling this form. We want to create a two dimensional fitness landscape. Well, we have another slider in our inputs that we haven't been looking at, the strength of gravity. Let's pull that out and set it up next to our aspect ratio controller. That controls the height of the structure. So, now we have the height of the structure and the aspect ratio of the structure. This changes the prototype dramatically. Instead of generating a discontinuous 2D fitness curve, we can now generate a continuous, or smooth, 3D fitness landscape, the X and the Y axes corresponding to the gravity effect and the aspect ratio.
It's critical to test the script prototype with varied inputs that represent the design alternatives expected to be considered. You can generate inputs in different ways, but it's extremely useful to set up any inputs, regardless of how they're generated, as internal resources in the script that can be selected and flexed in a simple way, making testing as easy as possible.
- Useful prototype examples
- Modifying an existing prototype
- Adding modularity with clusters
- Planning outputs and inputs
- Planning data flow
- Finding and wiring components
- Using and sharing your prototype