Example of a variable formula: Calculate the number of handrail posts using a template attribute

Tekla Structures
Modificado: 3 Nov 2025
2026
Tekla Structures

Example of a variable formula: Calculate the number of handrail posts using a template attribute

This example shows how to create a variable formula that calculates the number of handrail posts in a custom component based on the length template attribute of the beam.

The handrail posts have been created at both ends of the beam, and one of them has been copied with the Array of objects (29) component.

  1. In the model, select the custom component, right-click, and then select Edit custom component.
  2. On the Custom component editor toolbar, click the Display variables button.

    The Variables dialog opens.

  3. To create three new parametric variables, click Add three times.
  4. Modify variable P1 as follows:
    1. In the Formula box, enter 250.
    2. In the Label in dialog box box, enter End distance.
  5. Modify variable P2 as follows:
    1. In the Formula box, enter 900.
    2. In the Label in dialog box box, enter Spacing.
  6. Modify variable P3 as follows:
    1. In the Value type box, select Number.
    2. In the Label in dialog box box, enter Number of posts.
  7. Inquire the GUID of the beam:
    1. Right-click the beam in a custom component view and select Inquire .
    2. In the Inquire object dialog, copy the beam's GUID.
  8. In the Formula box of the P3 variable, enter =fTpl("LENGTH","04c3ff6a-8ee4-4a1c-8592-ba0ffd5556ea")-(P1*2))/P2.

    In the formula, 04c3ff6a-8ee4-4a1c-8592-ba0ffd5556ea is the GUID of the beam.

    Reference functions consist of the following syntax: fTpl("template attribute", "object GUID"). You need to always check the GUID of the object that you use with the reference function.

    The number of posts is calculated as follows: First the end distances are subtracted from the beam length, and then the result is divided by the post spacing.

  9. Link the parametric variables P2 and P3 to the dist_between_elem and number_of_arrays properties of the Array of objects (29) component.
    1. In the Custom component browser, browse for the dist_between_elem property.
    2. Right-click and select Add equation.
    3. Enter P2 after the equal sign, and then press Enter.
    4. Browse for the number_of_arrays property.
    5. Right-click and select Add equation.
    6. Enter P3 after the equal sign, and then press Enter.

  10. Bind the first handrail post to the beam end.
    1. In a custom component view, select the post.
    2. To select the handles of the first post, hold down the Alt key and use area selection (from left to right) to select multiple handles.
    3. Right-click and select Bind to plane.
    4. In a custom component view, move the mouse pointer to highlight the plane you want to bind to the handles.

  11. Bind the last handrail post to the other beam end in a similar way.
  12. Modify the distance variables as follows:
    1. In the Formula box, enter =P1.
    2. In the Visibility list, select Hide.

  13. Save the custom component.
  14. Close the custom component editor.
  15. Select the custom component in the model, and open the custom component dialog.

    You can now change the spacing and the end distance of the handrail posts in the custom component's dialog. Tekla Structures calculates the number of posts based on the spacing, end distance, and length of the beam.

Esta informação foi útil?
Enviar
Anterior
Seguinte