T O P I C R E V I E W |
tib |
Posted - 06/22/2007 : 06:18:24 AM Hi there,
I have several variables: Substrate0$, Substrate1$, Substrate2$, Substrate3$ etc....
Furthermore, I have several text objects in a Graph: Graph!Substrate0, Graph!Substrate1, Graph!Substrate2, Graph!Substrate3, etc...
Now in a simple loop I want to read the values from the Graph into the variables.
loop (iii,0,aaa) { Substrate$(iii)$=Graph!Substrate$(iii).text$; };
Why does this loop not work? What is wrong? I tried brackets and $ almost everywhere... also with %A as intermediate variable... Without success.
Thanks for help, Tilman.
|
3 L A T E S T R E P L I E S (Newest First) |
Mike Buess |
Posted - 06/26/2007 : 07:52:09 AM quote: You assign a zero string "" to a text object and save your project and close Origin. Next time you open the project the text object will be disappeared. Is this the way how it should be???
You don't have to wait until the next time you open the project for the text object to disappear. You simply cannot create an empty text label in the first place. Try this...
%Z=""; label -s -sa -n Substrate1 %Z; list o; // list all objects
Substrate1 will not appear on the object list. Setting the label to white space (space or tab) does not help. (If you start with %Z=" " the label will still not be created.) As far as I know, this has been the way text objects have always worked. Attempting to find the text of a missing object will only result in a command error so you can check for its existence first. One way to check for an objects existence is with the object.show property...
object.show = 1 (visible), 0 (hidden), -- (doesn't exist)
loop(iii,1,aaa) { if( Substrate$(iii).show ) Substrate$(iii)$=Substrate$(iii).text$; else Substrate$(iii)$=""; };
Mike Buess Origin WebRing Member |
tib |
Posted - 06/22/2007 : 09:23:06 AM Thanks Mike, for some strange reason one of the text objects in Graph has disappeared. Of course, assigning a value to a non-existing object does not work well. But as you said, a restart from time to time might not be bad. Now, it works!
Now, I believe to know why the text object disappeared: You assign a zero string "" to a text object and save your project and close Origin. Next time you open the project the text object will be disappeared. Is this the way how it should be??? A workaround would be that you check the length of the text object beforehand and in case of zero length assign e.g. a space " ".
Edited by - tib on 06/26/2007 03:39:56 AM |
Mike Buess |
Posted - 06/22/2007 : 08:54:49 AM Hi Tilman,
Your script works fine for me in O75 SR6 as long as aaa is defined and the window containing the text objects is named Graph. If you've been working in the same Origin session for a long time I recommend a restart.
Mike Buess Origin WebRing Member |
|
|