Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

postbuilder and tcl 1

Status
Not open for further replies.

marcinell

Aerospace
May 29, 2011
20
PL
hi

I want to write a condition in postbuilder
This means:
I made ??an event (UDE)
####################
POST_EVENT "rev"
UI_LABEL "no_program"
PARAM nr_zm
.....
.....

###################

and I need for generating code nc, NX detect whether it is active or not
(if not Active then stop with the message that it is missing)

how to do it?
 
Replies continue below

Recommended for you

Without seeing the rest of the UDE here is what the proc may look like


proc MOM_rev {} {

global mom_nr_zm

if {![info exists mom_nr_zm]} { MOM_output_to_listing_device "PARAMETER NOT DEFINED"
MOM_abort "PARAMETER NOT DEFINED"
return }
}

Place the procure at the start of program event or where ever you are adding the UDE

John Joyce
N.C. Programming Supervisor
Barnes Aerospace, Windsor CT
NX6.0.5.3
 
Hi John

thank`s for reply!!!

I do not know what I'm doing wrong, but does not work
Maybe you manage to find my mistake
### This is my UDE:
EVENT rev_67
{
POST_EVENT "rev"
UI_LABEL "no_program"

PARAM no_zm

{
TYPE o
DEFVAL "-"
OPTIONS "-","rev.A","rev.B","rev.C"
UI_LABEL "rev no"
}
PARAM name

{
TYPE o
DEFVAL "-"
OPTIONS "-","param 67","param fast 2/4","para fast 4/4"
UI_LABEL "name rev"
}
}

####
and this is my procedure in post builder (I create this procedure in Start of program)

#####

proc PB_CMD_no_program {} {
uplevel #0 {
proc MOM_rev { } {
global mom_no_zm mom_name

if {![info exists mom_no_zm]} { MOM_output_to_listing_device "PARAMETER NOT DEFINED"
MOM_abort "PARAMETER NOT DEFINED"
return }

if {![info exists mom_name]} { MOM_output_to_listing_device "PARAMETER NOT DEFINED"
MOM_abort "PARAMETER NOT DEFINED"
return }

MOM_output_literal "($mom_no_zm - $mom_name)"
}
}
}

#####
With such a procedure I always gets done nc code with variables and without

(sorry for my English :) )

thank`s !!!!
 
I think the first problem is that you have not made a call to this ccmd in Start of program to acutally make the proc available. I usually put a ccmd in there that is called PB_CMD_init_procs and put a call to all of my UDE ccmds. In other words just type in the cmd name in the init proc. This makes them available for the UDE to use. Also no matter what in your code the var exists when you call the ude in your program the vars are set so they will always exist. This is also I am assuming the only place you are checking for the vars. So if the ude is not set the program runs normal. In your ccmd for the ude just global the vars. Then in a separate ccmd do your checking to see if they exist and that they are not - . This will have to be in the Start Of Path area and be the first thing in there to stop everything else after it. If you have things in Start of program then either you will have to move them or live with them being output. This is because the ude's set on the program header folder are not sent until after start of program. Here is a sample snipet. You might have to put a \ in front of the - . Good Luck

if {![info exists mom_no_zm] || $mom_no_zm == -} {
MOM_output_to_listing_device "PARAMETER REV NO NOT DEFINED"
MOM_abort "PARAMETER NOT DEFINED"
return
}
if {![info exists mom_name] || $mom_name == -} {
MOM_output_to_listing_device "PARAMETER NAME REV NOT DEFINED"
MOM_abort "PARAMETER NOT DEFINED"
return
}


 
Hi thank`s very much for everything
but I do not have what I need :(

now I have that:
If I choice my event "no_program" I gets message "PARAMETER NOT DEFINED"
and
if I do not choice that event I get normal nc code

I dont`t understand this :(

I need to have this message if I not will choose a variable "no_program" from list UDE in NX.

maybe someone has a tested procedure and could share it?
Please & Thank `s!!

I work in PB 6.03
 
Post your code and exactly what you want to happen and how you propose to get it. Which params are you setting in the code I sent you must set both or you will get the error. But if the ude is not set then it should stop processing because the var doesn't exist.
 
Now what exactly do you want to do? If you want to absolutely not output any file by a UDE you will have to do some harder coding but not too bad I don't think. But if all you want to do is stop the output by aborting, that shouldn't be too bad. As I stated b4 you must empty start of program of all but the commands that are initializing the UDE's. Move all of the output to the start of path area and trigger it with a variable that will only be 0 once and then increment it. This was all in your start of program. Can't have this as the UDE's are not available until the Start of path. Use the commands that I have provided.
 
 http://files.engineering.com/getfile.aspx?folder=34e912c8-4d74-4d75-aa29-eb2abbdf0172&file=marcinells_commands.tcl
Thank you very much
I make it last
I did not hit it without your help
 
hello all

I want to do like Marcinell
But I do not go

I want to nx detected that when I did not use in the program event (UDE = Siemens_Cycles.cdl - EVENT high_speed_setting "SINUMERIK 840")

looks like such a procedure?

I work in NX6.05 & PB 6.03 & postprocessor with templates SINUMERIK from PB

I tried the procedure:
if {![info exists mom_command_status] || $mom_command_status == "Inactive"} {
MOM_output_to_listing_device "PARAMETER...." MOM_abort "PARAMETER NOT DEFINED"
return
}
but this is not work

help me please

Thank you
 
You really should start your own thread but mom_command_status is in most ude's and variables in ude's are only available when the ude is used so that is not going to work just checking for it to be inactive. You need to check for another variable that is in the ude. Also where are you checking for it? Timing is essential as ude's are only available at certain times. If you set the ude on the program header(folder) then it will be available at the start of operation area. You could check for it first thing in that area.
 
ok thanks shags72
I know what's going on

cheers
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top