Learn what a list is and how to use them.
What is a list?
All blocks in nTop can exist as singular entities or as a list. A list is multiple objects together in the same block. This allows processes to run on multiple parts at a time. If you search for blocks, you will sometimes see a "Block Name List" pop up. These can be used as an input into another block to run it multiple times. The block that ran will turn into a List block with a (#) behind the name. The (#) corresponds to how large the list is.
To create a list of any type, type ‘list’ into the search bar, along with the block type you would like to create. Lists are denoted in nTop by three small rectangles of increasing width in the bottom left corner of the data type icon. The size of a list is shown in parentheses next to the Block type. Not all lists are created from the search bar, some can be made unintentionally or without notice with certain blocks. Some blocks can turn a singular entity into a list and some can merge lists together. If you find yourself having an 'invalid input error', it may be because you are trying to input a list into a singular type input.
List block properties contain a set of List properties at the top and individual properties for each item within the list at the bottom. The individual properties can be dragged out of a List to create an individual item. The dropdown arrow next to the individual entities can be clicked to obtain more information on just that individual list entity. You can also click and drag individual entities into the notebook to create a new single variable separated from the list.
There are two methods to add blocks to a list:
- Drag a new block into a List block. Remember that all entities in a list must have the same block type (i.e. they must have the same icon in the top left corner of the block).
- Select the '+' to add more inputs. If you add too many, use the '-' on the left of the input to remove them.
The order of list entities can be changed by dragging list entities around within the List block.
Other list manipulation tools can be found in the Utilities Ribbon Tab, under ‘General’. These blocks are outlined below.
- List Element: Extract a single entity from a list
- Insert: Combine two lists into one by inserting a list into another at a specified index location.
- Sub List: Extract a smaller list from a larger input list, based on a starting index and the desired size of the sub-list.
- Remove: Remove one or more entities from a list, based on a starting index and the number of removed entities.
Some blocks in nTop take in list inputs and combine them into a singular entity. An example of this is the Boolean Union block, which takes in a list of bodies and generates a single unioned body. Blocks like this are auto-populated with an empty list, which is useful for quickly dragging bodies inside to complete the operation.
Sometimes, a user already has a list prepared that they would like to perform a boolean union operation on. In this case, the auto-populated list must be deleted and replaced by the desired list.
Lists of One (1)
You may have encountered a situation in nTop where you try to add your parts to a block that accepts a list of inputs, and it won't let you.
This is because the input you are trying to add looks like "Block Name (1)". Somewhere, a List of One was created. Lists of one are sometimes unintentionally created by the user, or during CAD/Part importing. They can be converted to singular entities by either dragging the entity out of the Properties tab of the Info panel or by using the List Element block.
To drag the entity out, open up the Properties tab, expand until you find the part, and drag the part chip into the Notebook. This creates a block in the Notebook that doesn't have a list.
Groups in nTop are the same thing as lists, except they can contain a combination of any block types. For example, the group below consists of a point, a sphere, and a cube. The same list manipulation operations described can be performed on groups.
1. Add a Sphere List (notice the list icon on top of the sphere icon).
2. Add a Sphere block into each input of the Sphere List. Change the x-value center point of each sphere to 0, 10, and 25 respectively. Then change the radius to 3, 5, and 8 mm.
3. Add a Walled TPMS block and insert the Sphere List into the Body input. This runs the operation on each object in the list.