Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

TCL for NX post builder 1

Status
Not open for further replies.

blaineam

Aerospace
Jun 5, 2012
29
0
0
US
I am trying to build a certain header in NX post builder and am kind of stuck on a certain part.

Recently started using expressions to create a master model so everything is looking at one model instead of changing a bunch of different things or repointing when there is a rev change etc..
I have it so i can pull the expressions for the part number,part revision, and smi revision into the post and pull in the date and time through a seperate custom command.

Now we have some files that won't be switched over to the master model theory as they take weeks to program and wouldnt be beneficial. Does anyone know a custom command that could be used that says if its not using these expressions/cant find them then dont put anything?

Thanks for any help.



 
Replies continue below

Recommended for you

Although i didnt understand your requirement clearly, let me try to reply.

I think the solution is if![info exists....]}{}else{}



AK
NX 7.5.3.3
 
Yes that is for the most part what I need.

We have expressions that look at one file and populates the other files that are looking at that file. We just started this new proceedure to make things easier.

Some of the parts we have done that took weeks to program won't be redone using expressions an will have to be changed manually so these show up as no expressions contained in file. You are on the right track and I know we need and if statement just not sure how to work everything.
 
Ok so i cant really find any info to use on if info doesnt exist then enter nothing? Anyone have any ideas on how to get started with this?
 
Here is some of the custom command that i am using now to bring in the expessions. Now i need to add an if exist statement and an else statement so that if it doesnt exist it will leave the areas blank. So if expressions dont exist it wont add a part number, revision or smi.


global MOM_ask_ess_exp_value

# retrieve expression value of expression part number
# retrieve expression value of expression part_revision
# retrieve expression value of expression smi_revision

set expression1 [MOM_ask_ess_exp_value part_number]
set expression2 [MOM_ask_ess_exp_value part_revision]
set expression3 [MOM_ask_ess_exp_value smi_revision]
MOM_set_seq_off
MOM_output_literal "(part number: $expression1)"
MOM_output_literal "(revision: $expression2)"
MOM_output_literal "($expression3)"

And if i remove the part # expression this is what its comming up with instead of leaving it blank. (just for reference)

%
(part number: No such variable defined in Expression)
(revision: ORIG)
(ORIG)
(TEST.PRT)
(Mon, Jul 02, 2012)
(08:34)
G40 G17 G49 G80 G90
 
The following should do what you want?:




# retrieve expression value of expression part number
# retrieve expression value of expression part_revision
# retrieve expression value of expression smi_revision

set expression1 [MOM_ask_ess_exp_value part_number]
set expression2 [MOM_ask_ess_exp_value part_revision]
set expression3 [MOM_ask_ess_exp_value smi_revision]

if {[info exists expression1] && $expression1 == "No such variable defined in Expression"} {
set expression1 ""
}

if {[info exists expression2] && $expression2 == "No such variable defined in Expression"} {
set expression2 ""
}

if {[info exists expression3] && $expression3 == "No such variable defined in Expression"} {
set expression3 ""
}


MOM_set_seq_off
MOM_output_literal "(part number: $expression1)"
MOM_output_literal "(revision: $expression2)"
MOM_output_literal "($expression3)"
 
Status
Not open for further replies.
Back
Top