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
 Help with Point grabber
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

thiago.maf

22 Posts

Posted - 06/13/2009 :  4:08:46 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. and Service Release (Select Help-->About Origin): 8.0 SR5
Operating System: Windows 7

Hi...

Anyone could help to fix my code?

This code is supposed to grab points and put then in a worksheet.

A ----- B
pt(1) pt(2)
pt(2) pt(3)
pt(3) pt(4)
pt(i) pt(i+1)

But sometime, I don't know why, some values in the result worksheet is empty (--). It looks like some var is making this.

Second, it's common that the code crash and my Origin can't do nothing, waiting for a code response. I guess it is some infinite loop.

Thanks

thiago.maf

22 Posts

Posted - 06/13/2009 :  4:10:43 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
[Intervalos]
// point selection script
del -a; // delete temporary datasets
del -v index*; // delete previous indices

done=0; // initialize script
getpts 1; // select 4 points;


// pointproc macro runs each time a point is selected
def pointproc {

index$(getpts.count)=getpts.index; // point index
getyesno (Deseja continuar?) answer (LaFA);

if( answer==1 ) {
getpts.max++;
}

if( getpts.count==getpts.max ) {
{endtoolbox};
dotool 0;
};
};

// endtoolbox macro runs after all points are selected
def endtoolbox {
done=1;
index0=getpts.count; // save the point count
%A=xof(%C); // X data
for(ii=1;ii<=index0;ii++) {
temp$(ii) = %A[index$(ii)];
temp$(ii) /= 10000;
type "$(temp$(ii)) $(temp$(ii+1))";
};
};

// wait until designated number of points is selected
for(kk=1;kk>0;) {
if( done ) break;
sec -p 1; // pause 1 second
};

// insert the rest of your script here
win -t;

wks.ncols = 2;
wks.name$ = "Intervalos";
Col(1)[L]$ = "Incio";
Col(2)[L]$ = "Fim";

for (nn=1;nn<=getpts.count-1;nn++) {
//type "$(temp$(nn)) $(temp$(nn+1))";

cell(nn, 1) = temp$(nn);
cell(nn, 2) = temp$(nn+1);
};
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