Export and Import with PML
- Last UpdatedOct 14, 2024
- 2 minute read
You can use PML to migrate grids, datasheet templates, database views, and view sets between projects. You export to, and import from, a datal (.dtl) file.
Category name
To import exported grids successfully, you must specify the name of the category to which they will be imported. You do this, before the import, with the set name command.
Open the Command Window from the Rules tab. Then select the Grids tab and use the Set Name command. For example:
set name /instrumentation
Namespace
Whichever type of object you export or import, you must first import the required namespace.
In the Command Window, specify:
import 'Aveva.Engineering.DatalOperations'
using namespace 'Aveva.Engineering.DatalOperations'
Export objects
For exports, create an object for the PMLExportManager. Specify the object's name according to the the type of object you are exporting. For example:
|
Type |
Command |
|
Grid |
!gridExport = object PMLExportManager() |
|
Datasheet template |
!datasheet = object PMLExportManager() |
|
Database view |
!view = object PMLExportManager() |
|
Database view set |
!viewset = object PMLExportManager() |
Import objects
Similarly, for imports, create an object for the PMLImportManager.
For example:
!importGrid = object PMLImportManager()
Array
For exports, you must create an array of the reference IDs of the elements to export or import. For example:
!ht = OBJECT ARRAY()
!ht[1]='=2013287254/28542'
!ht[2]='=2013303638/8163'
!ht[3]='=2013311830/988'
You can use the q ref command to find the IDs. Select a grid in the Grids Explorer and enter q ref in the Command Window.
Export method
Call the method by passing the array, the folder path for the export, and the file name for the datal file. For example:
!gridExport.ExportElements(!ht,'D:\Migration','Grids.dtl')
Import method
Call the method by specifying the file path of the datal file. For example:
!importGrid.ImportElements('D:\Migration\Grids.dtl')
Export example
import 'Aveva.Engineering.DatalOperations'
using namespace 'Aveva.Engineering.DatalOperations'
!gridExport = object PMLExportManager()
!ht = OBJECT ARRAY()
!ht[1]='=2013287254/28542'
!ht[2]='=2013303638/8163'
!ht[3]='=2013311830/988'
!gridExport.ExportElements(!ht,'D:\Migration','Grids.dtl')
Import example
import 'Aveva.Engineering.DatalOperations'
using namespace 'Aveva.Engineering.DatalOperations'
!importGrid = object PMLImportManager()
!importGrid.ImportElements('D:\Migration\Grids.dtl')