T O P I C R E V I E W |
perger |
Posted - 10/16/2001 : 10:07:00 AM I have to write a script that acts as follows:
The user selects 4 points on a curve. (PointProc #1). The script uses these points to calculate something (e.g. their sum.) Then, the user selects two intervals. (PointProc #2 and #3). The script performs some calculations on the two intervals.
The problem is the following: 1.) The script does not wait for GetPTS or DoToolbox to finish, thus PointProc #3 redefines PointProc #1-#2. 2.) I could use an EndToolbox macro containing PointProc #2, but it does not work, either.
Please suggest a solution if one exists.
Regards, Tamas Perger |
4 L A T E S T R E P L I E S (Newest First) |
perger |
Posted - 10/30/2001 : 09:52:27 AM Hi Laurie,
Thank you for the answer. I solved the problem in another way: I created a button "Next step" that called different sections in an OGS file, depending on a counter. In each section I defined a different PointProc macro. This method solved my problem, but the method you suggested seems to be more sophisticated. Thanks again, Tamas
quote:
Hi Tamas,
This script should do what you need.
getpts 4; def endtoolbox {... done=1;} for(done=0;done==0; ) { sec -p .05;}
getpts 2; def endtoolbox {... done=1;} for(done=0;done==0; ) { sec -p .05;}
Note the infinite for loop can be used anytime you want your script to wait until the appropriate number of points have been selected by the user.
OriginLab Technical Support
|
Laurie |
Posted - 10/17/2001 : 4:29:08 PM Hi Tamas,
This script should do what you need.
getpts 4; def endtoolbox { sum=0; loop(ii,1,4){ sum+=%C[_indx[ii]];} type -a "Sum is $(sum)"; done=1; } for(done=0;done==0; ) { sec -p .05; }
getpts 2; def endtoolbox { mks1=_indx[1]; mks2=_indx[2]; integrate %C; type -a "Area under %C from $(_xpos[1]) to $(_xpos[2]) is $(integ.area)."; done=1; } for(done=0;done==0; ) { sec -p .05; }
Note the infinite for loop can be used anytime you want your script to wait until the appropriate number of points have been selected by the user.
OriginLab Technical Support |
CStorey |
Posted - 10/17/2001 : 12:35:22 PM Hi Mike,
I read the article this morning. It is a good intro but doesn't address any more advanced issues like how to re-use the PointProc macro for several itterations.
Craig Storey Origin WebRing Member - http://nav.webring.yahoo.com/hub?ring=originwebring |
Mike Buess |
Posted - 10/16/2001 : 11:52:05 AM There is a Knowledge Base article on using GetPts that might help you. Just use the keyword "GetPts" and then Submit Query.
Mike Buess Origin WebRing Member |