# Custom Attributes

<table>
<tr><td>

<img src="./media/ButtonCustomAttributes.png" width="44" height="44">

</td><td>

**Open custom attributes panel**

Custom attributes provide a way to add new attributes to a model without having to rebuild the model with the UDiTH Builder.

</td></tr>
</table>

If a valid **attributes.xlsx** file is present in the UDiTH data folder, for example `C:\UDiTH\Model\Demoplant\Data\attributes.xlsx`, UDiTH displays all available attributes, including any custom attributes, in the **Custom attributes** menu on the right-hand side of the screen.

<img src="./media/CustomAttributesConstructionState.png" width="550" height="">

> When you use the **Ctrl** key to select multiple objects, their common attributes are displayed directly.

## Custom Attributes Panel

> For details on creating and configuring custom attributes, please refer to the **Custom Attributes** section in **[Custom settings](https://help.caxperts.com/UDiTH%20App/Appendix%20-%20Custom%20settings%20files)**.

In the **Attributes** tab, **Custom attributes** are shown in a distinct colour. In the standard view, they appear in **yellow** and, unlike regular attributes, can be edited. The editing process depends on the type of custom attribute.

-   When you select a custom attribute in the **Custom Attributes** panel, the objects are coloured accordingly and the same custom attribute in the **Attributes** tab changes from **yellow** to **red**.

-   This can also be achieved by double-clicking a custom attribute. When colouring is applied through the **Custom Attributes** panel, it affects **all** objects. When you double-click a custom attribute instead, objects are coloured according to the **CodeList** colour scheme only when they are clicked in the viewport.

To edit **FreeText** custom attributes, simply type the required value, in the same way as for the **Comment** attribute described earlier. For **CodeList** attributes, a drop-down menu is available from which you can select the required value.

<img src="./media/IntelliPID_image144.png" width="502" height="62">

In addition, CodeList-based custom attributes show not only the selected value, but also the colour assigned to that value in the CodeList colour scheme.

<img src="./media/CustomAttributes3.png" width="400" height="">

### Custom Attribute Tool Bar

<table>
<tr><th><img src="./media/IntelliPID_image147.jpg" width="44" height="44"></th><td>

**Export all changes** 

This option saves all data entered into custom attributes in a single `.xlsx` file together with the relevant information for the items to which the values are linked.

</td></tr>
<tr><th><img src="./media/IntelliPID_image146.jpg" width="44" height="44"></th><td>

**Import all changes** 

This loads previously saved custom attribute values from an `.xlsx` file back into the custom attributes.

</td></tr>
<tr><th><img src="./media/IntelliPID_image148.png" width="44" height="44"></th><td>

**Send email**

Custom attribute changes are logged during the session. Clicking this button generates a summary of the changes, copies it to the clipboard, and opens an email in your default email client. The default recipient and subject are configured in the `Meta` tab of `IntelliPIDattributes.xlsx`. For details, see **[Custom settings](https://help.caxperts.com/UDiTH%20App/Appendix%20-%20Custom%20settings%20files)**.

</td></tr>

<tr><th><img src="./media/ButtonShow.png" width="44" height="44"></th><td>

**Show only active**

Unused custom attributes do not appear in the list of values or in the legend for the currently displayed **P&ID**.

</td></tr>
<tr><th><img src="./media/IntelliPID_image35.jpg" width="44" height="44"></th><td>

**Place legend**

This function displays a legend on the **P&ID**, showing the corresponding colour keys for custom attributes. The legend can be repositioned by dragging it to any location on the **P&ID**. For details about custom attribute CodeLists and the legend, refer to the description below.

</td></tr>
</table>

<img src="./media/IntelliPID_image38.png" width="700" height="316">

### Custom Attribute Drop-Down

The drop-down menu allows you to select from custom attributes with CodeList definitions. `None` is the default selection and uses the standard colouring for the **P&ID**. If a custom attribute with a CodeList is selected, objects on the **P&ID** are coloured according to their custom attribute value, and the legend appears below.

## Custom Attributes File

To use **Custom Attributes**, you must create an Excel file containing the required information. This file, named **attributes.xlsx**, must be placed in the model's data folder. The file contains several tabs, as described in the following sections.

### Definition Tab

<table>
<tr><th>Name</th><th>Description</th></tr>
<tr><td>

Id

</td><td>

Identification for custom attributes.

</td></tr>
<tr><td>

Name

</td><td>

The name of the custom attribute as displayed in the UDiTH attributes.

</td></tr>
<tr><td>

SourceAttribute

</td><td>

If the custom attribute is part of an existing attribute, declare the name of the existing attribute here.

</td></tr>
<tr><td>

Filter

</td><td>

See the section <strong>Filter</strong>.

</td></tr>
<tr><td>

DataType

</td><td>

See the section <strong>DataType</strong>.

</td></tr>
<tr><td>

DefaultValue

</td><td>

The default value used when the user hasn't made a selection yet.

</td></tr>
<tr><td>

Parameter1-3

</td><td>

These parameters vary depending on the DataType. See the following sections for details.

</td></tr>
</table>

> You can create multiple **Custom Attributes** with identical names. To do this, use the same **Id** and **Name**, but assign different **SourceAttributes**.

### DataType

<table>
<tr><th>Name</th><th>Description</th><th>Parameter1</th><th>Parameter2</th><th>Parameter3</th></tr>
<tr><td>

Calculation

</td><td>

Simple predefined calculations. See the section <strong>Calculation</strong>.

</td><td>

Calculation identifier

</td><td>

-

</td><td>

-

</td></tr>
<tr><td>

CodeList

</td><td>

A drop-down list with differently coloured options. See the section <strong>CodeList</strong>.

</td><td>

CodeList identifier

</td><td>

Linked CodeList attribute

</td><td>

-

</td></tr>
<tr><td>

FreeText

</td><td>

Any text

</td><td>

Character limit for the text box; use 0 for no limit

</td><td>

-

</td><td>

-

</td></tr>
<tr><td>

Numeric

</td><td>

Any number

</td><td>

Minimum value

</td><td>

Maximum value

</td><td>

Number of decimal places

</td></tr>
</table>

### Filter

The **Filter** tab in the configuration file contains conditions used to group items by specific parameters. Instead of the filter name, the filter condition itself can be written directly in the **Definition** tab, as long as it is entered in a single cell.

<img src="./media/image145.png" width="518" height="171">

**Example**

-   `filter1` could not be written in the **Definition** tab, while `filter2` would work.

-   The `filter1` attribute is applied to all objects that meet the following criteria: the pipeline attribute starts with `03-LC-1`, is exactly `02-LC-1001`, or is exactly `Pipeline=PR01-LS-2001`.

### CodeList

<table>
<tr><td>

<img src="./media/image146.png" width="203" height="279">

</td><td>

The **CodeList** tab contains the details for the DataType `CodeList` used in the **Definition** tab. CodeLists generate drop-down menus in UDiTH for the custom attribute.

</td></tr>
<tr><td>

<img src="./media/image147.png" width="267" height="439">

</td><td>

The **Name** is shown in UDiTH. Each following row without a name belongs to the attribute name specified most recently. For example, after `CS_State`, all values and colours from `B2` to `C6` are part of the `CS_State` attribute.

</td></tr>
</table>

**Value:** The text for the contents of the custom attribute drop-down in UDiTH.

**Color:** The colour of the square next to the values in the attribute drop-down. When filtering by attributes, this colour is also used for the corresponding 3D object in the main view.

### Calculation

Calculations are predefined functions that are executed for each element.

<table>
<tr><th>Name</th><th>Description</th></tr>
<tr><td>

TOS

</td><td>

`TOS` (Top Of Steel) returns the elevation in metres at the highest point of the element.

</td></tr>
<tr><td>

BOS

</td><td>

`BOS` (Bottom Of Steel) returns the elevation in metres at the lowest point of the element.

</td></tr>
<tr><td>

ElementColor

</td><td>

Returns the element's current primary colour as a hex code.

</td></tr>
<tr><td>

OriginalColor

</td><td>

Returns the element's original primary colour as a hex code.

</td></tr>
<tr><td>

VisibleColor

</td><td>

Returns the element's visible colour as a hex code, taking temporary UDiTH features into account, for example CodeList colour, highlighting, or centre of gravity.

</td></tr>
<tr><td>

StaticText

</td><td>

Displays the value from `DefaultValue`.

</td></tr>
<tr><td>

Bounds

</td><td>

Returns the bounding coordinates. It uses a format string as `Parameter1` and inserts the values accordingly. The default format is `(%lowX%, %lowY%, %lowZ%) (%centerX%, %centerY%, %centerZ%) (%highX%, %highY%, %highZ%)`.

</td></tr>
</table>

### Meta

The **Meta** worksheet tab is used for general information.

<table>
<tr><th>Key</th><th>Value</th></tr>
<tr><td>

Email_To

</td><td>

Preset value used as the recipient when sending a change-set email

</td></tr>
<tr><td>

Email_Subject

</td><td>

Preset value used as the subject when sending a change-set email

</td></tr>
<tr><td>

Workcard_Header

</td><td>

Overrides the work card text header

</td></tr>
<tr><td>

WorkcardMail_To

</td><td>

Like `Email_To`, but for work cards

</td></tr>
<tr><td>

WorkcardMail_Subject

</td><td>

Work card email subject; can use special keywords

</td></tr>
<tr><td>

WorkcardMail_Body

</td><td>

Prefix for the work card email body; can use special keywords

</td></tr>
</table>

The meta keys **WorkcardMail_Subject** and **WorkcardMail_Body** can use special placeholder values that are filled in automatically when needed.

<table>
<tr><th>Placeholder</th><th>Description</th></tr>
<tr><td>

%workcard%

</td><td>

The `Work` value of the currently selected work card

</td></tr>
<tr><td>

%devicename%

</td><td>

The user's device identifier

</td></tr>
<tr><td>

%date%

</td><td>

Current date

</td></tr>
</table>

## Import / Export All Changes

<table>
<tr><td>

<img src="./media/ButtonExportCustomSettings.png" width="44" height="44"><img src="./media/ButtonImportCustomSettings.png" width="44" height="44">

</td><td>

You can export changes made to custom attributes to an Excel file or import changes made.

</td></tr>
</table>

The Excel file will contain the following information:

<img src="./media/image149.png" width="482" height="161">

## Email

Changes made to **Custom attributes** during the current session are copied to the clipboard and your email software is opened.
