Hey Jeff,
First, I would STRONGLY recommend using C# rather than C++ for ZOS-API applications. C# directly uses .NET while C++ has to use COM to communicate with the ZOS-API. C# is easier to use (especially considering COM) and there are more Zemax users that can help with C#.
var win = TheSystem.Analyses.New_Analysis_SettingsFirst(ZOSAPI.Analysis.AnalysisIDM.PhysicalOpticsPropagation);
var settings = win.GetSettings() as ZOSAPI.Analysis.PhysicalOptics.IAS_PhysicalOpticsPropagation;
win.ApplyAndWaitForCompletion();
var results = win.GetResults();
foreach(var line in results.HeaderData.Lines)
{
Console.WriteLine(line);
}
If you remember trying to use Python prior to 2018, it was an absolute nightmare; before 2018 Python used COM to connect to the ZOS-API so I researched and created the current Python template using PythonNET. Now C#, Mathematica, Matlab and Python all use .NET to directly connect to the ZOS-API and C++ is the only outlier.
If you have to use C++, here is how you can get the header data:
auto win = TheSystem->Analyses->New_Analysis(AnalysisIDM::AnalysisIDM_PhysicalOpticsPropagation);
IAS_PhysicalOpticsPropagationPtr settings = win->GetSettings();
win->ApplyAndWaitForCompletion();
auto results = win->GetResults();
SAFEARRAY* psa = results->HeaderData->Lines;
BSTR HUGEP* pbstr;
HRESULT hr = SafeArrayAccessData(psa, (void HUGEP**) & pbstr);
if (SUCCEEDED(hr)) {
for (long i = 0; i < sizeof(pbstr) - 1; i++)
wcout << pbstr[i] << endl;
}
SafeArrayUnaccessData(psa);
If you need help writing a compiled C# UDOC, you can DM me and I’d be glad to help.