#### Exporting to an XML File

PC-DMIS can immediately export your part program's feature and dimension data to an XML tagged format. You can then import this data into other software applications that make use of this XML structure.

After choosing where to export the file and clicking the Export button, PC-DMIS exports your current part program as an XML file at that location.

PC-DMIS exports the entire part program wrapped in <PartProgram></PartProgram> tags.

<PartProgram DateTime=”sometimestamp”>

<PartData SourceFileName=”somename” etc.. />

…..

Commands

…..

</PartProgram>

You can open up and view or edit the XML file inside an XML or text editor:

A portion of a sample part program exported in XML format

About the UseIDForExistingCommands Attribute

Near the beginning of our exported XML files, right after the <PartProgram> tag, there is a <PartData> tag. It has an attribute called UseIDForExistingCommands, highlighted below in yellow:

<?xml version="1.0"?>

<!--PC-DMIS XML Output File-->

<PartProgram DateTime="129766684431193890">

<PartData SourceFileName="D:\PartPrograms\Datapage+ with Surface Profile.PRG" PartUID="{DF9E361C-C857-4864-AA31-456AC34251D0}" PartName="Surface Profile Test" SerialNumber="" RevisionNumber="" StatisticsCount="13" GlobalUnitType="1" UseIDForExistingCommands="1" />

<!--File Header-->

The value of this attribute is either 0 or 1. By default, the XML exporter sets it to 1. When you import an XML file into a part program, the importer imports XML data differently, based on this value:

- If the value is 0 then every command read from the XML file is created as a new command and inserted at the end of the part program.

- If the value is 1 then the XML importer gets the UID (unique ID) of each command as it is read and first searches the existing part program for any command with the same UID. If it finds an existing command, the XML importer imports the data into the existing command, thereby modifying the existing command instead of appending a brand new command. If it cannot find an existing command, a new command is created and appended at the end of the part program.

Also, If the PartUID attribute (highted above in cyan) differs from the PartUID of the program you're importing into then UseIDForExistingCommands is automatically set to 0 before the XML import starts.