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:
640 x 480
800 x 600
1024 x 768
1280 x 1024
UserName:
Password:
Anti-Spam Code:
Format Mode:
Basic
Help
Prompt
Format:
Font
Andale Mono
Arial
Arial Black
Book Antiqua
Century Gothic
Comic Sans MS
Courier New
Georgia
Impact
Lucida Console
Script MT Bold
Stencil
Tahoma
Times New Roman
Trebuchet MS
Verdana
Size
1
2
3
4
5
6
Color
Black
Red
Yellow
Pink
Green
Orange
Purple
Blue
Beige
Brown
Teal
Navy
Maroon
LimeGreen
Message:
* HTML is OFF
*
Forum Code
is ON
Smilies
[quote][i]Originally posted by Doltergost[/i] [br]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. [/quote]
Check here to include your profile signature.
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
Snitz Forums 2000