×
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

NX Open

NX Open

(OP)
Hi,

I wonder if you could help me with following topics:

Lets assume, that I have a part. I want to create following attributes: designer, date and material

Before these attributes, I want to check, if these attributes have already been created and in case that yes, I want to take the values from them.
And this is the problem. In case, that the attributes are not defined, the journal is not working.

I have tried this:

If workpart.GetStringAttribute("material") is nothing Or workpart.GetStringAttribute("material") = "" Then

but it doesnt work.

the second thing is:

if i want to save as... part, it will save it to ugii directory, but I would like to save it to NX work directory...

Thank you

Vit


RE: NX Open

You could try using a "TRY"
this attempts do do something. if it fails it doesn't just "bomb out" of the journal you acn program in an appropriate response.
Generaly the journal will fail if you attempt to get an attribute that doesn't exist so if it fails we assume it doesn't exist.  The code below the "Catch" Line is used on an faliure of the try.
it try's to get the attribut3e from "DB_DWG_NO" and apply it to a variable "PrevNo".  If getting the attribute fails it juat applies a dummy value (you could replace this with a prompt for the user to enter it here)
There is also a varaible of "Attrer" which I have here so I can tell if there have been any faliures getting any attributes quickly ( this is just 0 for no errors and 1 for errors in my prog)

--------------Code-----------------------

Try
PrevNo = thesession.Parts.Work.GetStringAttribute("DB_DWG_NO")
Catch exc As NXException
PrevNo = "XXXXX-XX"
Attrer = 1
End Try

------------------------------------------

Hope that helps,

 

Mark Benson
Aerodynamic Model Designer

RE: NX Open

(OP)
Hi,

I have already used the try command, because I wasnt able to find out anything better. But I dont like it. It seems, that the NX library is missing this option. I tried to find it out in the NX open references, but without success.

But with try, it works.

Vita

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