Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

Editing a part attribute (string) in a note

Status
Not open for further replies.

kpkp

Mechanical
Oct 25, 2012
8
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.
 
Replies continue below

Recommended for you

kpkp said:
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
 
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 ;).
 
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
 
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.
[ol 1]
[li]In the modeling application, open the expression dialog[/li]
[li]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, " ").[/li]
[li]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).[/li]
[li]The connectStart (value "A1") and connectEnd (value "B2") expressions can now be used in notes or other attributes/expressions as necessary.[/li]
[/ol]

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

Part and Inventory Search

Sponsor