Author |
Topic |
|
turbvg
Germany
9 Posts |
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 |
|
Castiel
343 Posts |
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);
妾+ 午旦 妹罕妾 妾伊 用仇 妾/ 岫ㄞ
妾京用 仍巨 件 侈 件戶' 甘岫平 /欠 白岫妹
併 艮 岫 奈 白 岫
岫 |
|
|
turbvg
Germany
9 Posts |
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
343 Posts |
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;
}
妾+ 午旦 妹罕妾 妾伊 用仇 妾/ 岫ㄞ
妾京用 仍巨 件 侈 件戶' 甘岫平 /欠 白岫妹
併 艮 岫 奈 白 岫
岫 |
|
|
turbvg
Germany
9 Posts |
Posted - 04/27/2015 : 11:34:43 AM
|
it works great. thanks
-- Origin 2015 Windows 7 |
|
|
|
Topic |
|
|
|