×
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

TCL for NX post builder

TCL for NX post builder

TCL for NX post builder

(OP)
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.



RE: TCL for NX post builder

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

RE: TCL for NX post builder

(OP)
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.

RE: TCL for NX post builder

(OP)
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?

RE: TCL for NX post builder

(OP)
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

RE: TCL for NX post builder

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)"

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