How to Create a Variable

Follow

This article covers what a variable is and how to create one. 

A variable can be any block or parameter in the Notebook. By declaring a block as a variable, entire parts can be changed quickly and parametrically. An entire Notebook of functions can automatically be computed and rebuilt by simply changing values in the variable. Variables also allow for quick and easy organization and understanding of your Notebook since the blocks don't get nested within another block. 

To create a Block variable:

  • Select the block
  • R-click along the top of the block
  • Select "Make Variable"

A block variable will look different from a regular block. The name will move to the left and will be on top of the block color (related to the block type). A block variable will never "nest" inside another block. Instead, a "chip" will be created to show that the variable is inserted in that block. Watch this quick video below to see how to create a variable, re-name it, and insert it into another block.

            

 

To create a Parameter variable:

  • R-click over the parameter name
  • Select "Make Variable"

 A parameter variable is a useful way to quickly change a specific aspect of a block. It makes it clear on what input can change. See the video below on how a parameter variable is made.

 

Use the Info Panel to Create Variables:

  • Expand the (?) symbol on the block to open the Info Panel
  • Go to the Properties Tab
  • Drag any property into the Notebook to create a variable of that property (these properties will be linked to the block they came from)

 

Removing Variable Contents:

  • Empty a variable by R-clicking on the variable and selecting "Remove Contents"

Emptying a variable allows the user to quickly change the contents of that variable while keeping the variable chip inserted as inputs in other blocks. 

Note: In this example, the contents of a Cube block variable are being removed. In order to allow any Implicit Body input, the variable block icon needs to change from Cube to Implicit Body (nTop Body). To do this, click on the icon and either search the list or type in the desired input type. 

 

 

 

 

Was this article helpful?
1 out of 1 found this helpful

Comments

0 comments

Article is closed for comments.