The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
 All Forums
 Origin Forum for Programming
 Forum for Origin C
 Calling X-function impNetCDF with OriginC

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
Doltergost 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.

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000