Transcript
Transcript
In this lesson, we will walk through the optional test problem for the automation course, which asks you to create a custom block that creates a line of spheres along the z-axis based on the given inputs we defined. So that is the start location for the spheres, the count (how many spheres we’ll have), the increment, and the radius.In order to create this, you might have a different way of creating this. There are many ways to create the same thing in nTop, or a similar workflow in nTop. But the way that I’ll walk through is: we have our Sphere block, and the radius is just the radius we defined in the input. And our Center Point is where we use a Sequence to create how many spheres we want in this line of spheres.So our X and our Y location is just that start location dot X. So it’ll always be at that X location with that Y. And then Z is where we put in our sequence to create 10 of those spheres. In the Sequence block, our starting location is that start location dot Z. That’s where that first sphere is located. And then we have that increment of 5 mm. So our Center Points are 5 mm apart. And our count, so how many spheres we’re creating, is 10. So this is our custom block. We have our inputs and our output is just those final spheres.So that was step one, saving that as a custom block. And then the next step was to implement this in a workflow and see what this looked like. So in this notebook, we have imported that custom block, CB Line of Spheres. And you can do that by going into your imported blocks and import that. And I have that one imported block in here, and you can see it’s in my notebook. I have that starting location, but if I move that, we can see that my line of spheres have moved.And the assignment asks for three different list manipulations. So the first one is to take the third through eighth item in the list. And to do that, we have this Sublist. So I have my list as my spheres. Index goes from two with a range of six. And the reason for that is because if we go into our block details for our spheres under properties, we can see that the first sphere in our list is zero. So if we want to take the third sphere, we’re actually going to start with index two, and then we’ll go to eight. So if we look at our original, let’s turn on that display color so we can see the difference. We can see I have it go from our third sphere to our eighth sphere.Another task was to remove our fourth and fifth sphere of our list. So if we look at our original spheres again, have that as our list, begin with index three, so that’s our fourth item. And our range is of two. So let me change that color again, and we can see it’s removed that Fourth and Fifth Sphere in our list.The last item to do was to select only the last item in this list. And to do that, we have our List Element block where we put in that spheres list. And to always ensure that we’re taking that last item in that list, you could have just done nine as we had done with these. But if the size of the list was larger than 10, what we can do is go into the block details under properties and choose the size. So by taking this size, no matter what size our list is, it’ll always be that last item. And because we start our list at zero, we’re just going to subtract that by one. And that’s how we’ll be able to, if I change that color, we can see I’ve selected just that last item in the list. That’s the answer to our optional test problem for automation.

