T O P I C R E V I E W |
contac |
Posted - 02/21/2002 : 3:28:59 PM During my time here, i've got a pretty think...
Searching for a specific way for access to Origin objects (working with OLE automation objects) in Visual Basic, i've found a "Origin Graph" object, very like as the Excel Sheets or Paint Pictures for inserting into forms. It's able to be modified making double click on in, manually by an instance of the Origin Application. Notice that if you put it as a insertable object, you can read the properties for it in the object explorer, as the new added class "Origin50Ctl". But you can see only the defaults property of objects!... No opcion of configuration.
Are there a way for access Origin externally, as a ActiveX or Control under Visual Basic, without consider the classical DDE?
How i can work with Origin as a Grafical Server?
Thanks to all... Nice day  |
5 L A T E S T R E P L I E S (Newest First) |
easwar |
Posted - 11/03/2006 : 10:24:00 AM Hi Souvik,
What version of Origin are you running? In version 7.5, Origin can function as Automation (COM) Server and any client application (such as a VB application) can communicate with Origin via exposed methods and properties. One of the methods is an Execute() method that allows the client application to send any script command to Origin for execution. The script command can be a specific LabTalk command, a command to run a section of a script file, a command that loads and compiles an Origin C function, a command that calls an existing/pre-compiled Origin C function etc. Thus, in addition to the available methods for exchanging data etc, the Execute() command provides a way to send pretty much any command to Origin.
If you don't have 7.5, you can try the 7.5 demo. In the demo, as well as product installation, there is a folder called \Samples\Automation Server\ that has exmaples for client applications such as VB, VC, Excel etc.
Easwar OriginLab
|
sspsc |
Posted - 11/03/2006 : 07:25:28 AM Dear Bob, The visual basic code given in this mail is very helpful to me. Actually I am trying to call origin from visual basic 6 in an interfacing programme, and I want to update the graph automatically. Data are stored in a file while the experiment is going on. So I shall be very happy if you send me the desired VB coad and forms. My email ID is sspsc@iacs.res.in.
Thank you.
Souvik.
quote:
I'm not sure if this is exactly what you're looking for but if you want to make plots automatically with origin here's some code I've written, it's expanded from the DDE example that comes with Origin pro. I use labtalk to do the origin work for me. This subroutine: 1) starts origin 2) sends it data 3) opens a template 4) formats the graph 5) saves the graph as a bitmap 6) closes origin without saving
I've incorporated variations on this subroutine into general programs that save out origin graphs as bitmaps. In the subroutine a .poke sends data to origin and a .execute executes labtalk commands etc. If you want though you can vary this by making your visual basic program save out a labtalk script and then when you start origin have it run the script and quit etc. Or, you could save bitmaps out with this subroutine and then open them up in image controls elsewhere in your visual basic program probably depends on what you're trying to do.
Private Sub origin_plot(plotname As String) Dim fso Dim tempfile Dim lineoutput As String Dim cmdline As String Dim z ' send status to a list box statusForm.statuslist.AddItem "In Origin Plot" ' Shell ([Pathname], [windowsytle]) ' returns the task ID of the started program ' start cmdline$ and maximize the window size ' start Origin z = Shell(stationinfo.originlocation, 0) ' set a file scripting object Set fso = CreateObject("Scripting.FileSystemObject") ' open the temporary data file Set tempfile = fso.opentextfile(stationinfo.outputdir & "temp.txt") ' start a link with Origin poketext.LinkTopic = "Origin|ORG" poketext.LinkItem = "Data1" poketext.LinkMode = COLD ' send status to a list box statusForm.statuslist.AddItem "Started Origin" ' read in the data from the temporary file ' and send it to Origin Do While tempfile.atendofstream <> True poketext.text = tempfile.readline + Chr$(13) + Chr$(10) poketext.LinkPoke Loop tempfile.Close ' send status to a list box statusForm.statuslist.AddItem "Sent Data to Origin" ' labtalk script poketext.LinkExecute "wo -s 3 1 11 16" poketext.LinkExecute "wo -p 213 " & stationinfo.templatename poketext.LinkExecute "graph1!layer1.x2.label.dataset$=data1_k" poketext.LinkExecute "graph1!layer1.x2.label.type=8" poketext.LinkExecute "graph1!layer1.x2.inc=22.5" poketext.LinkExecute "graph1!layer1.y.inc=5" statusForm.statuslist.AddItem "Exporting Plot" poketext.LinkExecute "%a = " & stationinfo.outputdir & plotname & ".bmp" poketext.LinkExecute "export.image(%a,bmp)" poketext.LinkTopic = "Origin|Variable" poketext.LinkItem = "system.version" poketext.LinkMode = COLD poketext.LinkExecute "doc -s;def TimerProc {exit;};timer 1;" poketext.LinkMode = 0 Kill (stationinfo.outputdir & "temp.txt") End Sub
--Bob
|
contac |
Posted - 02/22/2002 : 12:12:52 PM well, we must to wait more time that i've expect! |
asp001 |
Posted - 02/22/2002 : 11:15:56 AM As far as I know Origin does not support any ActiveX-like activity. So, DDE is the only way to communicate with Origin. It seems Origin 7 also does not have that possibility. |
Bob |
Posted - 02/21/2002 : 9:33:33 PM I'm not sure if this is exactly what you're looking for but if you want to make plots automatically with origin here's some code I've written, it's expanded from the DDE example that comes with Origin pro. I use labtalk to do the origin work for me. This subroutine: 1) starts origin 2) sends it data 3) opens a template 4) formats the graph 5) saves the graph as a bitmap 6) closes origin without saving
I've incorporated variations on this subroutine into general programs that save out origin graphs as bitmaps. In the subroutine a .poke sends data to origin and a .execute executes labtalk commands etc. If you want though you can vary this by making your visual basic program save out a labtalk script and then when you start origin have it run the script and quit etc. Or, you could save bitmaps out with this subroutine and then open them up in image controls elsewhere in your visual basic program probably depends on what you're trying to do.
Private Sub origin_plot(plotname As String) Dim fso Dim tempfile Dim lineoutput As String Dim cmdline As String Dim z ' send status to a list box statusForm.statuslist.AddItem "In Origin Plot" ' Shell ([Pathname], [windowsytle]) ' returns the task ID of the started program ' start cmdline$ and maximize the window size ' start Origin z = Shell(stationinfo.originlocation, 0) ' set a file scripting object Set fso = CreateObject("Scripting.FileSystemObject") ' open the temporary data file Set tempfile = fso.opentextfile(stationinfo.outputdir & "temp.txt") ' start a link with Origin poketext.LinkTopic = "Origin|ORG" poketext.LinkItem = "Data1" poketext.LinkMode = COLD ' send status to a list box statusForm.statuslist.AddItem "Started Origin" ' read in the data from the temporary file ' and send it to Origin Do While tempfile.atendofstream <> True poketext.text = tempfile.readline + Chr$(13) + Chr$(10) poketext.LinkPoke Loop tempfile.Close ' send status to a list box statusForm.statuslist.AddItem "Sent Data to Origin" ' labtalk script poketext.LinkExecute "wo -s 3 1 11 16" poketext.LinkExecute "wo -p 213 " & stationinfo.templatename poketext.LinkExecute "graph1!layer1.x2.label.dataset$=data1_k" poketext.LinkExecute "graph1!layer1.x2.label.type=8" poketext.LinkExecute "graph1!layer1.x2.inc=22.5" poketext.LinkExecute "graph1!layer1.y.inc=5" statusForm.statuslist.AddItem "Exporting Plot" poketext.LinkExecute "%a = " & stationinfo.outputdir & plotname & ".bmp" poketext.LinkExecute "export.image(%a,bmp)" poketext.LinkTopic = "Origin|Variable" poketext.LinkItem = "system.version" poketext.LinkMode = COLD poketext.LinkExecute "doc -s;def TimerProc {exit;};timer 1;" poketext.LinkMode = 0 Kill (stationinfo.outputdir & "temp.txt") End Sub
--Bob
|
|
|