Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

Drafting Attributes help 1

Status
Not open for further replies.

Don1981

Nuclear
Nov 20, 2012
4
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
 
Replies continue below

Recommended for you

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
 
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
 
Don1981 said:
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
 
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
 
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:
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
 
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.
 

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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor