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
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 LabTalk Forum
 Trigger scripts by moving or resize objects
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

SteffenG

Germany
Posts

Posted - 08/03/2021 :  06:59:13 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
OriginPro 2019 (64-bit) 9.6.0.172 German
Windows 10

Dear all,

I wonder if there are differences between moving an object or resize it in terms of trigger respective script within the object. Here are the details:
I have a rectangle linked to a layer. The rectangle contains a script which should change something in a second layer. The script execution should be done by resize the rectangle or move it. Therefore I choose the respective criterion. Unfortunately the script is running correctly only if I am moving the rectangle. If I resize it some of the script is running okay but some function do not work. As far as I see there might be some issue with switching from one layer to the other. I recognize the switching in case of moving the rectangle but no switching is to be seen if I resize it. Funny thing: If I choose first the layer of the rectangle the script runs well also in case of resizing. I am really confused.

Hope, someone has an idea to solve the problem or work around.

Best regards
Steffen

YimingChen

1665 Posts

Posted - 08/03/2021 :  09:27:35 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
It's hard to tell what is going on. Maybe you can send us a sample project file showing the issue.

If you want to perform some operations on a second layer, you don't have to switch to that layer, see the page below on executing script for a specified layer.
https://www.originlab.com/doc/LabTalk/ref/Layer-cmd#-o.3B_execute_.28operate.29_the_specified_script_for_the_specified_layer

James
Go to Top of Page

cpyang

USA
1406 Posts

Posted - 08/03/2021 :  1:01:05 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Yes, like

layer -o 2 {type "my scripts";}


If you need to do something in layer 2 context from layer 1.

CP
Go to Top of Page

SteffenG

Germany
Posts

Posted - 08/04/2021 :  03:45:33 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Dear all,

Thanks for your comments. I am aware of the different methodologies to change the place of execution of scripts. My question is more related to the background of the implementation of the resizing versus moving trigger event in Origin itself. Are there any differences in the handling or execution of these events?

I was able to determine which command breaks the execution of my scripts in case of using resizing. It is
draw -n fftcheck -v get;

The object fftcheck is located in the first layer. It looks like the object will not be found in case of resizing event but in case of moving event everything works fine.

I solved the problem now by adding an additional
layer -s 1;

right before the
draw ...
line. There is the same layer select command some lines before in the script.

Again: The script was runnig perfectly in case of moving the rectangle but not in case of resizing.

It looks like the resizing event has some timing issue. If I start from layer 2 and resize the rectangle in layer 1 the layer select commands within the scripts of used objects are only effective for some short period of time. If I want to be sure to target to the correct layer I have to repeat the layer select commands several times, regardless if the selected layer will be the same as before. May be it has something to do with internal graphic routines.

Best regards
Steffen
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000