# Introduction

**DrawingXpert** is a highly automated and flexible tool for modifying the content of SmartSketch drawings based on various rules.
The tool can process individual drawings as well as folders and subfolders.
It can be run either interactively or in command-line mode.

## Prerequisites

-   Microsoft Windows 7 or later

-   Microsoft Excel 2003 or higher

-   Intergraph SmartSketch 2014 R1 or higher

## General functions and Graphic User Interface

**DrawingXpert** has separate sections for **Input**, **Configuration**, **Coordinate Shift**, and **Output**.
When **DrawingXpert** starts, a log file is created in the default location `%temp%/DrawingXpert`.

<img src="./media/image8.png" width="789" height="833">

+------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------+
|<img src="./media/image22.png" width="44" height="44">|This is the area in which the input is defined. You can select either individual files or folders.|
|                                                      |If a folder is selected, **DrawingXpert** also searches all subfolders. Only files with the defined extension are processed.|
+------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------+
|<img src="./media/image23.png" width="44" height="44">|Location of the configuration file in which the rules for modifying the drawings are defined.|
+------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------+
|<img src="./media/image24.png" width="44" height="44">|Section in which the movement can be defined. Movement means the relative distances for the coordinate labels on a drawing.|
|                                                      |**DrawingXpert** reads and calculates the new values for the coordinate labels.|
+------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------+
|<img src="./media/image25.png" width="44" height="44">|Output folder for the drawings after modification. There are two possible options:|
|                                                      |If the input folder is the same as the output folder, the drawings are overwritten with the changes. If a different output folder is defined, the modified drawings are saved there and the source files remain unchanged. In all cases, **DrawingXpert** creates a backup of all processed drawings.|
+------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------+
|<img src="./media/image26.png" width="44" height="44">|The **Export text to Excel** button extracts all text from SmartSketch and stores it in the Excel configuration file, in the `ScanResult` and `ScanResultLink` sheets.|
|                                                      |If the Excel file does not exist, a new file is created automatically. If the file already exists, the existing sheets are extended with the new text.|
|                                                      |All extracted texts are exported only once per file in order to avoid duplicates.|
+------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------+
|<img src="./media/image27.png" width="44" height="44">|**Replace in Drawings** starts processing of the drawings, including text replacement and, if enabled, transformation to new coordinates.|
+------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------+

## Settings

> All settings made in the UI, such as the path to the Excel configuration file and the input and output folders, are saved in a `settings.ini` file. By default, this file is saved in:
> `....user\AppData\Roaming\CAXperts\DrawingXpert\settings.ini`
>
> This settings file can also be saved to another location and loaded from there by using these options:
> <img src="./media/image9.png" width="210" height="128">

## Excel Configuration file

> This file contains a set of rules for the modification on a drawing.\
> This file is delivered with the software and contains already some
> predefined examples.\
> The default location for the Configuration is:\
> \"C:\\Program Files
> (x86)\\CAXperts\\DrawingXpert\\Config\\Config.xls\"\
> From that location you should copy that into a project specific folder
> in order to make the project specific adaptions.

### ScanResult

> With "Export text to Excel" all texts from the selected drawings are written to the tab in "Scan Result".\
> For the export of your textnodes you can either use your existing
> config-file from <img src="./media/image23.png" width="44" height="44">
> Or you can create a new Excel-Workbook just by defining a new Excel-Workbook.\
> **DrawingXpert** creates this new workbook which just contains the sheets
> "ScanResult" and
> <img src="./media/image10.png" width="642" height="19">
>
> All text nodes are grouped by drawing:
>
> <img src="./media/image11.png" width="642" height="249">
>
> Both sheets are for information only. Changes made there have no effect on the drawings.

### ScanResultLinks

> There is also a sheet for the linked documents referenced to the
> drawing.\
> The links are store in the Link-table in SmartSketch:
>
> <img src="./media/image12.png" width="491" height="284">
>
> **DrawingXpert** is able to read out these links and store this information in
> ScanResultLinks-sheet:
>
> ![](./media/image13.png)
>
> ![](./media/image14.png)
>
> **DrawingXpert** can also change these links to referenced documents.
> The replacement path for the reference file must be defined in the `FindReplace` sheet.

### FindReplace

> In that sheet you define the rules for the modifications on the
> drawings.\
> The rules are based on regular expressions.
>
> ![](./media/image15.png)
>
> A detailed explanation and description how to use these regular
> expression are available in the information
> tab:![](./media/image16.png)
>
> In the **Find** column, you define the rule that determines which string should be found.
> In the **Replace** column, you define the replacement string.
>
> All rules are executed top-down -\> more than one rule can be applied
> on the same text element. To change this behaviour "Stop flag" can be
> set. If "Stop flag" is set to 1 for a particular rule which matches
> some text element, no further rules are executed on the same element.
> This prevents multiple replacements on the same text element.
>
> Xmin (m), Ymin (m), Xmax (m), Ymax (m):\
> Here you can define an area on the drawing where the rules are
> executed. Only text elements within defined range will be processed.\
> With that you can easily define the area for the title-block or area
> for the revisions.\
> This makes sure that the specific rules do not affect other parts of
> the drawing where the rules may also fit for.

### Coordinate

> This is the Coordinate-recognition tab.\
> Here you define how a coordinate-string can be distinguished from
> other textnodes.\
> ![](./media/image17.png)
>
> According to these rules, the coordinates are categorised into the X+, X-, Y+, Y-, Z+, and Z- categories.

### ChangeCoordinate

> The coordinates are changed according to the values defined in section <img src="./media/image24.png" width="44" height="44">.
> This allows coordinate changes to be applied within the drawings.
> In the **ChangeCoordinate** tab, you define what happens when a coordinate changes, for example from West (-X) to East (+X).
> You can even change the complete meaning of the coordinate prefix or suffix.
> In this way, a change from `X -12000` to `East +24000` is possible.

### ClearBlock

> In that section you can define areas on the drawing that can be
> cleared from their content.\
> You also can define dedicated object-types with in combination with a
> specific colour.\
> This functionality is very useful to empty complete revision blocks or
> dedicated fields in a title block.
>
> <img src="./media/image28.png" width="901" height="572">

### TitleBlock

> With that functionality you can "fill" your TitleBlock fields again
> that you have deleted before with the new values.\
> Here you define the name of the single parts of a line for a
> revision:\
> e.g.\
> ![](./media/image20.png)

### TitleBlockDefinition

> In the Title Block definition you define where these cells are placed
> on the drawing together with the Font, Font size, Colour and Typewrite.
>
> ![](./media/image21.png)
>
> With that definition, you are able to create new entries on a drawing.
