Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations The Obturator on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Post error messages: can't read variable

Status
Not open for further replies.

rg006

Mechanical
Mar 25, 2008
65
Hello,
Please refer to thread561-116535 for a similar issue of this.
I am trying to finish up my post and I have a problem. I want to use "mom_prev_out_angle_pos(0)" however, on the first move I get the 1770002 error that says:
"Error: can't read 'mom_prev_out_angle_pos(0)': no such element in array"

I assumed that this was because at the first move, there is no previous angle for the fourth axis. So at the "start of program" block I inserted "set mom_prev_out_angle_pos(0) 0.0" to set the variable initially. This does not seem to work and I still get the message that the variable cant be read.

By the way the code I am using the variable in is:

global mom_pos mom_out_angle_pos
global mom_prev_pos mom_prev_out_angle_pos

if {$mom_prev_out_angle_pos(0) != $mom_out_angle_pos(0)} {

MOM_output_literal "E11=E10*sin($mom_out_angle_pos(0)) E12=E9*cos($mom_out_angle_pos(0))"

set mom_prev_out_angle_pos(0) $mom_out_angle_pos(0)


}

Any help would be greatly appreciated.
 
Replies continue below

Recommended for you

Hey,
IF anyone is thinking on this I found a related thread:
thread561-175145

I am assuming that my mom angle commands can not look far enough ahead to set the angle? Not too sure. I am kinda stuck on this one.

Rick
 
In your start of program event do you have

global mom_prev_out_angle_pos

#before you use

set mom_prev_out_angle_pos(0) 0.0

#???

John Joyce
Tata Technologies
1675 Larimer St.
Denver, CO

NX3,4,5,6 Solid Works, Pro/e, Solid Edge
 
I think I would opt for the 'if [info exists mom_prev_out_angle_pos(0)] { }' structure instead.
 
joycejo,
Yes I have the variable set.

jelmerra,
I will try that structure and see if that fixes it.

Thanks to both of you for the replies,
Rick
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor