I am writing an Interactive Extension with python (following this KB article). The python script generates a Grid Sag Surface data file (following the format and instructions in these two links: here and here). This file loads properly when manually using the Import tool in the Surface Properties drop-down, as explained in the first link.
The goal is to automate this, and I have struggled to figure out the python code to do the import. Based on the second link, I tried the following:
gSurf1 = TheLDE.GetSurfaceAt(5) # Surface 5 is the grid sag
gSurf1.ImportData.ImportDataFile(gFile) # Load in sag data
This did not throw an error. Nor did it work. Nothing changed in the prescription. I have written several interactive extensions in the past, so I think that the basic procedure is Ok. I suspect that the problem is with the syntax of the import statement (which is intended for MATLAB).
I searched the ZOS-API Help tool for both ImportData and ImportDataFile. There are some cryptic entries, but it is not clear how to translate them into python (or to the above MATLAB statement for that matter).
FWIW, I am using the old-style COM link, not .NET
Thanks in advance for any help.
Tom