Export Templates

Export templates are Templex programs that export curve data to files.

When you click File > Export Curves, you select a desired template from the Format list. The program provides a number of built-in templates for exporting to a variety of useful formats. You can also write your own templates and register them through your preference file using the *RegisterExportTemplate() statement as shown below:
*Id("MotionView v4.0")
*BeginDefaults()
  *BeginPlotDefaults()                                    
    *RegisterExportTemplate("MyFormat", "my.tpl", "dat") 
    *RegisterImportTemplate("/usr/people/altair/new_format.tpl")
    *RegisterExternalReader("/usr/people/altair/altair_exe")
  *EndPlotDefaults()
*EndDefaults()

The export template file referenced in the *RegisterExportTemplate() statement is a Templex program file. The Templex program utilizes the numcurves(), numpts(), curvelabel(), curvex() and curvey() functions to access the data in each plot which is selected in the export dialog.

Example export template:
{   ncrvs = numcurves();    
    ncrvs, %d; cr(); ' output the number of curves    
    for (i = 0; i < ncrvs; i++)        
        xvect = curvex(i);        
        npts = numpts(xvect);        
        for (j = 0; j < npts; j++)
            xvect[j], %e; cr(); ' output X vector in exponential format        
        endloop
        yvect = curvey(i);
        npts = numpts(yvect);
        for (j = 0; j < npts; j++)
            yvect[j], %e; cr(); ' output Y vector in exponential format
        endloop
     endloop
}