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
 Problenm with LT_set/get_var

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
rlewis Posted - 04/25/2006 : 5:18:37 PM
Origin Pro7.5_SR6:
Operating System: Win-XP
The following OriginC function is intended to make some fine adjutments on line objects drawn on a graphpage.However when implemented as shown below, the LT_get_var and LT_set_var functions both return true but do NOT set or get the variables concerned. Is this a bug or am I missing something ??

 
bool Adjust_Lines()
{
GraphPage gP=Project.GraphPages(-1);
GraphLayer gL=gP.Layers();
if(gL.IsValid()==true)
{
foreach (GraphObject gO in gL.GraphObjects)
{
if(gO.GetObjectType().CompareNoCase("Line")==0)
{
double Value;
string strLine=gO.GetName();
string strLTvar=strLine;
strLTvar+=".x1";
if(LT_get_var(strLine,&Value)==false) return (false);
Value=nint(Value);
if(LT_get_var(strLine,&Value)==false) return (false);
strLTvar=strLine;
strLTvar+=".x2";
if(LT_get_var(strLine,&Value)==false) return (false);
Value=nint(Value);
if(LT_get_var(strLine,&Value)==false) return (false);
strLTvar=strLine;
strLTvar+=".y1";
if(LT_get_var(strLine,&Value)==false) return (false);
Value=nint(Value);
if(LT_get_var(strLine,&Value)==false) return (false);
strLTvar=strLine;
strLTvar+=".y2";
if(LT_get_var(strLine,&Value)==false) return (false);
Value=nint(Value);
if(LT_set_var(strLine,Value)==false) return (false);
}
}
return (true);
}
return (false);
}
4   L A T E S T    R E P L I E S    (Newest First)
rlewis Posted - 04/25/2006 : 11:42:32 PM
I retested the OC function on my home computer and it now works as designed .... Go Figure ...
Mike Buess Posted - 04/25/2006 : 10:08:07 PM
Sorry, I missed that crucial if. However, I can't exactly reproduce your problem with Line objects. I drew a line on a graph layer and named it Line11. The first time I ran the following test() function it returned Line11.Y1=7.64571 but on subsequent runs it returned Line11.Y1=7.99885. The new value is admittedly not an exact integer but the placement is as accurate as I have ever been able to achieve with graph objects.
void test()
{
GraphPage gP=Project.GraphPages(-1);
GraphLayer gL=gP.Layers();
double dVal;
string str;
foreach (GraphObject gO in gL.GraphObjects)
{
if( gO.GetObjectType().CompareNoCase("Line")==0 )
{
str = gO.GetName() + ".Y1";
LT_get_var(str,&dVal);
out_double(str + "=",dVal);
LT_set_var(str,nint(dVal));
}
}
}


Mike Buess
Origin WebRing Member

Edited by - Mike Buess on 04/25/2006 10:17:46 PM
rlewis Posted - 04/25/2006 : 8:47:51 PM
That’s not the problem Mike …
The function is designed to work on line objects (Note the “if(gO.GetObjectType().CompareNoCase("Line")==0)test) for which there is read/write access to Object.x1/y1/x2/y2. After some more testing the problem seems to be ..

LT_get_var(“Line11.y1”,&Value); // Works if the Line object “Line11” exists.

However ..

string strVar=”Line11.y1”;
LT_get_var(strVar,&Value);// Fails …
Mike Buess Posted - 04/25/2006 : 6:20:03 PM
Object.X1|X2|Y1|Y2 are read-only properties. Try this from the script window with a single rectangle in the graph layer...

Rect.x1=;
RECT.X1=some_value
Rect.x1=some_other_value;

RECT.X1 is an illegal name for defining a variable. It must not start...
#Command Error!

To position the left and right sides of the rectangle you must use Rect.X (center) and Rect.DX (width) which can be cumbersome but you don't need LabTalk because corresponding OC properties (gO.X and gO.DX) exist.

Mike Buess
Origin WebRing Member

Edited by - Mike Buess on 04/25/2006 6:26:21 PM

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