Transcript
Transcript
In this lesson, we will review the answer to the optional nTop CL test problem: to set up this nTop notebook for nTop CL and then run nTop CL to evaluate the mass properties of this LED bracket for a combination of different design variations. This completed file with descriptions, JSON files, Python script used, and the data generated will also be available for download below.In this file, we need to set up the inputs according to what will need to be changed during the nTop CL executions. These three things are, in order: lattice type, cell size, and thickness. These can be made into a variable from the starter file. Under the lattice part of the design, in the Rectangular Volume Lattice block, under unit cell, this is where you can find the lattice type. You can right-click and make that into a variable and put that in the input section.For the unit cell size, for it to all be equal, you will have to use a Vector block and put in the cell size variable for all XYZ components. This cell size variable also needs to be inputted into the input section. The beam thickness is also under this Rectangular Volume Lattice block as one of the parameters. This will also need to be a variable in the input section. Since we want the mass properties of this part, we will have to use the block called Mass Properties From Body and use the final part implicit body as its input body. The density of the material that’s given is this value: 0.047, and you can use the relative error of 0.01.Additionally, we want to output a 3MF file, and this is a mesh-type file. So, you would first need to convert the implicit body of the final part into a mesh using this block and then create a path for the Export Mesh block by concatenating together based on the format of the naming that we want to choose for this. So, this is a Concatenate Text block where we input a list with four items. The first one being the word “bracket,” the second is the lattice type name, which is a property that you can get from the properties of this lattice type variable. This chip right here was used for this part, and it will output the name of the lattice instead of just the index.The next item in the list will have to be the cell size, which is the value that has to be converted to text, as well as the thickness. This also has to be converted into text. And because we are concatenating together four things in the list and using the same delimiter, we’re going to get this text string with “bracket” and, since the current input is “Diamond,” we get that as our lattice type name, and then “-1” for the current cell size, “-0.2” for the current beam thickness. And then using the Concatenate Text block again, we are adding the 3MF extension file in the second part of the text, and the first part of the text is what was earlier created. Then using the dot as the delimiter, we will be able to get this file extension added to the name so that the file created will be a 3MF file. This exported mesh will go into the folder where this notebook is saved with each execution.So, now that we have the completed workflow for what we want to do, as well as the three inputs and the mass property output ready, we can start in Windows Powershell and run an nTop CL command for generating the template using this file. You first need to make sure that you are in the right folder, in the correct directory. I am already in this directory where I have this file saved, but you would just need to open up the folder where you have this file and then hold shift and right-click and choose “Open Powershell here” to be able to get there without having to access directory in command line. So, we’ll press enter, and opening up that folder, we see that there’s this file already generated of the 3MF file that was created just from the notebook itself, and the input template and the output template have just been added.Let’s open up the input template. We have what we have inputted in the current notebook. So, lattice type of five for the diamond. This is index five on the list. We have the cell size, which is 10 mm, and the thickness, which is 0.2 mm. Let’s also open up the output template and compare this mass with what we have in these properties. This mass is outputted in kilograms. We also get the center of gravity, inertia, and volume in here. So, what I can now do to test our file, or to test on the first nTop CL run, is change the input. I’m going to change it to type zero, simple cubic, and keep this to 10, keep this to 0.2. Save this in the input template, go back to Powershell, and run nTop CL with the verbose setting 2 to see the runtime information, and the input JSON file “input_template.json,” output file I will name “output.json,” and the name of our nTop file.Let’s run this. This will execute without the GUI, and we’ll be able to see what happens when we look into the folder. And it’s created the 3MF file. And if we look at the output file that was just generated, we have a different mass. It is as if we were to run this by changing this lattice type in the GUI and get the mass information in this block, as well as the exported file in 3MF format. So, it worked. I will close these two files.And since everything is running as expected, we can start scaling this up with a Python script. We have this Python script, which is really similar to what was used in the follow-along lattice example. We have the modules for the folder, data folder, and the time. And everything is similar except for the design variations now include three design variables, which are lattice type of diamond, octet, truncated octra, like described in the problem. And these are corresponding to the index of 5, 7, and 9. The cell sizes are 10, 15, and 20, and the thicknesses are 0.2 and 0.5. So, the count is also added here, starting at one, so that we can keep count of each execution. And all the data is like that follow-along example, stored in a data folder, and the CSV file is also created with the header being the count of the execution, the lattice type, the cell size, thickness, and then the mass.We have here three nested for loops for I, J, K representing each of the design variables, and accessing the input values in each of the arrays in this input JSON, and running nTop CL execution as always, and outputting this CSV summary table that has the data and all the runs combined into one file. You’ll have to make sure that the script is in the same folder and all of the file paths are changed to the correct one, and the name of your notebook is correct. And then we’ll run this code. It will execute for a total of 18 times, which is the number of combinations that you get with all of these variable inputs. We’ll let it run.Now that it’s finished running, we can open up our folder and see all of the files that came out as the result. So, we have these 3MF files exported and labeled with the lattice type and cell size and thickness, and we can look at what each of them looks like. We can go into the output file and see the summary of these runs. We’ve had 18 executions in total, and these are all the different combinations. 0.97 kg is the smallest mass we got out of all of these combinations, and that’s for the lattice type 5, which is the diamond cell size of 20 mm, and 0.2 mm beam thickness. If we go into the data folder, we also will have the input and output JSON files containing the properties that are exported with the mass properties of our part.

