How to Create and Remove Variables

This article covers what a variable is, the different ways of creating them, and how to use them. 

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 variable 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. Changing the Sphere and Cube to variables as well allows you to quickly replace them without having to R-click and remove contents. 

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. To do this, click on the icon and either search the list or type in the desired input type. 


Interested in seeing variables in a full workflow? Check out this Basics video to see them in action: 1.1.0 Basics: Lightweighting with Toolkits


 block variable create parameter what is using creating removing variables make 
Was this article helpful?



Article is closed for comments.