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
 Accessing Origin Sheets in Python
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

alexander.steppke

Germany
10 Posts

Posted - 10/14/2009 :  11:41:45 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. and Service Release (Select Help-->About Origin): 8.0 SR6
Operating System: Windows Vista SP1

Hi,

is there any way to use python as a programming language for Origin? We have here some data analysis functions in our department in python and I would like to apply these functions to my Origin Worksheets. At the moment I export as ASCII and re-import the modified file by hand.

With the COM-interface it seems possible to access the Worksheet data, but only if you know the name of the worksheet, so just looping over all open worksheet for example does not work that way.

Might it be possible to embed python into Origin or otherwise apply python functions on worksheets?

Greetings
Alexander

Sophy

China
Posts

Posted - 10/23/2009 :  04:07:56 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi, Alexander:

If you just want to process the data in a specific Origin Worksheet, then you should already known the Worksheet's name; and if you only need a tempory Worksheet to store the data, process the data and then retrieve back into Python, why not create a new Worksheet in your Python code :)

For how to reuse your Python code in Origin C, please refer to the following page:

http://ocwiki.originlab.com/index.php?title=OriginC:Calling_Python_via_External_DLL

Hope this will help.
Go to Top of Page

alexander.steppke

Germany
10 Posts

Posted - 10/23/2009 :  09:32:25 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Sophy,

thank you for your help. I already tried to include Python.h and failed because of the multiple compilation errors.

The method in the wiki with the DLL looks interesting, I will tried it out soon. Is it with this method at all possible to change the Python code afterwards without compiling a new DLL or is it "inside" the DLL then?

My goal is to be able to have some python code than I can easily modify and just type a command to apply this function to the current worksheets. Maybe it is possible to wrap the Python eval function?

Thanks for any further hints.

Alexander
Go to Top of Page

eparent

118 Posts

Posted - 10/23/2009 :  5:03:09 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hello,

I have created a Python example that shows how to loop through the WorksheetPages in the current project.
http://wiki.originlab.com/~originla/wiki/index.php?title=OriginCOM:Application-WorksheetPages#Python

and there is also a Python example that shows how to put data into a worksheet.
http://wiki.originlab.com/~originla/wiki/index.php?title=OriginCOM:Application-PutWorksheet#Python

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