Transcript
Transcript
In this lesson, we will walk through the optional automation challenge problem, which was to create a custom block that keeps or removes implicits that are within a region or partially within that region. The first thing I’ll show is just it working. We were asked to use that custom block line of spheres in the previous optional test problem and use that as our list of what to keep and remove.So for my custom block, I’ve imported both of these into my notebook and I have my implicits as that list. I have that custom block of spheres. I chose a Box From Corners where I can just drag and move this into different sections. Anything that is at least partially inside the body will be selected. And if I uncheck that and select this, we’ll see the items that are not at all within that body are selected. So this is just an example of a similar process that some of our other filtering options might use.This is the custom block that Keep Remove Implicits in Region, and I’ve added some inputs already just to help us see what’s going on in the actual file. But we have the three inputs: the implicits, the region, and inside body. And if this was my custom block that I’m inputting, I would just remove that sphere list or that Box From Corners. But to show how this works, I have two spheres in here and then I have my region to keep. So if I’m only going to keep anything that is in the box or partially in the box, it is going to be this one sphere. So I can visually see what I’m going to want to do. And I have this checked as inside the body, so anything that’s partially with inside the body is going to be selected.And there are many ways to do the same thing or similar process in nTop, so this is one way that you could have gone about this problem. So I’ll show that in our first step is that list manipulation section, and you can download this in the files below. So first I used this custom block List Process Boolean, and you can see I have two custom blocks that I used in this notebook that you could have downloaded and also used, which is our Ifs block and our List Process. So this will just allow me to run through my Boolean operations to each of these spheres. So I’ll take my primary body, which is the region, and do a Boolean intersect of the first sphere and then the second sphere.And if I go into the properties, I see I have two intersecting bodies now: one using the first sphere, one using the second. And I have those dragged out just so we can look at them. So the first one is just that part of the sphere that’s intersecting the region, and I see nothing for the second because those two are not intersecting at all. So the way that this custom block works is we have, even if there is nothing visible, I still have that bounding box property, and that’s just going to be at that origin in this example. But if we look at this implicit body, the one that does have a region here, and we type F, let me turn off that visibility, we are always going to have that negative values when we are within that geometry. So for something that is intersecting, I’m going to have a negative value at that centroid. If I type F, we don’t see any negative values because there’s nothing where it is intersecting. So we can use that to our advantage to define where we’re going to keep and remove.So the next thing I do is use this Evaluate Field in order to decide if the field is negative or positive at that centroid of our intersecting body. We can use this Evaluate Field block, and this is a really useful block that is used often in some of our more complex notebooks and complex custom blocks, where you bring in a field and at a certain point it’ll tell you what that value is. So if you’re creating a point map, if you’re doing simulation and you want to find the stress at a very specific point and you have the stress field, this is a good use for that block. It’s also useful in this case. I’m going to use two points. I have the centroid of both of my intersecting bodies, and that produces two values of the Boolean. And we can see the first one is negative, that’s where we do get a result of that implicit body because they are intersecting, and then we have one that’s positive because there’s no visualization, they are not intersecting.So having this values of the Boolean, and I’ll remove these again, we can use the filter and filter out the objects that are either positive or negative for that centroid. So for this filter, we have two different options. I just chose the list interface in the bull list for the filter, and we’re going to filter out our implicits. And this is where I used that custom block if. So if true, if false, what are we going to do? And this is where I bring in that conditional for that inside the body. So if we want to keep what’s inside the body, then I’m going to want to only keep the values of that variable I have above if they are less than zero. So I’m only going to keep anything where the centroid is negative. But if I want to keep whatever is outside of that region, then I’m going to only keep those implicits where their value of the Boolean was positive. And so that’s how we get just the one which is intersecting this region, and if I flip it, I get the opposite. So a bit complex as we’re using custom blocks within this custom block, and that’s why this is a challenge problem. But hopefully you can see the usefulness of this custom block, especially if you have one type of option versus another that you want to have in your own custom block. It’s really useful to just have that Boolean option, and also using this List Process custom block can be really useful, and the Evaluate Field block.

