×
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

Editing a part attribute (string) in a note

Editing a part attribute (string) in a note

Editing a part attribute (string) in a note

(OP)
Hi,

I'm using NX 9 and I want to edit a part attribute in a note. To clarify what I mean I'll give an example:

In a note I want to use a part of a part name. The part (hose) is named "A1 B2" where "A1" and "B2" stand for the place where the hose needs to be connected. Now I would like to add a note (drawing) at each side of the hose: one note showing "A1" and the other showing "B2". Since the name of the hose might change I would like to have the notes linked to the model. Is it possible to make a note from the first part of the part attribute and a note from the second part of the attribute? The thing that is sure is that the name includes a space (" ") between the 2 parts of the name I would like to extract.

Note: solutions like separating the name and save it under two attributes is not possible for me.

Thanks in advance.

RE: Editing a part attribute (string) in a note

Quote (kpkp)

Note: solutions like separating the name and save it under two attributes is not possible for me.

What about splitting the string and saving it as expressions? You could then reference the expressions in your note(s). This could be done at the assembly level rather than at the part level.

www.nxjournaling.com

RE: Editing a part attribute (string) in a note

(OP)
Thanks for your reply. I guess what you are suggesting is what I want, but I can't figure out exactly how. I read about the "ug_askcurrentworkpart()" function but I don't know how to split the string. In my case is the drawing a separate part with an assembly in it. The drawing contains the information for the naming of the hose ends.

In addition it would be nice to have the hose length (which is a lower level part attribute) in a note. The model data has the length noted in "meter" and I would like to have it in "mm" with 1 decimal place (or no decimal place when the length is xxx,0).

Could you, or someone else, help me out with this? The help is much appreciated :). Please note that I'm a mechanical engineer with basic programming skills. If this requires some more advanced coding I guess I'll have to keep do things manually ;).

RE: Editing a part attribute (string) in a note

Hi,
I think i used SUBSTRING and SPLIT STRING functions sometime back for a similar activity.
Will see once i am back in office tomorrow.
Best Regards
Kapil

RE: Editing a part attribute (string) in a note

In the part file, let's assume that you have a string attribute named connection with a value of "A1 B2". Open the assembly that uses this part as a top level component.
  1. In the modeling application, open the expression dialog
  2. Create a new expression of type List, for illustration, I'll call it testSplit. For the formula, enter splitstring( now click the "reference object attribute" button, select the component and the connection attribute; an expression reference will be added to your formula. To finish the formula, enter ', " "' without the single quotes (comma double quote space double quote). The finished formula will look something like: splitstring(p1, " ").
  3. Create two string expressions (I'll call mine connectStart and connectEnd). For connectStart use the formula: first(testSplit) and for connectEnd use the formula: last(testSplit).
  4. The connectStart (value "A1") and connectEnd (value "B2") expressions can now be used in notes or other attributes/expressions as necessary.

www.nxjournaling.com

RE: Editing a part attribute (string) in a note

(OP)
Thanks for the replies. Cowski, your clear explanation is perfect. I managed to get done what I intended (the splitstring() command expected a list, so I selected "list").

For the hose dimension I wasn't able to retrieve the information because the attribute is on a lower part level.

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