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
 Use a design form like a template possible?
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

ThomasR

Germany
6 Posts

Posted - 02/19/2014 :  2:57:42 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. 9 and Service Release (Select Help-->About Origin):
Operating System: Win7

Using Origin I made a template and a design form.
Both template and design(form)-file I want to apply using Code in OriginC.

How can I use the design by code?
The template is no problem with
GraphLayer gl;
gl.Create("Line"); (If the template is called Line)

How do I tell the layer to use a design called "myDesign"? Even better, if I could tell the path to that design file.
I don't want to click on the menubar and apply it with my mouse.

Greetings
Thomas

Edited by - ThomasR on 02/19/2014 3:25:38 PM

greg

USA
1378 Posts

Posted - 02/25/2014 :  12:45:41 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
We do not understand your use of the word "design". What would this be in Origin terminology.

P.S. Your code fragment:

GraphLayer gl;
gl.Create("Line"); (If the template is called Line)

does not compile. Perhaps you meant:

GraphPage gp;
gp.Create("Line"); (If the template is called Line)
Go to Top of Page

ThomasR

Germany
6 Posts

Posted - 02/26/2014 :  03:44:17 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:
Originally posted by greg

We do not understand your use of the word "design". What would this be in Origin terminology.

P.S. Your code fragment:

GraphLayer gl;
gl.Create("Line"); (If the template is called Line)

does not compile. Perhaps you meant:

GraphPage gp;
gp.Create("Line"); (If the template is called Line)




Yes perhaps I meant that. It was just to illustrate the general problem. I am referring to the thing called "Design" by Origin itself.
That thing that saves fonts and such.

That files are saved in the folder C:\Users\<myname>\Documents\OriginLab\90\Anwenderdateien\Themes\Graph and called "*.oth". "Anwenderdateien" is sth. like "AppData" in english.

As you can see in the picture, to apply a design, I need to click on it and then on the apply-button. I want to do this by code. This must be possible... I know where the design file is placed and want to trigger a command that uses that file....
Go to Top of Page

Castiel

343 Posts

Posted - 02/26/2014 :  08:48:15 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:
Originally posted by ThomasR


Yes perhaps I meant that. It was just to illustrate the general problem. I am referring to the thing called "Design" by Origin itself.
That thing that saves fonts and such.

That files are saved in the folder C:\Users\<myname>\Documents\OriginLab\90\Anwenderdateien\Themes\Graph and called "*.oth". "Anwenderdateien" is sth. like "AppData" in english.

As you can see in the picture, to apply a design, I need to click on it and then on the apply-button. I want to do this by code. This must be possible... I know where the design file is placed and want to trigger a command that uses that file....



I think what you need is
bool apply_graph_theme(LPCSTR lpcszTheme, PageBase& pg);

"*.oth" is kind of xml file: ApplyFormat(an_oth_tree). You can tell this when looking into theme_utils.c in Origin C Workspace->System.


妾+   午旦  妹罕妾  妾伊    用仇  妾/     岫ㄞ
 妾京用 仍巨  件 侈   件戶' 甘岫平   /欠  白岫妹
   併             艮          岫  奈 白   岫
                              岫
Go to Top of Page

ThomasR

Germany
6 Posts

Posted - 02/26/2014 :  09:52:25 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:
I think what you need is
bool apply_graph_theme(LPCSTR lpcszTheme, PageBase& pg);


Where did you find that piece of code? I can't find it in any documents by searching. Was it the OriginC-Programming Guide? But can't find it there.

Meanwhile I tried to apply this example to my code:

void OriginObject_ApplyFormat_Ex1()
{
    GraphPage gp = Project.GraphPages(0);
    gp.ApplyFormat("themes\\graph\\<MyThemeName>.OTH");
}

My code:

if (variables.GetSize()==3){
gp.Create("U:\40_Datenauswertung\OriginC\Templates\StackPlot3Var");

	for (int i= 0;i <3 ; i++){
		GraphLayer gl = gp.Layers(i);
		Curve crv(wks, 0, getIndexOf(variables[i]));
		int nPlot = gl.AddPlot(crv, IDM_PLOT_LINE); // return plot index
		if( nPlot >= 0 )
			gl.Rescale();
	}
	gp.ApplyFormat("themes\\graph\\StackPlot3Var.OTH"); //DOES NOT WORK
}

But this did not apply my theme.
Message I get is 2 times "Found invalid Thumb object in UpdateThumb".
If I call "Ticks All Out.OTH" it applies that theme, but it doesn't work for mine, unless I call it manually per mouse.

Ah, I got it. The theme file has been created in another folder (mentioned above). If i copy it to the "themes\graph" folder, it works.

Edited by - ThomasR on 02/26/2014 10:05:08 AM
Go to Top of Page

Castiel

343 Posts

Posted - 02/26/2014 :  10:38:35 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:
Where did you find that piece of code? I can't find it in any documents by searching. Was it the OriginC-Programming Guide? But can't find it there.


At first glance,it should be theme related. So I look over the functions in the workspace: System and sometimes Temporary.


quote:

if (variables.GetSize()==3){
gp.Create("U:\40_Datenauswertung\OriginC\Templates\StackPlot3Var");


BTW, backslash "\" should be "\\".

妾+   午旦  妹罕妾  妾伊    用仇  妾/     岫ㄞ
 妾京用 仍巨  件 侈   件戶' 甘岫平   /欠  白岫妹
   併             艮          岫  奈 白   岫
                              岫
Go to Top of Page

bobey

USA
3 Posts

Posted - 03/10/2015 :  12:22:36 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Do we just need to save a projec before quit and use it to do another one later?
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