Import user-defined attribute values

Tekla Structures
2020
Tekla Structures

Import user-defined attribute values

You can import user-defined attribute (UDA) values to a model from a text file. For example, you can import a list of manufactured or checked assemblies. You can also clear existing user-defined attribute values through attribute import.

You can import attribute values to Tekla Structures model objects, drawings, and some reference model objects. In addition to defining matching criteria in the import file, you can also limit the import scope to objects you select in the model or to reference model objects.

The input file can be:

  • Exported from other software.

  • Created manually using any standard text editor, for example, Microsoft Notepad.

  • Created from Microsoft Excel by saving the file with the Save as command to Text (Tab-delimited) (*.txt) format.

  • A simple Tekla Structures report containing the part GUIDs and user-defined attributes.

Note: There are alternative ways to import data into user-defined attributes. For example, user-defined attributes can be filled in when you import IFC objects and convert them to native Tekla Structures objects. There are also several extensions in Tekla Warehouse that allow you to modify user-defined attribute data.

Input file structure

You can import user-defined attribute (UDA) values into Tekla Structures models from input files, which are delimited text files.

Delimiters

A delimiter is a character that separates different fields that are on the same line. You can delimit fields with any ASCII character that does not appear in the names or values of the attributes that you are importing. You can use several alternative delimiters in the same input file. Common delimiter characters include the comma, tab, semicolon, and space.

Field and value definitions

In the input file, the first line is a header that defines the fields for the rest of the input file. All other lines in the input file contain the values for the fields that you named on the first line.

The first line must contain at least one key field that identifies the model objects or drawings, and at least one user-defined attribute name that identifies a user-defined attribute field into which you want to import new values. Note that the names of many of the fields are different than the field labels that you see in the user interface. The user-defined attribute names are defined in the objects.inp files that apply to the model (see the reference on how to read the file).

The configuration file import_macro_data_types.dat (which is explained further ahead) defines which fields you can use in the attribute import and what is each attribute's data type. It is not possible to add or change the key fields, but you can edit the set of user-defined attributes. Values are imported as strings (text) unless a different data type is defined for the attribute in the import_macro_data_types.dat file.

Available key fields

The key fields for model objects are:

Key field

Example

Action

GUID

ID4FEAFC88-0000-0004-3133-​343038303031

Tekla Structures assigns the user-defined attributes on this line in the input file to the model object that has a GUID value of ID4FEAFC88-0000-0004-3133-343038303031.

ASSEMBLY_POS

or

MARK

A3

Tekla Structures assigns the user-defined attributes on this line in the input file to the assembly that has an ASSEMBLY_POS value of A3.

Repeat this line for each assembly you want to include.

PHASE

2

Tekla Structures assigns the user-defined attributes on this line in the input file to the assembly that has a PHASE value of 2.

You must also use ASSEMBLY_POS as a key field with this option.

The key fields for drawing objects are:

Key field

Example

Action

TYPE NAME

A D4

Tekla Structures assigns the user-defined attributes on this line in the input file to the drawing that has a TYPE value of A and a MARK value of D4.

Use both key fields in the input file.

ID

134

Tekla Structures assigns the user-defined attributes in this line in the input file to the drawing object that has an ID value of 134.

Empty values

It is possible that some lines in the input file do not have a value for all of the attribute fields (there may be two or more consecutive delimiter characters between values). These empty values can be either skipped during import without making any changes to user-defined attributes, or you can use these empty values to erase existing user-defined attribute values in your model. By default, empty values are skipped. To clear existing values instead, set the advanced option XS_ERASE_UDA_VALUE_WITH_ATTRIBUTE_IMPORT_NULL_AND_BLANK to TRUE in an ini file.

Read-in order

Tekla Structures reads the input file in order starting from the first line. If there are duplicate key fields on the following lines, only the first occurrence is imported.

Data file (import_macro_data_types.dat)

To import a value into a user-defined attribute, the field name and data type must be correctly defined in the import_macro_data_types.dat data file. You can add, edit, and remove user-defined attribute fields into which data is imported. Do not edit the key fields section of the file - it is not possible to add new key fields.

File location

The default data file is located in the system folder in the environment folder, for example, C:\ProgramData\Trimble\Tekla Structures\<version>\environments\common\system. There may also be a localized version of the file in the environment that you are using.

Do not make changes to the default files. Instead, create a copy of the file and store it in a different location, for example, in the firm folder or in the attributes folder in the model folder. This way, your changes are not overwritten when you reinstall or upgrade Tekla Structures. When the file exists in multiple locations, the default folder search order is followed and only the first file that is read is used.

File content

The import_macro_data_types.dat file is plain text. You can modify the file using any standard text editor, for example, Microsoft Notepad.

Each line in the file is a field definition that can contain the following attributes in this order:

User-defined attribute name,Data type,Conversion factor,Comments

  1. User-defined attribute name. Write the internal field name as defined for the field in an objects.inp file.

    For example, in the objects.inp definition attribute("USER_FIELD_1", "j_user_field_1", string, "%s", no, none, "0.0", "0.0"), the user-defined attribute name is USER_FIELD_1.

  2. Data type.

    The value can be: INT (integer), STRING (text), FLOAT (decimal number), or DATE (date fields with a calendar widget). If the value is missing or incorrect, the value defaults to STRING.

    A value type mismatch does not prevent importing data, but the results may not always be correct depending on the data and the field. For example, date fields may be set incorrectly if the data type is not DATE. On the other hand, you can import a number with the integer data type into a text field without a problem.

    Fields with option lists are defined as number fields of the INT value type. For example, object locks can be set to No, Yes and Organization with the corresponding numbers 0, 1 and 2 in the input file.

  3. Conversion factor (optional, FLOAT only). For converting imperial values to metric values in imperial environments.

    Note:

    We recommend that you check the FLOAT values to avoid conversion factor errors.

  4. Comment (optional). Any characters that follow the above definitions are ignored and can be used for writing your comments. However, these comments should be used sparingly as the file is easier to read if you write most comments on a separate line instead as explained below.

Tekla Structures treats lines starting with double forward slash characters (//) as comments and ignores them when reading the file.

Examples:

//Regular attributes

R1_ISSUED_FOR_APPRL, STRING
R1_DATE_APPROVED, DATE

//Attribute with conversion factor and comment

shear1, FLOAT, 4448.2222, For kips

Examples of input files

Example input file for parts

This input file is tab delimited.

ASSEMBLY_POS and PHASE are the key fields. Tekla Structures adds several user-defined attributes to the assemblies with values that match those listed in the ASSEMBLY_POS and PHASE columns.

For example, an assembly with the ASSEMBLY_POS (assembly number) of B5 in phase 1 gets the following user-defined attributes:

STATUS: 3

USER_PHASE: 6

USER_ISSUE: 3/25/2019

ASSEMBLY_POS  PHASE  STATUS  USER_PHASE  USER_ISSUE
B1  1  7  3  3/25/2019
B2  1  7  3  3/25/2019
B3  1  7  3  3/25/2019
B4  1  7  3  3/25/2019
B5  1  3  6  3/25/2019
B1  1  3  5  3/26/2019
B2  2  3  4  3/26/2019

The input file contains two entries for B1. In this case, Tekla Structures writes the message ">Duplicate entry in input file." in the log file and only imports the first entry in the file. So in this example, B1 will have the following user-defined attributes after the attribute import:

STATUS: 7

USER_PHASE: 3

USER_ISSUE: 3/25/2019

Example input file for drawings

This input file is tab delimited.

TYPE and NAME are the key fields. Tekla Structures adds a value for the user-defined attribute User field 4 to drawings with values that match those listed in the TYPE and NAME columns.

For example, a drawing with the TYPE A (assembly drawing) and NAME B.2 gets the value 4 in the User field 4.

TYPE  NAME  DRAWING_USERFIELD_4
A  B.1  3
A  B.2  4
A  C.1  1
A  C.2  2

Process an input file

Note: This operation overwrites any existing attribute values for matching objects if the input file contains a value for the field.

By default, empty values are skipped. To clear existing values instead, set the advanced option XS_ERASE_UDA_VALUE_WITH_ATTRIBUTE_IMPORT_NULL_AND_BLANK to TRUE in an ini file.

  1. If you want to import user-defined attributes to a selected area in the Tekla Structures model, select an area in the model.
  2. On the File menu, click Import > Attributes.

    The Import Attribute dialog box opens.

  3. Click the ... button next to the Input file box to select the input file to be imported.
  4. Choose the correct settings for the import.

    Option

    Description

    Input file delimeters

    Select a delimeter or several alternative delimiters used in the input file.

    You can delimit fields with any ASCII character that does not appear in the name or value of any of the attributes that you are importing.

    Input scope

    • Default, Entire model

      Tekla Structures assigns the user-defined attribute values of objects in the input file to matching objects in the model.

    • Selection only

      Tekla Structures only assigns the user-defined attribute values of objects in the input file to matching objects in the selected area of the model.

      Use this option to import user-defined attributes to models. Do not use it for drawings.

    • Reference models

      Tekla Structures assigns the user-defined attribute values of objects in the input file to matching objects in reference models.

    Create log file

    • Create

      Creates a new log file named attribute_import.log in the current model folder each time you import the user-defined attributes. Any previous attribute import log files are overwritten.

    • Append

      Adds log entries to the attribute_import.log file in the current model folder each time you import the user-defined attributes. If the log file does not exist, Tekla Structures creates it.

    • No

      Does not create a log file.

    Display log file

    • No

      The log file is not displayed.

    • On dialog

      The log file is displayed when the import is complete.

  5. Click Create to import the file.

    If you selected the option to display the log file, Tekla Structures displays the log file in a separate window, and you can click a log entry to select the corresponding object in the model.

Esta informação foi útil?
Anterior
Seguinte