START DOCUMENTATION

Parametric Cube

Your Parametric Model

When building scripts it is important to realise that you can control variable parameters of the components via the output information of other components. In this short script we will create a cube and a number slider component that controls its size.

Start The Application

First thing we will need to do is open up our Application on https://bitbybit.dev/app?editor=rete. This will immediately start an empty Rete workspace.

Create The Cube

We will use OpenCascade (OCCT) geometry kernel to create the cube. OCCT is the most advanced of our exposed geometry kernels. To find the component, follow this path of navigation "Occt" -> "Shapes" -> "Solid". There you will see a category called primitives. Find the component called "cube". Click it in order to add it to the canvas. Notice that component has a subtitle link called "occt.shapes.solid.createCube" - this always reflects the path and actual function name that is being called from bitbybit library. If you click this link, you would be redirected to an appropriate documentation page for this function at https://docs.bitbybit.dev. If you would be writing TypeScript code in Monaco editor, the actual function would be "bitbybit.occt.shapes.solid.createCube(inputs);". This also makes it easy to find the component when using the search toolbar or components menu.

Rete

Create cube

After you are finished with the first step, you will see the result as shown in the example above. Notice that currently you can control the size of the cube via the integrated default size input for numeric value. Feel free to change it and see components react.

We will now add another type of node to the canvas. Navigate to category called "Math", find subcategory called "create" and click on the "number slider" component. You will now see a slider appear on your canvas. Connect by dragging the output of the number slider component to the size input of the cube component. If you did it right, you will see the result as in this script below:

Rete

Cube controlled by slider

Now you can drag the slider and the cube will change it's size automatically. Feel free to experiment with this further.