# CopyMoveRotate

## Introduction

**CopyMoveRotate** is a software utility for copying, moving, and rotating models and drawings in Intergraph PDS. Rotation of drawings, and moving or copying drawings with composite views, is not supported in this version.

Models can be copied within a single project as well as between two projects. Lines and equipment can also be copied between projects and deleted. In addition, design schema values, for example `Line IDs` and `Unit Code`, together with equipment and raceway attributes, can be edited by using Microsoft Excel.

**CopyMoveRotate** also provides functionality for changing `Site IDs`, and or model index numbers or partition numbers, names, and descriptions, of models and drawings. Names and descriptions can also be edited for areas. **CopyMoveRotate** can also be controlled by using command-line parameters.

## Installation

### Setup

Requirements:

-   Supported operating systems:

```{=html}
<!-- -->
```
-   Microsoft Windows XP

-   Microsoft Windows Server 2003

-   Microsoft Windows Vista

-   Microsoft Windows 7 or later

```{=html}
<!-- -->
```
-   PDS 6.4 or later

-   MicroStation SE/J

-   Microsoft Excel 2000 or later

Administrator rights are required on each computer to install
**CopyMoveRotate.**

### Working with CopyMoveRotate

When you start **CopyMoveRotate**, the main window shows up:

![](./media/CopyMoveRotate_image8.jpg)

The main window is divided into three functional parts:

-   The control area on the left side

-   The project tree view on the right side and

-   The events log at the bottom of the window

#### Privilege manager

The **Privilege manager** allows you to lock functions for specific
users/groups. The assignment of privileges is based on the Windows
(domain) users and groups. This means that you do not have to establish
a new privileges management system.

Group and user rights are linked by an OR operation: If a group has a
certain privilege in **CopyMoveRotate**, every user in this group will
have this privilege, even if this privilege is not explicitly stated in
the settings for this user.

The access rights are stored in an Access database
(**CopyMoveRotate**.mdb). This is located in the proj_file directory.
The privileges are thus the same for all the projects in a proj_file.

Access to the Access database should be controlled using the Windows
access rights.

The default setting is "Allow" for every user and group.

#### Settings

![](./media/CopyMoveRotate_image9.png)

Go to **Tools**→**Settings** to show up the **Settings** dialogue.

**User script file**: if defined, **CopyMoveRotate** executes a user-defined script file, `.bat`. In this batch file, the project name is already defined in the environment variable `PROJECT`. This function can be used, for example, if network drives containing project data must be mounted or environment variables must be set before the project can be accessed. In this case, PDS is not started through `PD_Shell`, but through a dedicated software program that executes the commands described above.

**Label report file:** if defined, **CopyMoveRotate** updates the corresponding labels, see *Edit piping attributes*.

**Equipment models mapping file:** if defined, **CopyMoveRotate** preserves nozzle connections after copying piping models, see *Copy models/drawings*.

**MicroStation timeout:** defines the timeout in minutes for the **Transform models/drawings** command.

### Selecting a PDS project

Go to **File** → **Select PDS Project**. This opens the following dialogue window:

![](./media/CopyMoveRotate_image10.png)

1.  Select a PDS control file by using the **Browse** button.

2.  Select a PDS project from the list by double-clicking it.

> You can drop a plain ASCII file with model and drawing names (separated by line breaks) onto the tree view to automatically tick the check boxes of these models/drawings. Wildcards (\*, ?) may be used to define the model/drawing names in the ASCII file.

####  Copy models/drawings

1.  Select the models/drawings or complete areas in the tree view for
    copying.

```{=html}
<!-- -->
```
4.  The Export function will transfer it to Excel

5.  Edit the Excel file. There is one workbook for the models and one
    workbook for the drawings.

![](./media/CopyMoveRotate_image13.png)

The source structure must not be changed. The new destination structure for models and drawings can be configured by the user. All fields are optional, except the drawing or model name. For empty fields, the source value is used. For existing areas and subprojects, the description is changed according to the respective destination field. After saving the input file, use **Import** to start the copy process. New areas and framework subprojects can also be created in this way. The models and drawings, including the drawing views, are copied.

**Overwrite existing models/drawings**: if this checkbox is selected, **CopyMoveRotate** checks whether a model or drawing with the same name already exists. If it does, it is overwritten, that is, the same `model_index_no`, `partition_no`, or `dwg_index_no` is used. This is appropriate if the same models or drawings are copied automatically on a regular basis. Without this checkbox, the target models or drawings would need to be deleted and replaced manually from the original files. This would cause gaps in the use of `model_index_no` and `partition_no`, and the defined `SiteID` range would overflow quickly. If this checkbox is not selected, copying stops with an error message if a target file with an identical name already exists.

**Preserve nozzle connections:** if a piping model contains nozzle connections, they become invalid after copying the piping and corresponding equipment models because of the new `partition_no` for the equipment models. In order to correct this and preserve nozzle connections in piping models after copying, the **equipment models mapping file** must be defined under **Tools → Settings**. This file contains the mapping between source and destination equipment models and has exactly the same format as the Excel file used for copying models and drawings. Select the equipment models and click **Export** to create it. The destination model name must be defined and must already **exist** before copying the piping models.

The workflow demonstrating how to preserve nozzle connections:

1.  Select equipment models to copy

```{=html}
<!-- -->
```
6.  Export selection to Excel

7.  Edit Excel file

8.  Import and copy equipment models

9.  Define the path to this Excel file from above in Tools-\>
    Settings-\>Equipment models mapping file

10. Now proceed with copy of piping models

**Copying of models between projects:**

-   Export models in source project

-   Import models in destination project

> **Import only models/drawings changed since days:** if defined CopyMoveRotate processes only models/drawings, which were changed within the last N days. The changes are recognized by using the revision_date from pdtable_113.

#### Edit models/drawings

![](./media/CopyMoveRotate_image14.png)

All models and drawings can be renamed (and/or model/drawing description can be changed) through an Excel workbook.

> Naming conventions for models and drawings according to the PDS settings must be recognized.

#### Delete models/drawings

![](./media/CopyMoveRotate_image15.png)

All models/drawings in the Excel file will be deleted. The file may not be changed.

> All files named Model.\*/Drawing.\* will be deleted, too

> **Import only models/drawings changed since days:** if defined CopyMoveRotate processes only models/drawings, which were changed within the last N days. The changesvare recognized by using revision_date from pdtable_113.

#### Transform models/drawings

Before **CopyMoveRotate** starts a process, the participating models/drawing are saved in the backup directory. The directory for reporting and backups is C:\\temp by default.

1.  Moving Models and Drawings

-   Tick all models/areas or complete project you want to move

![](./media/CopyMoveRotate_image16.png)

-   Input distance values for the x, y, z direction to the new location

> The distance values for moving are relative, so absolute values are not needed.

-   FrameWorks views will also be translated and rotated if the checkbox
    "Transform FrameWorks views" is checked

-   By pressing the **Import** button the models and drawings are
    processed consecutively.

11. Rotating Models and Drawings

-   For the pivot point of rotation an absolute coordinate value is
    needed.

![](./media/CopyMoveRotate_image17.png)

-   If a Design Volume Coordinate System is used in the project, the
    values for this can be added in a separate form:

> The rotation of models/drawings is only possible around the elevation axis. Drawings with composite view cannot be processed.

By pressing the **Transform selected items** button the models and
drawings are processed consecutively.

**Export ... to Excel** generates an Excel file:

![](./media/CopyMoveRotate_image18.png)

You can change the rotation settings on the first tab.

#### Handling for non-PDS files

MicroStation files can also be transformed by CopyMoveRotate.

![](./media/CopyMoveRotate_image19.png)

Drag and drop the directory containing the MicroStation files, or a single MicroStation file, on to the **Models** node of the tree view in order to treat the file as a model, or on to the **Drawings** node in order to treat it as a drawing.

Use the context menu (right mouse button) to remove non-PDS files from
the tree view.

![](./media/CopyMoveRotate_image20.png)

> **Move&Rotate** can be used interactively or by using Microsoft Excel for batch mode.

> **Import only models/drawings changed since days:** if defined CopyMoveRotate processes only models/drawings, which were changed within the last N days. The changes are recognized by using revision_date from pdtable_113.

### Change site ID, index or partition of models/drawings

![](./media/CopyMoveRotate_image21.png)

For all models the *site_id*, *model_index_no* and *partition_no* can be
changed through an Excel workbook. For drawings the *site_id* and
*dwg_index_no* can be changed accordingly.

The user has the following options:

- Key in a new SiteID (this SiteID must already exist)
- Key in a new model_index_no/partition_no (has to be unused)
- Key in a new SiteID and model_index_no/partition_no (model_index_no/partition_no have to be in the range of the new SiteID)

**Correct reference files**: if selected, the logical names of reference files in all models of the project are corrected if the `model_index_no` of the edited model has been changed. This can take some time if the project contains many models. If **Correct reference files** is not selected, the logical names of the reference files are not corrected. Referenced models are then no longer recognised as intelligent PDS models, but are displayed as standard MicroStation reference files. To correct this, the models must be re-referenced manually in PDS.

> The ranges for the *site_id* must first be set in PDS. When changing the *site_id* as the only value, the *model_index_no* and the *partition_no* will be automatically set to the next free values according their PDS *site_id* range settings in PDS.

> **Import only models/drawings changed since days:** if defined CopyMoveRotate processes only models/drawings, which were changed within the last N days. The changes are recognized by using revision_date from pdtable_113.

### Lock/unlock models/drawings

![](./media/CopyMoveRotate_image22.jpg)

Models and drawings can be locked or unlocked. Enter the keyword **locked** or **unlocked** in the **Lock status** column. **Lock owner** can be any user-defined string. If nothing is entered, the name of the current user is used as **Lock owner**.

### Edit areas

![](./media/CopyMoveRotate_image23.png)

Area and/or description may be changed.

### Copy lines

1.  Select the lines in the tree view for copying.

```{=html}
<!-- -->
```
12. The Export function transfers them to Excel

13. Edit the Excel file.\
    ![](./media/CopyMoveRotate_image24.png)

14. The source structure must not be changed. The new destination
    structure for lines may be configured by the user. All fields are
    optional here (except model name), for empty fields the source value
    is taken.

Copying of lines between projects:

-   Export lines in source project

-   Import lines in destination project

<table>
<tr><td>



</td><td>

There is no check against the label description library. If a LineID consists out of several attributes (e.g. fluid code + NPD + ...) it won't be automatically updated; concatenated values must be updated separately. This change of database values should therefore only be done by experienced PDS administrators.

</td></tr>
<tr><td>



</td><td>

Project version, graphical symbology settings, RDB and DDL structure must be equal in source and destination projects.

</td></tr>
<tr><td>



</td><td>

By default only unapproved lines will be processed. Enabling the checkbox **Process approved items** change this behaviour.

</td></tr>
<tr><td>



</td><td>

**Check for overlaps between segments:** if ticked, CopyMoveRotate will check before copying, if line segments to copy overlap with segments of lines which are already in the target model (the line to copy will not be checked if it overlaps internally). The copy process will be cancelled if there is an overlap. If **Check for overlaps between segments** is not ticked, lines will be copied without any checks.

</td></tr>
<tr><td>



</td><td>

**Import only models/drawings changed since days:** if defined CopyMoveRotate processes only models/drawings, which were changed within the last N days. The changes are recognized by using revision_date from pdtable_113.

</td></tr>
</table> 

### Edit piping attributes

<table>
<tr><td>

![](./media/CopyMoveRotate_image25.png)

</td><td>

The Design Schema for piping attributes from pdtable_12, \_50, \_67, \_80 can be revised with values from an Excel Workbook. For this, first configure the attributes you want to export by selecting the appropriate attributes from your single pd_tables.

</td></tr>
</table>

The attributes will be reported to an Excel file (  the report won't
be an 1:1 image of the DD-Schema). If the **Group rows** checkbox is
ticked on the entries will be grouped also.

![](./media/CopyMoveRotate_image26.jpg)

The different `pd_table` sections are placed in separate sheets. The attribute values can be adapted in the user attribute area.

**Updating labels:** if any of the attributes that form part of the label have been changed, **CopyMoveRotate** can automatically update the affected labels if a label report file is defined in **Tools → Settings**.

> Use PD_Shell-\>Reference Data-\>Standard Note Library-\>Report to create label report file.

CopyMoveRotate reads the label report file and replaces spaces with underscores in all label names. If the resulting string exists as a column of `pdtable_12`, DD schema, the label is updated. The following standard PDS label types are always updated:

-   310 - line_number_label

-   311 - line_id

-   335 - inspections_iso_id

<table>
<tr><td>



</td><td>

The user must not change attributes in the system attributes area.

</td></tr>
<tr><td>



</td><td>

The **change of database** values should therefore only be done by **experienced PDS administrators**.

</td></tr>
<tr><td>



</td><td>

Updating of labels is limited to standard PDS format settings and attributes. For special cases and settings the attributes which are updated by using labels have to be edited using Excel similar to stand-alone values.

</td></tr>
<tr><td>



</td><td>

Naming conventions, attribute type and attribute length according design.ddl must be recognized.

</td></tr>
</table>
  
By default, only unapproved lines are processed. Enabling the **Process approved items** checkbox changes this behaviour.
The **Group rows** checkbox, which is ticked on by default, will eliminate redundant entries in the output Excel sheet.
**Import only models/drawings changed since days:** if defined CopyMoveRotate processes only models/drawings, which were changed within the last N days. The changes are recognized by using revision_date from pdtable_113.

### Delete lines

![](./media/CopyMoveRotate_image27.png)

All lines in the Excel file are deleted. The file must not be changed.

**Delete Lines** can be used interactively or using Microsoft Excel (for batch mode).\
By default only unapproved lines will be processed. Enabling the checkbox **Process approved items** change this behaviour.
**Import only models/drawings changed since days:** if defined CopyMoveRotate processes only models/drawings, which were changed within the last N days. The changes are recognized by using revision_date from pdtable_113.

### Transform lines

See chapter *3.8* *Transform models/drawings*.

   By default only unapproved lines
will be processed. Enabling the checkbox **Process approved items**
change this behaviour.

   **Import only models/drawings
changed since days:** if defined CopyMoveRotate processes only
models/drawings, which were changed within the last N days. The changes
are recognized by using revision_date from pdtable_113.

### Copy equipment

1.  Select the equipment in the tree view for copying.

```{=html}
<!-- -->
```
15. The Export function transfers them to Excel

16. Edit the Excel file.\
    ![](./media/CopyMoveRotate_image28.png)

17. The source structure must not be changed. The new destination
    structure for equipment may be configured by the user. All fields
    are optional there (except model name), for empty fields the source
    value is taken.

Copying of equipment between projects:

-   Export equipment in source project

-   Import equipment in destination project

>   DDL structure must be equal in
source and destination models.

>   By default only unapproved
equipment will be processed. Enabling the checkbox **Process approved
items** change this behaviour.

>   **Import only models/drawings
changed since days:** if defined CopyMoveRotate processes only
models/drawings, which were changed within the last N days. The changes
are recognized by using revision_date from pdtable_113.

### Edit equipment attributes

![](./media/CopyMoveRotate_image29.png)

The attributes of all equipment selected in the tree view are written
into an Excel file, where you can change these values. The saved Excel
file can be imported and the attributes are updated accordingly.

>   Naming conventions, attribute
type and attribute length according eqp.ddl must be recognized.

>   By default only unapproved
equipment will be processed. Enabling the checkbox **Process approved
items** change this behaviour.

### Delete equipment

![](./media/CopyMoveRotate_image30.png)

All equipment in the Excel file will be deleted. The file may not be
changed.

>  **Delete equipment** can be used
interactively or using Microsoft Excel (for batch mode).

>   By default only unapproved
equipment will be processed. Enabling the checkbox **Process approved
items** change this behaviour.

>   **Import only models/drawings
changed since days:** if defined CopyMoveRotate processes only
models/drawings, which were changed within the last N days. The changes
are recognized by using revision_date from pdtable_113.

### Transform equipment

See chapter *3.8* *Transform models/drawings*.

>   By default only unapproved
equipment will be processed. Enabling the checkbox **Process approved
items** change this behaviour.

>   **Import only models/drawings
changed since days:** if defined CopyMoveRotate processes only
models/drawings, which were changed within the last N days. The changes
are recognized by using revision_date from pdtable_113.

### Edit nozzle attributes

See chapter *3.17* *Edit equipment attributes*.

### Edit raceway attributes

<img src="./media/CopyMoveRotate_image31.png" width="562" height="169"> 

The attributes of all raceway models selected in the tree view are
written into an Excel file, where you can change these values. The saved
Excel file can be imported and the attributes are updated accordingly.

>  Naming conventions, attribute
type and attribute length must be recognized.

>   **Import only models/drawings
changed since days:** if defined CopyMoveRotate processes only
models/drawings, which were changed within the last N days. The changes
are recognized by using revision_date from pdtable_113.

### Edit reference files

![](./media/CopyMoveRotate_image32.png)

The user may change reference files of models/drawings with this
function. If **CopyMoveRotate** finds the new reference file in
pdtable_113 of the current project schema, it will automatically
retrieve the logical name and description file and attach the reference
file as an intelligent PDS model.

If the user changes the drawing border file, logical name and
description of the new reference file will stay constant -- "BORDER",
"DRAWING BORDER FILE".

The source reference file will be replaced in all drawing views.

### Command line mode

**CopyMoveRotate** also works in command line mode. If you click on
**Tools** → **Create batch file**, a demonstration batch file will be
generated.

copymoverotate /? shows the available command line parameters:

\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\--

CAXperts CopyMoveRotate

\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\--

Command line arguments for CopyMoveRotate.exe:

/CMD control_file.cmd - Path to the control file.

If control file is not defined, last

control file will be used.

/Project project_name - PDS-Project name.

If project name is not defined, last

project will be used.

/Mode mode - Execution modes:

MODEL_COPY - copy models/drawings

MODEL_EDIT - edit models/drawings

MODEL_DELETE - delete models/drawings

MODEL_TRANSFORM - transform models/drawings

CHANGE_SITE_ID - change SiteID/Index/Partition

of models/drawings

CHANGE_LOCK_STATUS - lock/unlock models/drawings

AREA_EDIT - edit areas

DD_EDIT - edit piping attributes

LINE_COPY - copy lines

LINE_DELETE - delete lines

LINE_TRANSFORM - transform lines

EQP_COPY - copy equipment

EQP_EDIT - edit equipment attributes

EQP_DELETE - delete equipment

EQP_TRANSFORM - transform equipment

EE_EDIT - edit raceway attributes

REF_EDIT - edit reference files of models/drawings

/XLS excel_file.xls - Path to the Excel file to process

/Config config_file.ini - Config file.

If not defined, last

config file will be used.

/export - If defined excel file

will be created for defined execution mode

/batch - If defined CopyMoveRotate

will be run in batch mode

Example:

CopyMoveRotate.exe /CMD control_file.cmd /Project project_name /Mode
MODEL_COPY

/XLS excel_file.xls /batch

###  Colour mark-up in reports

Most **CopyMoveRotate** processes are reported into Excel workbooks. For
every processed model/drawing the status is indicated in three possible
colours:

-   Status: OK; colour: green: the model/drawing passed the process
    without any error.

-   Status: warning; colour: yellow: while processing the model/drawing
    some problems occurred, which are reported in the next field
    'description'. These warning messages should be checked in the
    appropriate models.

-   Status: error; Colour: red: the process for the model/drawing
    failed. The reason for this is described in the 'description' field.