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
 All Forums
 Origin Forum for Programming
 Forum for Origin C
 graph_add_layer on Origin 2015

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
turbvg Posted - 04/27/2015 : 07:38:08 AM
Origin Ver. and Service Release (Select Help-->About Origin): Origin 2015
Operating System: Windows 7

Hi

I inherited some Origin C macros for data post-processing and plotting, which worked fine on Origin 9.0.
I am having some problems with the plotting part, and in particular with the graph_add_layer function.
Here is the part of the code in question :

//Rechte Y-Achse erstellen
				//Zweite Y-Skala
				bool bBottom = false, bLeft = false, bTop = false, bRight = true, bAutoOffset = true;
				int nLinkTo = gl.GetIndex(); // New added layer link to the active layer
				int	nLayerIndex = graph_add_layer(gp, bBottom, bLeft, bTop, bRight, bAutoOffset, nLinkTo);
				gl = gp.Layers(1); 
				
				//X-Achsen-Skalierung
                gl.XAxis.Scale.From.dVal = 0;    // Here, the error is signaled (see below)
                gl.XAxis.Scale.To.dVal = anz_messwerte;
                gl.XAxis.Scale.IncrementBy.nVal = 0;
				gl.XAxis.Scale.Type.nVal = 0; // Linear
				gl.XAxis.Scale.Rescale.nVal = 0; // Rescake type
				gl.XAxis.Scale.RescaleMargin.dVal = 8; // precent 8 


The error code :
Origin C Function Runtime Error, Calling members of unattached wrapper class


Also, debugging showed that graph_add_layer returned -1, indicating incorrect operation.

Then, I runned the example code provided on the Origin C reference page on graph_add_layer.

I couldn't get it to run correctly : graph_add_layer always returned -1.

Does this function present a problem with Origin 2015 ? Any ideas on how to get it to run ?

Thanks for your help

Guillaume
4   L A T E S T    R E P L I E S    (Newest First)
turbvg Posted - 04/27/2015 : 11:34:43 AM
it works great.
thanks

--
Origin 2015
Windows 7
Castiel Posted - 04/27/2015 : 09:02:31 AM
quote:
Originally posted by turbvg

Thanks for your answer, but unfortunately, page_utils is read-only and requires administrator privileges, which I do not have, to be modified.
I will try to get an hang on an administrator, but in the mean time, if somebody has another solution, I will gladly take it.

--
Origin 2015
Windows 7



Write your own "graph_add_layer" then,

typedef int (*PAGE_ADD_LAYER_FUNC_2)(GraphPage&, bool, bool, bool, bool, int, bool, int, int, int, int*, bool, int*, int*, int*, int*, int, LPCSTR);
int	graph_add_layer_2(GraphPage& gp, bool bBottom/* = true*/, bool bLeft/* = true*/, bool bTop/* = false*/, bool bRight/* = false*/, 
					bool bAutoOffset/* = true*/,
					int nLinkTo/* = -1*/)
{
	PAGE_ADD_LAYER_FUNC_2 pfun = Project.FindFunction("page_add_layer", "Originlab\graph_utils.c", true);
	if(pfun)
	{
		int 	nAutoInitSizePosition = bAutoOffset? ADD_LAYER_INIT_SIZE_POS_MOVE_OFFSET : ADD_LAYER_INIT_SIZE_POS_SAME_AS_PREVIOUS;
		bool 	bActivateNewLayer = true;
		return pfun(gp, bBottom, bLeft, bTop, bRight, nAutoInitSizePosition, bActivateNewLayer, nLinkTo, LINK_NONE, LINK_NONE, NULL, false, NULL, NULL, NULL, NULL, -1, NULL);
	}
	return -1;
}


©c¡Ï   ¤È¥¹  ©f¨u©c  ©c¥ì    ¥Î¤³  ©c/     ©¦£¯
 ©c¨Ê¥Î ¤´¥¨  ¥ó ¨×   ¥ó¤á' ¥Ì©¦¥­   /¤í  ¥Õ©¦©f
   ¨Ö             ¦á          ©¦£þ  ©` ¥Õ   ©¦
                              ©¦
turbvg Posted - 04/27/2015 : 08:52:53 AM
Thanks for your answer, but unfortunately, page_utils is read-only and requires administrator privileges, which I do not have, to be modified.
I will try to get an hang on an administrator, but in the mean time, if somebody has another solution, I will gladly take it.

--
Origin 2015
Windows 7
Castiel Posted - 04/27/2015 : 08:22:29 AM
quote:
Originally posted by turbvg

Origin Ver. and Service Release (Select Help-->About Origin): Origin 2015
Operating System: Windows 7

Hi

I inherited some Origin C macros for data post-processing and plotting, which worked fine on Origin 9.0.
I am having some problems with the plotting part, and in particular with the graph_add_layer function.
Here is the part of the code in question :

//Rechte Y-Achse erstellen
				//Zweite Y-Skala
				bool bBottom = false, bLeft = false, bTop = false, bRight = true, bAutoOffset = true;
				int nLinkTo = gl.GetIndex(); // New added layer link to the active layer
				int	nLayerIndex = graph_add_layer(gp, bBottom, bLeft, bTop, bRight, bAutoOffset, nLinkTo);
				gl = gp.Layers(1); 
				
				//X-Achsen-Skalierung
                gl.XAxis.Scale.From.dVal = 0;    // Here, the error is signaled (see below)
                gl.XAxis.Scale.To.dVal = anz_messwerte;
                gl.XAxis.Scale.IncrementBy.nVal = 0;
				gl.XAxis.Scale.Type.nVal = 0; // Linear
				gl.XAxis.Scale.Rescale.nVal = 0; // Rescake type
				gl.XAxis.Scale.RescaleMargin.dVal = 8; // precent 8 


The error code :
Origin C Function Runtime Error, Calling members of unattached wrapper class


Also, debugging showed that graph_add_layer returned -1, indicating incorrect operation.

Then, I runned the example code provided on the Origin C reference page on graph_add_layer.

I couldn't get it to run correctly : graph_add_layer always returned -1.

Does this function present a problem with Origin 2015 ? Any ideas on how to get it to run ?

Thanks for your help

Guillaume



1. In Code Builder, highlight the function name "graph_add_layer" in you code, press F11. There's the definition of graph_add_layer() in OriginLab\PAGE_UTILS.C.
2. Change the line right before graph_add_layer() from
typedef int (*PAGE_ADD_LAYER_FUNC)(GraphPage&, bool, bool, bool, bool, int, bool, int, int, int, int*, int*, int*, int*, int*, int, LPCSTR);

to
typedef int (*PAGE_ADD_LAYER_FUNC)(GraphPage&, bool, bool, bool, bool, int, bool, int, int, int, int*, bool, int*, int*, int*, int*, int, LPCSTR);

3. Change the following line inside graph_add_layer():
return pfun(gp, bBottom, bLeft, bTop, bRight, nAutoInitSizePosition, bActivateNewLayer, nLinkTo, LINK_NONE, LINK_NONE, NULL, NULL, NULL, NULL, NULL, -1, NULL);

to
return pfun(gp, bBottom, bLeft, bTop, bRight, nAutoInitSizePosition, bActivateNewLayer, nLinkTo, LINK_NONE, LINK_NONE, NULL, false, NULL, NULL, NULL, NULL, -1, NULL);


©c¡Ï   ¤È¥¹  ©f¨u©c  ©c¥ì    ¥Î¤³  ©c/     ©¦£¯
 ©c¨Ê¥Î ¤´¥¨  ¥ó ¨×   ¥ó¤á' ¥Ì©¦¥­   /¤í  ¥Õ©¦©f
   ¨Ö             ¦á          ©¦£þ  ©` ¥Õ   ©¦
                              ©¦

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000