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

Tekla Structures
2023
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.

Example: 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 the objects.inp file:

    /***************************************************************************/
    /* 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)}

    In this example, the special_flag property is set to no. If you want to create a user-defined attribute that also affects numbering, set the special_flag property of the attribute to yes.

  5. Save the file.

Example: 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 the My UDA tab.

  6. Enter a value in the My UDA field.

  7. Click Modify.

  8. Copy the steel column.

  9. Select the My UDA check box for the new steel column.

    The attribute value is also copied.

  10. Close the model.

Example: 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)
     }

    Adding unique_ before the user-defined attribute makes the user-defined attribute unique. The value of the user-defined attribute is not copied to another part.

  3. Save the file.

Example: Test the unique user-defined attribute

  1. Open the model.

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

  3. Copy the steel column.

  4. Select the My UDA check box for 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.

Example: Update the definitions of user-defined attributes

  1. On the File menu, click Diagnose & repair and

  2. In the Utilities section, click Diagnose and change attribute definitions.

    The Diagnose & Change Attribute Definitions dialog box opens.

  3. 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.

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

  5. 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.

Example: Add a tab page to the definitions of user-defined attributes

The tab page display order is defined by the last number in the definition row. Avoid using the same page numbers that are already used in the object.inp file in the common environment.

  1. Define the tab page content.

    tab_page("","jd_Parameters",3)
    {
         attribute("PROJECT_COMMENT", "j_proj_comment", string, "%s", no, none, "0.0", "0.0")
         {
              value("", 0)
         } 
    }
  2. Add the tab page content to drawing objects for GA drawings and multidrawings.

    /***************************************************************************/
    /* Drawing attributes - GA */
    /***************************************************************************/
    gadrawing(0,"j_GA_drawing")
    {
         tab_page("DR_Workflow","jd_Workflow",8)
         tab_page("DR_Parameters","jd_Parameters",9)
         modify(1)
    }
    /***************************************************************************/
    /* Drawing attributes - multi */
    /***************************************************************************/
    multidrawing(0,"j_Multi_drawing")
    {
         tab_page("DR_Workflow","jd_Workflow",8)
         tab_page("DR_Parameters","jd_Parameters",9)
         modify(1)
    }
Was this helpful?
Previous
Next