Exporting plot with API

Altair Forum User
Altair Forum User
Altair Employee
edited October 2020 in Community Q&A

Hi,

 

I have plotted data in POSTFEKO with API scripting, but I do not know how I can export each graph as a .dat file. Can someone help me with that? And is there a macro recording option for POSTFEKO, because I could not find it. Thanks in advance!

 

With kind regards,

Meerten

Unable to find an attachment - read this blog

Tagged:

Answers

  • JIF
    JIF
    Altair Employee
    edited October 2018

    Hello Meerten,

     

    The Graph object has a method to export traces. Below is an extract from the documentation.

    ExportTraces

    Export the graph traces to the specified tab separated file.

    • Input Parameters
      • filename(string): The name of the exported data file without its extension.
      • samples(number): The number of samples for continuous data. This value will be ignored if the first trace on the graph is discrete.

     

    If you want to loop over all the graphs and export the traces to .dat files, I suggest that you create a FOR loop and loop over all the graph collections that you want to export and then export use the method above. It will be something like the code below:

     app = pf.GetApplication() for ii = 1, app.CartesianGraphs.Count do   	local graph = app.CartesianGraphs[ii]     graph:ExportImage('Cartesian_Graph'..index, 100) end

    This is just for Cartesian graphs. You will need a similar loop for other graph types that you want to export (polar, Smith, etc.)

     

    Note that I didn't test the code. ;)/emoticons/default_wink.png' srcset='/emoticons/wink@2x.png 2x' title=';)' width='20'>

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited October 2018

    Hi Jif,

     

    Thanks for the quick and great response! I've got what I wanted, many thanks to you!

  • Torben Voigt
    Torben Voigt Altair Community Member
    edited October 2018

    Hi Meerten,

     

    Macro recording in POSTFEKO is still under development, too early to give an estimation when it'll be available.

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited October 2018

    @Torben Voigt That would be great!