×
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

Drafting Attributes help

Drafting Attributes help

Drafting Attributes help

(OP)
Hi all,

I'm after a little help regarding referencing certain attributes in the drafting table within NX7.5 & Teamcenter 8
I'm trying to automate the standard border we use as much as possible rather than the current method of manual inputs.
Hopefully someone can point me in the right direction.

1. For the owners name I am currently referencing <W@DB_OWNER_NAME>
This returns the following result "Bloggs, Joe"
Is there a way to switch these around with just the first initial and then surname, and also convert them to uppercase? For Example J. BLOGGS

2. For the copyright date, can I somehow use the attribute <W@DB_MODIFIED_DATE> and truncate this to just the year?
For example this would return 07-Feb-2017, but all I require is 2017

Any help is much appreciated.

Thanks,

Don Henderson

RE: Drafting Attributes help

Fire up the expression editor; create string expressions that link to your attributes. For my test file, I just made 2 string attributes expressions (db_modified_date = "07-FEB-2017" and db_owner = "Bloggs, Joe").

Getting the year from the date is pretty easy, make a new string expression with the formula:

CODE

last(splitstring(db_modified_date,"-")) 

The splitstring function breaks the string at the hyphens and returns a list of (in this case) 3 strings; the last function returns the last item in the list (the year).

Here's the expression for the user name. It also uses the splitstring function, but is a bit more involved because we also want to grab the 2nd character of the last list item, reverse the order, and make everything uppercase.

CODE

StringUpper( substring(last(splitstring(db_owner,",")),2,2) ) + ". " + StringUpper(first(splitstring(db_owner, ","))) 

The drafting notes can reference these expressions rather than the original attributes.

www.nxjournaling.com

RE: Drafting Attributes help

(OP)
Thanks Cowski, this has been a great help and very well explained.

Rather than creating my own attributes I ended up putting a ug_askPartAttrValue("DB_MODIFIED_DATE") to obtain the info directly from Teamcenter, and likewise for the owner name.

Much appreciated for your assistance.

Don

RE: Drafting Attributes help

Quote (Don1981)

Rather than creating my own attributes...

Sorry, I didn't mean you needed to create new attributes. I typed "attributes", but meant "expressions"; I edited my post above to correct that.

www.nxjournaling.com

RE: Drafting Attributes help

(OP)
Thanks again for your help.

I'm having some trouble though when someone else brings in the new part template as the border...
There appears to be no live link to the expressions table even when updating. The name on the drawing stays the same as mine.

To get around this I have written inside our setup macro to delete the expression reference (<X0.2@Name'1>), save the part, and then retype in the expression reference. This then updates it to the correct value.

This is fine as long as long as everyone uses the macro, however, out of curiosity, do you know of a way to keep this link 'live'?
So as soon as they press save the drawing then picks up the 'new' name from the expression table.

Thanks,

Don

RE: Drafting Attributes help

Are you using the master model method (adding your piece part as a component of the drawing) or is your drawing in the same file as the model?

The apostrophe in the expression name leads me to believe that you are using file -> import part to get the drawing border into your drawing file. I've not tested this method, but my past experience with NX leads me to believe there may be some updating issues with this workflow.

Finally, what version of NX are you using? Attributes got a major overhaul in NX 8 (and to a lesser extent, expressions). The version you are using may play a part in what gets updated and when it gets updated.

If you are using the master model method with drawing templates, there is a way to pass an attribute from the model file to the drawing file:
https://docs.plm.automation.siemens.com/tdoc/nx/10...
The above link is to the online NX help files (NX 10), it may require a login to access them. If you have the NX help files installed locally, try searching for "drawing template attributes".

www.nxjournaling.com

RE: Drafting Attributes help

(OP)
We are using NX7.5 and the method of file -> import part, this is the practice our business has taken.
We are due to upgrade early next year hopefully, so I guess I'll have to have a look again then.

I cannot get on the link here at work unfortunately, but I shall browse the help files we have on our system to see what I can find.

Thanks Cowski.

RE: Drafting Attributes help


Hi Cowski

I tried your above code on my nx8.5 expressions editor and its work fine.

But when I go to the expressions editor functions dialog I dont see

the string function "splitstring" do you know how I can see it.

Thank you in advanced

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