Troubleshooting
findchild question
Started by AkaMed on .
Sign in or create an account to join the conversation.
Hello,
I am trying to modify an object's expression that is in another container, but I get lost trying...
The goal is to call a pads object inside a container from another pads object from another container.
I tried:
decl preset = firstof(x);
decl a=findchild('Container2', 'Seq');
decl b=findchild(a, 'Load');
setexpression(b, x[preset], 1);
But it doesn't work...
Any help?
I am trying to modify an object's expression that is in another container, but I get lost trying...
The goal is to call a pads object inside a container from another pads object from another container.
I tried:
decl preset = firstof(x);
decl a=findchild('Container2', 'Seq');
decl b=findchild(a, 'Load');
setexpression(b, x[preset], 1);
But it doesn't work...
Any help?
Is there a particular reason you choose findchild() and not findobject()?
Hello Softcore,
because with findobject I believe I can only find and object that has an unique name...Am I wrong?
And I have several objects with the same name inside different containers.
I am confused...
because with findobject I believe I can only find and object that has an unique name...Am I wrong?
And I have several objects with the same name inside different containers.
I am confused...
i.e.
I would love to get something like...
decl preset=firstof(x);
Container2.Seq.Load.x[preset]=1;
I would love to get something like...
decl preset=firstof(x);
Container2.Seq.Load.x[preset]=1;
I don't think setexpression ('someObject', x[number], 1); works. I thought setexpression() needed a quoted string as the second parameter.
So you'd have to build up a vector equal to the sixe of x and then do setexpression('someObject', 'x', newVectorOfValues);
So you'd have to build up a vector equal to the sixe of x and then do setexpression('someObject', 'x', newVectorOfValues);
Franky Im also at loss as to what findchild(object, name) means!
As in...does it expect the object AND name (string) of the parent or what? Not sure...if it expects the parent and the name of the child then why couldnt we just go
findobject('child') per se...Im lost
As in...does it expect the object AND name (string) of the parent or what? Not sure...if it expects the parent and the name of the child then why couldnt we just go
findobject('child') per se...Im lost
yes and oldgear guy is correct - I missed that....
Its setexpression(object, name-of-expression, val)
So the object msut be a direct reference, the expression must be the string name of the expression
Its setexpression(object, name-of-expression, val)
So the object msut be a direct reference, the expression must be the string name of the expression
Thanks for the responses,
yes, the problem is if the expression contains a vector...what can we do then?
yes, the problem is if the expression contains a vector...what can we do then?
AkaMed wrote:Thanks for the responses,
yes, the problem is if the expression contains a vector...what can we do then?
decl i, newVector = {0,0,0,0};
i = findfirst(x);
newVector = x;
setexpression('myObject', 'x', newVector);
You can be more clever using sizeof(x) and fill(newVector...) to create the initial vector, but you should have the general idea now.
Works!!!
Thanks oldgearguy!!!
My modified code is:
decl preset = firstof(x);
decl a=findobject('Container2.Seq.Load');
decl newVector = {0,0,0,0,0,0,0,0};
newVector[preset] = x[preset];
setexpression(a, 'x', newVector);
Now I can call any action from anywhere!
Thanks Softcore also!
Thanks oldgearguy!!!
My modified code is:
decl preset = firstof(x);
decl a=findobject('Container2.Seq.Load');
decl newVector = {0,0,0,0,0,0,0,0};
newVector[preset] = x[preset];
setexpression(a, 'x', newVector);
Now I can call any action from anywhere!
Thanks Softcore also!
glad to be of help. We've all been through it trying to get our code to work.
Keep a collection of techniques you use to accomplish certain tasks and it'll make the next template quicker and easier to create.
Keep a collection of techniques you use to accomplish certain tasks and it'll make the next template quicker and easier to create.
Yes, I always collect the procedures and try to make smaller and for a better performance.
BTW, it would be great to have a Log file or a monitor to watch what's happening at any moment...
BTW, it would be great to have a Log file or a monitor to watch what's happening at any moment...
Hi All
Aren't you overcomplicating things?
You have a multiple Pad object and you want it to set values of another Pad object? And you want them set the same? Standard dot notation should work...
From Pad in Container1 have a script (executing on x) - Container2.Seq.Load.x=x;
From the Lemur 5 thread
One can no longer use the dot notation indirectly, by placing a dot after a variable that was set to point to an object.
dot notation is still supported, the only case it is not supported is when the part AFTER the dot is a variable referring to an object. in that case you should use setexpression()
See Monitor object - handy for debugging various things . .
i.e. From top level a Monitor with value = C2.Seq.Load.x should show the x values
findchild() seems handy for traversing hierarchies in a more controlled fashion when needed, rather then only having find object....
MM
Aren't you overcomplicating things?
You have a multiple Pad object and you want it to set values of another Pad object? And you want them set the same? Standard dot notation should work...
From Pad in Container1 have a script (executing on x) - Container2.Seq.Load.x=x;
From the Lemur 5 thread
One can no longer use the dot notation indirectly, by placing a dot after a variable that was set to point to an object.
dot notation is still supported, the only case it is not supported is when the part AFTER the dot is a variable referring to an object. in that case you should use setexpression()
See Monitor object - handy for debugging various things . .
i.e. From top level a Monitor with value = C2.Seq.Load.x should show the x values
findchild() seems handy for traversing hierarchies in a more controlled fashion when needed, rather then only having find object....
MM
It's so easy that I didn't think about it...
Thanks Macciza!