Suppose you have 3 expressions called 'length', 'width' and 'height' and you'd like to automatically update the part attributes called ATTR_length, ATTR_height and ATTR_width accordingly.
(Why in the earth would I want to do that, you might ask- these values could well be part list columns, or some dirty ERP trick might be the case. Actually I need neither, but it's good to know that this can be done !)
In the Expressions window, you need to create a dummy number expression, say 'test'. This needs to be a number, not a string variable.
Then you need to set the value of 'test' using the following syntax :
- test = ug_setPartAttrValue( "ATTR_length", stringValue(length) )
You can also get the value of an existing attribute, and assign it to an expression. This time, the syntax is :
- test2 = MakeNumber( ug_askPartAttrValue( "ATTR_width" ))
In order not to have lots of these dummy test variables, you could create a combined dummy, like:
- test = ug_setPartAttrValue( "x", stringValue( p1) ) + ug_setPartAttrValue( "y", stringValue( p2) ) +ug_setPartAttrValue( "z", stringValue( p3) )
11 comments:
Wow!!! I've just discovered (today) your blog. Seems wonderfull.
I was searching for this functionality long time ago. And now I have discovered it is in your blog since september.
Do you know what license is needed to use this functionality?
Frank.
Frank,
thanks for your encouraging comments!
Only gateway/modeling is enough for this functionality.
Google recently indexed my page, that's why you might not have come across before..
Hi, I have tested the tricks, and I have a problem.
In the first case, the attribute is updated when the expression changes, but in the second, the expression is not updated when the attribute changes.
Any suggestions.
Thanks.
Hi Frank,
I guess you're right. In the first case, when you hit the OK button for expressions dialog, the attribute is updated properly. But in the second case, expressions are not aware of the fact that the attribute has changed. You can use theTools->Update->Update for External Change command to trigger this.
Actually this is no different from the case when an expressions value is linked to an Excel cell. You need to update manually for that as well.
Great blog. Here is a question on knowledge fusion that I haven't found the answer to:
How do I create a multiple patch through curve surface in NX that can be used in Knowledge Fusion, and be suppressed from there?
Linus
Linus,
Unfortunately this question is beyond my very limited experience on KF..
Thanks for the compliment by the way..
hoping to have some (like a 3 month holiday!) spare time for KF in the future,
Hakan
I was searching for the same. Thanks a Lot for for posting it.
I have a problem, I am working in assembly and import various expression file to update the complete assy. Having done as per your guidelines the Part attributes are created once, but doesnt update when expression file is imported till i manually go into each part and open expression window and update the dummy variable for attributes.
Could you please help..
Hello Hakan are you still working on NX?
I have a question about this your old post.
I have a column in my template parts list called "Code" and I'd like its filled by .
I know that I can set column to automatically taken the but I need "Code" column because most parts had
Code = part name
while some others had
Code = partial part name
and few others had
Code = nothingf to do with part name
There is a way to automatically write in a parts list column?
Thank you
Industrial equipment suppliers play a vital role in supporting manufacturing and production processes. These suppliers offer a wide range of machinery, tools, and technologies tailored to diverse industrial needs. By ensuring the availability of high-quality equipment, they contribute to operational efficiency and output consistency. Find and refer UAE Industrial Equipment Supplier for more relevant info.
Post a Comment