Example: Create and update a user-defined attribute (UDA)

Tekla Structures
2021
Tekla Structures

Example: Create and update a user-defined attribute (UDA)

This example shows how to create your own user-defined attribute (UDA) and update the model to use the changed attribute definition.

Create a user-defined attribute

  1. Create a new model and save it.

    The user-defined attributes in the model are merged from objects.inp files and Tekla Structures saves the attribute definitions in the environment.db file in the model folder.

  2. Close the model.

  3. Create an input file called objects.inp in the model folder by using a standard text editor.

  4. Enter the following information in objects.inp. For details about the properties in the attribute string, see objects.inp.

    /***************************************************************************/

    /* Part attributes */

    /***************************************************************************/

    part(0,"Part")

    {

    /* User defined tab page */

    tab_page("My UDA tab")

    {

    /* User defined attribute */

    attribute("MY UDA", "My UDA", string,"%s", no, none, "0,0", "0,0")

    {

    value("", 0)

    }

    }

    tab_page("My UDA tab", "My UDA tab", 19)

    modify (1)

    }

    /***************************************************************************/

    /* Column attributes */

    /***************************************************************************/

    column(0,"j_column")

    {

    /* Reference to the user defined tab page that is defined above in */

    /* the part() section: */

    tab_page("My UDA tab", "My UDA tab", 19)

    modify (1)

    To see the example text file, click objects.inp - example 1.

    Note:

    If you want to create a user-defined attribute that also affects numbering, set the special_flag property of the attribute to yes (it is no in the example above). Also, just like in the example above, the definition of the tab_page must be in the part section, and the column (beam, etc.) section must have only a reference to it.

  5. Save objects.inp.

Test the user-defined attribute

  1. Open the model.

  2. Create a steel column.

  3. Double-click the steel column to open its properties in the property pane.

  4. Click the More button.

  5. Go to My UDA tab.

  6. Enter a value in the My UDA box.

  7. Click Modify.

  8. Copy the steel column.

  9. Check the My UDA box of the new steel column.

    The attribute value was also copied.

  10. Close the model.

Modify the user-defined attribute to make it unique

  1. Open the objects.inp file in the model folder by using a standard text editor.

  2. Enter unique_ before the user-defined attribute.

    /***************************************************************************/

    /* User-defined attributes */

    /***************************************************************************/

    part(0,"Part")

    {

    /* Common tab pages for part attributes */

    tab_page("My UDA tab")

    {

    unique_attribute("MY UDA", "My UDA", string,"%s", no, none, "0,0", "0,0")

    {

    value("", 0)

    }

    }

    tab_page("My UDA tab", "My UDA tab", 19)

    modify (1)

    }

    /***************************************************************************/

    /* Column attributes */

    /***************************************************************************/

    column(0,"j_column")

    {

    tab_page("My UDA tab", "My UDA tab", 19)

    modify (1)

    }

    This makes the user-defined attribute unique, meaning that the value of the user-defined attribute will not be copied to another part.

  3. Save objects.inp.

    To see the example text file, click objects.inp - example 2.

Test the unique user-defined attribute

  1. Open the model.

  2. Enter a value in the My UDA box for a steel column and click Modify.

  3. Copy the steel column.

  4. Check the My UDA box of the new column.

  5. The value was copied, so the user-defined attribute in the model is not unique. There is a conflict between the environment.db and objects.inp definitions.

Update the definitions of user-defined attributes

  1. On the File menu, click Diagnose & repair and in the Utilities area, click Diagnose and change attribute definitions.

    The Diagnose & Change Attribute Definitions dialog box opens.

  2. Select My UDA in the Attribute area on the left.

    You can see that My UDA is not unique in the current setting, but it is set to unique in objects.inp.

  3. Select the definition in the area on the right.

  4. Click Change current settings to selected Objects.inp settings.

    Now the definition of the user-defined attribute is updated in the model.

    If you now copy a steel column that has a value for My UDA, the value is not copied to the new column.

Was this helpful?
Previous
Next