> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ntop.com/llms.txt
> Use this file to discover all available pages before exploring further.

# How to create a TPMS from an equation

## Objective:

Learn how to create a TPMS by using math equations. This example creates a Schwarz TPMS

## Applies to:

* TPMS
* Math

## Procedure:

**1. Build the equation using math blocks**

The equation for the Schwarz TPMS is **cos(x)+cos(y)+cos(z)**. Equations in nTop are built out by individual blocks. Some equations can quickly become complicated. Due to this, we recommend turning these workflows into Custom Blocks, so you only have to build it once. It is also useful to name each block as the function it is representing.

* * Add 3 **Cos** blocks
    * In the first **Cos** block, write in 'X/1 mm'. This gets rid of the units associated with X and allows it to work with **Cos**.

![The Cosine block](https://files.learn.ntop.com/help-articles/lattices/47544632149523.png)

* * Repeat this for the remaining **Cos** blocks using Y and Z instead of X.
    * Add an **Add** block
      * Insert Cos(X) and Cos(Y) into the Add block

![An Add block with two cosine blocks in the inputs](https://files.learn.ntop.com/help-articles/lattices/47544653284499.png)

* * Add another **Add** block
    * Insert the Add block with Cos(X) + Cos(Y)
    * Insert Cos(Z)

![The equation blocks used to create the TPMS field](https://files.learn.ntop.com/help-articles/lattices/47544653286931.png)

You can now view the results of your equation in the Field Viewer (F).

![A visualization of the scalar field that was created](https://files.learn.ntop.com/help-articles/lattices/47544653289235.png)

**2. Give your TPMS units**

The TPMS field we generated in the above step needs units to be used in other operations. Add units by multiplying the field by 1 mm.

* * Add a **Multiply** block
    * Insert the equation from Step 1 into Operand A
    * In Operand B, write 1 mm

![The TPMS equation created above, multiplied by 1mm to give it units](https://files.learn.ntop.com/help-articles/lattices/47544653290643.png)

**3. Trim your TPMS down to size**

Use the **Boolean Intersect** block to edit the size of the TPMS

* * Add a **Boolean Intersect** block
    * Insert the **Multiply** block from Step 2.
    * Insert a body with which you want to intersect the TPMS. In this example, we use a small **Box**.

![The implicit body TPMS generated from the TPMS field](https://files.learn.ntop.com/help-articles/lattices/47544632155411.png)

And that's it! You've successfully created a TPMS using math blocks.

Are you still having issues? Contact the [support team](https://support.ntopology.com/hc/en-us/requests/new), and we'll be happy to help!

## Download the Example file:

* [Example file](https://files.learn.ntop.com/Support%20Article%20Example%20Files/Knowledge%20Base/Lattices/schwarz_eqn.ntop)

## Keywords:

*TPMS variable math build cos how-to x equation schwarz*
