|
Doltergost
Germany
15 Posts |
Posted - 11/27/2025 : 08:39:00 AM
|
Hello,
i tried to automate the import of netCDF file via OriginC. Similar to outher implimentation i tried to use the corresponding X-function.
void dc_NetCDF(importstruct *importdata, int index) { MyWorksheetPage wp; wp.Create("origin"); // Load the X-Function string strXFNameToCall = "impNetCDF"; XFBase xf(strXFNameToCall); if( !xf.IsValid() ) { printf("Failed to load xfunction.\n"); return; } Worksheet wks = wp.Layers(0); string strURL = importdata->directory + importdata->filenames[index]; string wksname = "[Book1]Sheet1"; Tree tr; if( !xf.SetArg("fname", strURL) ) { printf("Failed to set argument fname\n"); return; } if( !xf.SetArg("orng", wksname) ) { printf("Failed to set argument orng\n"); return; } // With arguments set we can now execute the X-Function if( !xf.Evaluate() ) { printf("Failed to evaluate the impNetCDF X-Function.\n"); return; } printf("%s importiert\n",importdata->filenames[index]); string stemp = importdata->filenames[index]; stemp.Replace(importdata->voidstring, ""); importdata->longnames = stemp; wks.SetName(importdata->longnames[index]); wp.SetLongName(importdata->longnames[index]); wp.SetName("A" + simple_hash(importdata->filenames[index], 10)); importdata->shortnames[index] = wp.GetName(); }
My Problem is now that it doesnt work. If i dont set the orng argument, i get the error <active> is not Valid, if i set it like above, i get errorcode (24). Can someone help?
Thanks in advance. |
|