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
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 Forum for Origin C
 Problems importing and plotting via OC
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

voljentsch

Germany
Posts

Posted - 11/14/2007 :  10:40:26 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Version (Select Help-->About Origin): 7.5
Operating System: Win2000

Hello,

I am currently developing a computer program to produce printable plots of a certain type of data-files I am working with.

I have a certain type of .dat-Files, in which several data columns are included. I want to my program to automatically import these files with an user-defined import filter, and to plot them aftwards, using a user-defined template.

Several problems have occured:

1) There seems to be no function, that can include import a file using a user-defined import filter. I tried "ImportFile(Worksheet, Filtername, Filename)" as found on an example on the web, but this does not work.

2) I couldn't find any function that is able to plot a worksheet with a user-defined Template. I tried the LT command "worksheet" with the appropiate options, but this doesn't produce the same results as when i plot manually via the menubars...

Particulary, I specifically want to:

- Import a .dat-File with 7 columns, using some of the header lines as labels for the columns of the worksheet, and saving them, as some of them contain meta-info (for example, date of record...)

- Plot a worksheet created in the procedure above, using a user-definded template. My Template roots back to the "Stack"-template, but it has some graphical modifications, and some labels which take use of header variabels within the text.

Of course, i could do this manually, but I want to encapsulate them in a function, so i can print out many of these plots automatically, instead of importing and plotting a several hundred times.

I hope you can help me with these issues.

Mike Buess

USA
3037 Posts

Posted - 11/14/2007 :  12:17:29 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
1) I assume that this is where you found the example
http://www.originlab.com/forum/topic.asp?TOPIC_ID=3216
and suspect you are using the ImportFile function incorrectly. As explained in the topic cited above several Import Wizard files must be loaded in workspace and fileimport.h included in your Origin C function before ImportFile will even compile. Also, the first argument in the ImportFile function is worksheetpage (wpg), not the name of that page. As long as the wpg, data file path and filter path arguments, as well as your filter itself, are correct ImportFile works fine.

That said, it might be easier to import with the File> Open or File> Import> Import Wizard menu commands by using LT_execute("run.section(FILE,Open)") or LT_execute("run.section(FILE,ImportWizard)") as discussed in this topic...
http://www.originlab.com/forum/topic.asp?TOPIC_ID=6164


2) Create a GraphPage from your template and use the AddPlot function to plot. See GraphLayer::AddPlot for details...

Worksheet wks = Project.ActiveLayer();
GraphPage gpg;
gpg.Create("MyTemplate.otp"); // create graph page from your template
GraphLayer gl = gpg.Layers(0);
gl.AddPlot(wks); // plot all Y columns (for example)

Mike Buess
Origin WebRing Member
Go to Top of Page

bnahir

USA
Posts

Posted - 03/05/2008 :  4:51:10 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

I am having a similar problem with the ImportFile function. I created a filter for a file using = as the delimiter and wnat to automatically import the contents into a worksheet:

#include <Origin.h>
#include <..\Originlab\FileImport.h>
#include "CJF_Common.h"

void lsdata(){
string strFile, strLSDfile;
string strFilter="X:\Software\OriginC\Import Filters\PVLSD.oif";

strFile=GetOpenBox("*.lsd");
if(strFile.IsEmpty()){
out_str("Please select a file.");
return;
}
string strLabel=GetFileName(strFile);

WorksheetPage wpg;
wpg.Create("Origin.otp");
Worksheet wks;
wks=wpg.Layers(0);

int iRet=ImportFile(wpg, strFilter, strFile);
wks.GetPage().Label=strLabel;
wks.LT_execute("page.title=3");

}

The file compiles properly. However, when OC tries to link it, I get the following error:
Linking...
X:\Software\OriginC\Tools\On-line\Origin 8\BN_linescan.c(13) :Error, Function ImportFile@IAAAAAAADDAAAAAABCAAAAAADAAAAAAABCAAAAAADAAAAAAAIAAAAAAA was called, but its body could not be located during linking.
Linking Failed!

I have not seen this error before and am not sure what it means. I checked the file path for both Origin.h and FileImport.h and both are correct. The fileimport.c does not appear corrupt either. Any suggestions?

Thanks,
Ben
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000