# Builder

## Introduction

The **Builder** creates UDiTH 3D model data, PDF documents, and PID models, including attributes, project hierarchy, and 2D drawings (ISOs), from various sources using the output of the CAXperts adapters. It can also apply colour files, import Excel data, and create 3D PDFs.

The **Builder** cannot be used without the output files created by the adapters. Please refer to the adapter manuals for information on how to create those output files.

<img src="./media/Builder2_image2.png" width="632" height="426">

> A connection to `20.126.54.190` (`api365.slascone.com`) on port `443` is required. See [Licence upgrade and installation](https://help.caxperts.com/Licensing/Licence%20upgrade%20and%20installation).

## Model creation

<img src="./media/Builder2_image8.png" width="446" height="311">

This chapter explains how to create a 3D model or PDF file.

### Input file / folder

Select the browse button to the right of **Input file** and choose one of the file types listed in the following table. To continue, you must select at least one valid file or a folder containing a valid file.
![](./media/Builder2_image9.png)

<table>
<tr><th>File ending</th><th>Meaning</th></tr>
<tr><td>

.upvc

</td><td>

A regular UPV database containing 3D objects.

</td></tr>
<tr><td>

.upvm

</td><td>

A merged UPV database created from multiple `.upvc` files.

</td></tr>
</table>

![](./media/Builder2_image10.png)

Select **Without 3D data** if you do not want a 3D model to be created and only want PDF or IntelliPID models.

> While browsing, press and hold **Ctrl** to select multiple `.upvc` or `.upvm` files. The result is a combined model consisting of all selected sub-models.

### Packages definition file

Select the browse button to the right of **Package definition file (optional)**. Click **Clear** to empty the input box. You do not need to select a package definition file in order to create models. To learn how to create and use packages, refer to the UDiTH documentation, chapter **Packages**.

![](./media/Builder2_image11.png)

Selecting **Complete model** creates the full model.

Selecting **Packages** creates one UPV model for each package in the package definition file, containing only the objects defined in those packages.

![](./media/Builder2_image12.png)
 
> Any `.xlsx` file can be selected when browsing for package files, but only files structured as described in the **Packages** chapter of the UDiTH documentation will work as intended.

### Generate output

<img src="./media/Builder2_image13.png" width="300" height="616">

After selecting the model files and any additional packages, click **Generate output** in the bottom-right corner of the Builder window to open **Output configuration**.

### Output type

![](./media/Builder2_image14.png)

Creates either a UDiTH model or a 3D PDF document.

### Settings

![](./media/Builder2_image15.png)

The output folder is the location in which the model or PDF is generated.

The colour configuration file can be any `.xlsx` or `.txt` file.

The expiration date prevents the generated output from being used after the specified date.

> Any `.xlsx` file can be selected when browsing for colour files, but only files structured as described in the **Colour Files** chapter of the UDiTH documentation will work as intended.

### UDiTH settings

These settings are available only if the output type is **UDiTH**.
![](./media/Builder2_image16.png)

#### Display styles

**Display Styles Directory** makes all colour schemes contained in the selected folder available in the model as default display styles, without needing to select the colour files again.

#### Link mapping

**Link mapping file** creates links to external documents in the object attributes, as defined in the mapping file. Refer to the **Linking** chapter in the UPV documentation for information on how to create a link mapping file.

#### PID 3D mapping

The **PID <-> 3D mapping** file creates links between PID objects and their 3D counterparts. Refer to the AdapterForSpid documentation for information on how to create a PID 3D mapping file. A database must be selected in [IntelliPID database](#intellipid-database) for the mapping file to work. To create a PID 3D mapping file, an Excel sheet must contain the following cells:

<img src="./media/Builder2_image17.png" width="722" height="30">

`IntelliPidAttribute` and `3DAttribute` must contain the names of the attributes to be mapped. `IntelliPidRegEx` and `3DRegEx` must contain the regular expression commands required to make the values of the IntelliPid and 3D attributes match. Only character deletion is allowed; no characters may be added with the regular expression command.
<img src="./media/Builder2_image18.png" width="722" height="107">

> Any `.xlsx` file can be selected when browsing for link or PID mapping files, but only files structured as described in the relevant documentation will work as intended.

#### Reuse 2D/3D projections

The **2D <-> 3D mapping** source directory defines the location of `.upvf` file or files containing picture-based 2D/3D projections that should be made available again in the new UPV model. Images from 2D/3D projections stored in those `.upvf` files are converted directly into the UPV model.

![](./media/Builder2_image33.png)

When selected, user authentication is required for downloaded models.

![](./media/Builder2_image19.png)

When **Allow download** is selected, a user can download the model to a local machine instead of working only with a server-based version.

![](./media/Builder2_image20.png)

When selected, the view cube in UPV shows XYZ coordinates instead of compass directions. This is only the default view mode and can be changed later in the UPV settings.

### 3D PDF settings

![](./media/Builder2_image21.png)

 3D PDF documents can be protected with a password.

## Tools settings

![](./media/Builder2_image22.png)

The **Tools Settings** provide many advanced configuration options for the generated output.

### General

<img src="./media/Builder2_image34.png" width="616" height="478">

#### Export caching

The **Export Caching** option enables the program to reuse already calculated laser scan data. If the same laser scan model is exported repeatedly, the program saves time by reusing already calculated information. Only changes generally need to be recalculated.

<img src="./media/Builder2_image23.png" width="616" height="478">

> This option works best with laser scan data, but 3D data is also supported.

> This option results in significantly larger data files in exchange for faster processing.

#### Configuration file

Select the initial configuration file for the UDiTH model. This can later be changed in UPV itself.

> Any `.ini` file can be selected when browsing for a configuration file, but only files structured as described in the **Configuration File** chapter of the UDiTH documentation will work as intended.

#### Aspects

Select or deselect if a specified aspect should be part of the 3D model.

### Tree

![](./media/Builder2_image24.png)

The tree hierarchy shown in UPV can be edited. Select attributes by clicking the checkbox next to them and then use the right arrow button to add them to the list, or the left arrow button to remove them. Objects with those attributes show them in the order in which they were added to the tree bar.

![](./media/Builder2_image25.png)

This functionality is available only for 3D PDF. If enabled, the attribute name is displayed before the value in the tree, for example:

Area Name: Refining Area → Unit System: Distillation → ...

### Attributes

<img src="./media/Builder_image26.png" width="469" height="361">

Drag and drop attributes to or from **Used attributes** if they are to be shown in UPV when an object with the specified attribute is selected.
Multiple attributes can be moved by selecting the checkbox next to them and using the arrows between the lists.

### Mapping
Mapping allows the transformation, rotation, and scaling of multiple models.

<img src="./media/Builder_Mapping.png" width="569">

1.  These options are used for rotation and scaling. This step is always processed first.

    In this example, `Model1.upvc` rotates around `-100,50,0` metres. Always use metres as the unit.

2.  In the second step, the model is moved by the specified distances to its destination.

><img src="./media/Builder_Icon_Info2.png" width="20"> **Use as catalog** is not applicable yet.

### Advanced

<img src="./media/Builder2_image27.png" width="469" height="316"> 

#### Document databases

Document databases are `.upvd` files. Add or remove the required files as needed. Refer to the AdapterForDocuments documentation for information on how to create document database files.

**Include all drawings:** All drawings are included in the model, regardless of whether they contain a reference to an object in the model.

**Disable PDF cache:**
PDF files can be cached for faster display in UPV. Selecting this option disables that cache. This is recommended only for very simple PDF files.

**Max cached DPI:**
- `128` - low resolution for displaying cached documents. Recommended only for less powerful end devices.
- `512` - good resolution for displaying cached documents. This is the default value.
- `1024` - best resolution for displaying cached documents, but it requires a more powerful device and more storage for the UPV model.

#### IntelliPID database

IntelliPID databases are `.upvp` files. Add a single file. To connect PID and 3D objects, also add a PID 3D mapping file as described in [PID 3D mapping](#pid-3d-mapping).

### Plugins

<img src="./media/Builder2_image28.png" width="463" height="323">

Plugins are C# libraries created with the CAXperts plugin API. To move plugins into or out of **Used plugins**, select the checkbox next to the plugin and use the arrow buttons between the lists.

The plugins themselves, together with their config files if required, must be stored in the local `%AppData%` folder of the machine running UPVBuilder.

### Command-Line Parameter Guide

1. **Prepare your files** - Ensure that you have the required input files ready.
   
2. **Choose output options** - Decide whether you want to generate a 3D PDF file, UPV files, or both.
<table>
<tr><th>Parameter</th><th>Example</th><th></th></tr>
<tr>
<td>

<b>```-input:```</b>

</td><td>

```C:\Input\Example.upvc```

</td><td>

Path to the file or directory that you want to convert into a 3D PDF or UPV file.

</td></tr>
<tr><td>

<b>```-pdf:```</b>

</td><td>

```C:\Output\Example.pdf```

</td><td>

Path where the 3D PDF file will be saved.

</td></tr>
<tr><td>

<b>```-pdfpassword:```</b>

</td><td>

```password123```

</td><td>

Password used to protect the exported PDF.

</td></tr>
<tr><td>

<b>```-expirationdate:```</b>

</td><td>

```"2099-31-12T23:59:59.9999999" OR "+30"```

</td><td>

Sets an expiration date for the exported file. You can specify either a fixed date or a duration in days.

</td></tr>
</table>

3. **Configure additional settings** - Customise colour configurations, configuration files, IntelliPID mapping files, and similar options.
<table>
<tr><th>Parameter</th><th>Example</th><th></th></tr>
<tr><td>

<b>```-output:```</b>

</td><td>

```C:\Output\Example\Output```

</td><td>

Path where the model files are saved.

</td></tr>
<tr><td>

<b>```-color:```</b>

</td><td>

```C:\Settings\Color.xls```

</td><td>

Path to a file that contains colour configurations.

</td></tr>
<tr><td>

<b>```-config:```</b>

</td><td>

```C:\Settings\Example.ini```

</td><td>

Path to the configuration file used for processing.

</td></tr>
<tr><td>

<b>```-intellipidmapping:```</b>

</td><td>

```C:\Settings\IntelliPidMapping.xlsx```

</td><td>

Path to a file used for IntelliPID mapping.

</td></tr>
<tr><td>

<b>```-package:```</b>

</td><td>

```C:\Input\PackagesDefinitionFile.xlsx```

</td><td>

Path to a file defining package definitions.

</td></tr>
<tr><td>

<b>```-disablesearchindex:```</b>

</td><td>

</td><td>

Disables creation of a search index file.

</td></tr>
<tr><td>

<b>```-outputplugins:```</b>

</td><td>

</td><td>

Outputs registered plugin names in the result.

</td></tr>
<tr><td>

<b>```-disablepdfcache:```</b>

</td><td>

</td><td>

Disables creation of PDF cache entries.

</td></tr>
<tr><td>

<b>```-pdfcachemaxdp:```</b>

</td><td>

```512```

</td><td>

Determines the highest DPI used for PDF caching. Allowed values are `128`, `512`, and `1024`.

</td></tr>
<tr><td>

<b>```-includealldrawings:```</b>

</td><td>

</td><td>

Specifies whether all drawings or only linked drawings should be included.

</td></tr>
<tr><td>

<b>```-plugin:```</b>

</td><td>

```ExamplePluginName```

</td><td>

Enables a specific plugin.

</td></tr>
<tr><td>

<b>```-drawing:```</b>

</td><td>

```C:\Input\Example.upvd```

</td><td>

Path to a drawing file.

</td></tr>
<tr><td>

<b>```-intellipiddatabase:```</b>

</td><td>

```C:\Settings\IntelliPidDatabase.upvp```

</td><td>

 Path of an IntelliPID database file.

</td></tr>
</table>

4. **Execute the Command** - Open your command prompt or terminal. Navigate to the directory where the Universal Plant Viewer Builder executable is located.

5. **Run the Command** - Use the Universal Plant Viewer Builder command followed by the desired parameters.

6. **Monitor Progress** - Keep an eye on the progress in the command prompt or terminal.

7. **Review Output** - Check the output directories for your generated files. Optionally, review the log file for any error messages or additional information.

8. **Optional Steps**
>- Activate a license key using the <b>```-licensekey```</b> parameter.
>- Specify a custom log file path using the <b>```-log```</b> parameter.

