×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

trouble with checking status of events or commands...

trouble with checking status of events or commands...

trouble with checking status of events or commands...

(OP)
I was following along with John Joyce's PLM World 05 PowerPoint for the probing example... this is what my current procedure looks like:

CODE --> tcl

proc PB_CMD_probeXpos {} {

global mom_probex_status
global mom_probex_pos

#if { $mom_probex_status != "ACTIVE" } { return}

set probex_pos [ format %3.4f $mom_probex_pos(0) ]
set probey_pos [ format %3.4f $mom_probex_pos(1) ]
set probez_pos [ format %3.4f $mom_probex_pos(2) ]

MOM_output_literal "G65 P9811 X$probex_pos Y$probey_pos Z$probez_pos"
} 


... without the additional proc command as in the example, which I list next...


CODE --> tcl

proc PB_CMD_probeXpos {} {

proc MOM_probex {} {

global mom_probex_status
global mom_probex_pos

#if { $mom_probex_status != "ACTIVE" } { return}

set probex_pos [ format %3.4f $mom_probex_pos(0) ]
set probey_pos [ format %3.4f $mom_probex_pos(1) ]
set probez_pos [ format %3.4f $mom_probex_pos(2) ]

MOM_output_literal "G65 P9811 X$probex_pos Y$probey_pos Z$probez_pos"

}

} 

I tried the above code (with the additional procedure) but it does not run it that way, it appears that the nested proc is never called; it doesn't bomb out, it just doesn't seem to do anything.

So that is one question: is that second "proc" necessary? If so, why and what am I doing wrong that it never runs...

The next question is about checking status: if I un-comment the "if" statement that is checking the status of mom_probex_status the procedure will fail with an error saying that there is no such variable as $mom_probex_status

Where would that variable come from? I assumed that it was created from the UDE since we gave it a "POST_EVENT" name of probex

I do see this in the post's tcl file:

CODE --> tcl

#=============================================================
proc MOM_probex { } {
#=============================================================
   global mom_probex_pos
} 

So it would seem since MOM is in caps that a command is created called MOM_probex from the UDE.

I've been reading everything that I can find on Tcl but not all of it applies since there is no MOM_ anything in Tcl it simply uses puts, etc. instead of MOM_output_literal for example. When I click on any of the Help menus I get an error that the postbuilder.chm has not been installed properly... I was getting that in NX8 and just installed NX8.5 on Friday and still get the same error message.

Thanks in advance,
Gary

RE: trouble with checking status of events or commands...

Are you using the review tool?
When you do does the event from the UDE match the name of the proc with MOM_

The UDE triggers the proc if they do not match exactly the proc will not run.

John Joyce
N.C. Programming Supervisor
Barnes Aerospace, Windsor CT
NX6 & NX7.5

RE: trouble with checking status of events or commands...

(OP)
John,

I attached a link to a shared jpg that shows the debug output. I can see in the debug output that MOM_probex is being called but what puzzles me is the status (Active, Inactive, User Defined) is being reported by mom_command_status despite my creating a variable for it called mom_probex_status

Here is an excerpt from the cdl file that shows it:

CODE --> tcl

#-----------------------------------------------------------------


EVENT ProbeXpos
{
   POST_EVENT "probex"
   UI_LABEL "Probe X Event"
   CATEGORY MILL
   PARAM probex_status
   {
      TYPE o
      DEFVAL "Active"
      OPTIONS "Active","Inactive","User Defined"
      UI_LABEL "Probing Status"
   }
   PARAM probex_pos
   {
      TYPE p
      TOGGLE On
      UI_LABEL "Probe X Position"
   }
} 

and this is from the post's tcl file

CODE --> tcl

#=============================================================
proc MOM_probex { } {
#=============================================================
   global mom_probex_status
   global mom_probex_pos
} 


I have learned that unless I explicitly call the MOM_probex proc I will get that 'Error: can't read "mom_probex_status": no such variable'


CODE --> tcl

proc PB_CMD_probeXpos {} {


proc MOM_probex {} {

global mom_probex_pos
global mom_probex_status


if { $mom_probex_status != "ACTIVE" } {return}

set probex_pos [ format %3.4f $mom_probex_pos(0) ]
set probey_pos [ format %3.4f $mom_probex_pos(1) ]
set probez_pos [ format %3.4f $mom_probex_pos(2) ]


MOM_output_literal "G65 P9811 X$probex_pos Y$probey_pos Z$probez_pos"

}

} 

I'm not getting any output from the proc for the probe because it can't check the status... but at least it's no longer blowing up. I just can't figure out why it's not using the variable that I defined for the status of the command.

-Gary

RE: trouble with checking status of events or commands...

You may need to have the custom command attached to an event like start of path for example

John Joyce
N.C. Programming Supervisor
Barnes Aerospace, Windsor CT
NX6 & NX7.5

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources