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
-
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.
-
Close the model.
-
Create an input file called objects.inp in the model folder by using a standard text editor.
-
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 toyes
. -
Save the file.
Example: Test the user-defined attribute
-
Open the model.
-
Create a steel column.
-
Double-click the steel column to open its properties in the property pane.
-
Click the More button.
-
Go to the My UDA tab.
-
Enter a value in the My UDA field.
-
Click Modify.
-
Copy the steel column.
-
Select the My UDA check box for the new steel column.
The attribute value is also copied.
-
Close the model.
Example: Modify the user-defined attribute to make it unique
-
Open the objects.inp file in the model folder by using a standard text editor.
-
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.
-
Save the file.
Example: Test the unique user-defined attribute
-
Open the model.
-
Enter a value in the My UDA field for a steel column and click Modify.
-
Copy the steel column.
-
Select the My UDA check box for the new column.
-
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
-
On the File menu, click Diagnose & repair and
-
In the Utilities section, click Diagnose and change attribute definitions.
The Diagnose & Change Attribute Definitions dialog box opens.
-
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.
-
Select the definition in the area on the right.
-
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.
-
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) } }
-
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) }