Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

Expression Update

Status
Not open for further replies.

ChaseWichert

Mining
Jan 4, 2012
147
Okay, so I am experimenting with the ug_setpartattrvalue() formula, I ended up with a lot of attributes that are named incorrectly as my expressions evolved. So I just deleted all of the part attributes, and was wondering if there was a way to rerun or update the ug_setpartattrvalue() expression OTHER THAN using Update for External Change..?
 
Replies continue below

Recommended for you

Well, we solved this problem in NX 8.0, but it's not really going to help you much even if you were to upgrade.

Prior to NX 8.0 the only way to share Expressions and Part Attributes was to use the pre-defined KF routines supplied as 'Functions' in the expression system, which is where you found those routines for reading and writing Part Attributes iusing an Expression. Now the good news that everything that you're doing now will still work (here comes the caveat) JUST AS GOOD AS IT EVER DID. And to maintain balance in the world, we all know that most of the time, with every 'GOOD' there is also a 'BAD', which means that last statement could have have been written "JUST AS BAD AS IT EVER DID".

Now the approach we took was to NOT tinker with the existing KF functions (with their current limitations) so that any existing legacy parts (created prior to NX 8.0) will be guaranteed to continue to work because we never touched those routines. What we did instead, to overcome the problems inherent in those old KF routines, was to come-up with a totally new scheme going forward. These do NOT depend on special functions based on KF routines available in the Expression system but rather provides the user with actual built-in functions allowing Attributes to directly 'read' Expressions (replacing 'ug_setPartAttrValue') and to allow Expressions to directly 'read' Attributes (replacing 'ug_askPartAttrValue').

So now if I want to create an Attribute which will always reflect the value of an Expression (and this will NOT be limited to only 'strings' since we now have Part Attributes which can be 'Integers', 'Reals', 'Dates', 'Booleans' (YES/NO), etc.) all I have to do is create an Attribute using these new options.

And on the Expression side, I now have a set of Functions which will allow me to create 'Attribute Expression' which will always reflect the value of either a Part or Object Attribute. These 'Attribute Expressions' will behave sort of like the current 'Mass Property Attributes' do now in that they will be 'read-only' and they will be presented in a special format/color so that they are easy to find and recognize.

However, this DOES mean that we are going to REMOVE the two Attribute functions based on the KF routines from the Expression system since we want you to use the new approach as they will properly update without having to use sledgehammer like 'Update for External Change'. This will be no different than now when I edited a numerical Expression and my model updates.

Now, as I stated before, if you have any existing pre- NX 8.0 part files where you've used one or both of those old KF routines, they will continue to work, but you will still have the current update issues since we have not touched that code, just made it so that you can't create and new parts using what are now 'obsolete' functions, but we will keep them working "JUST AS GOOD/BAD AS THEY EVER DID" in perpetuity.

Anyway, I hope that helps explain the situation.

And as for your actual question, NO, what you have now is as good as it is. But we fixed it in NX 8.0, but only if you create new Attributes/Expressions.

John R. Baker, P.E.
Product 'Evangelist'
Product Engineering Software
Siemens PLM Software Inc.
Industry Sector
Cypress, CA
UG/NX Museum:
To an Engineer, the glass is twice as big as it needs to be.
 
Ahh, that is good information to know. We are just now starting a huge automation push, and if those changes are in 8.0, before we start setting up all of our files with these "old" KF functions we might want to look at upgrading to 8.0 so we can use the new functionality...
 
And since we've made a lot of other changes to Attributes in general, besides making them more usable with Expressions, you really need to look at all of what we've done in NX 8.0 in these areas (we also made some minor changes in Expressions in addition to the Attribute stuff).

John R. Baker, P.E.
Product 'Evangelist'
Product Engineering Software
Siemens PLM Software Inc.
Industry Sector
Cypress, CA
UG/NX Museum:
To an Engineer, the glass is twice as big as it needs to be.
 
Okay, I just learned that we have an 8.0 disk floating around that I can install and play with to see if it is worth upgrading our department to 8.0 for this. Which it sounds like it might be. Thanks for all the info!
 
NX8.0.1

Following up on the OP, is there a way to have the function:

ug_askCurrentWorkPart()

when implemented within the NX Expression dialogue, update automatically anytime the part is Opened or Save-As performed?

Currently it appears that the default behavior is for this function to not update unless you do something like "Update for External Change", or manually edit the expression and re-enter it.

Thanks.
 
As I alluded to in my first response above, there are issues with respect to how the Expression system deals with KF routines (your 'ug_askCurrentWorkPart()' is a KF function) particularly when there was a change somewhere else in the system for which the KF routine was providing information to the Expression system or the KF routine was being used to supply Expression data to some other part of NX and one of these is that they do not immediately update when changes are made. Now there are several reasons for that and while the system will eventually catch-up with itself, we have provide a way to force that update, by using the 'Update for External Change' for example.

The NX 8.0 project by which we replaced having to depend on KF routines for sharing data between Attributes and Expressions was done so as to overcome this behavior since it was deemed critical for the role which we expect users would like Attributes to play once we had implemented the general Attribute enhancements that we did for NX 8.0. We decided to go the route we did rather than trying to rearchitect the KF code as that would have required a lot more work for very little gain. Besides, if you're going to try and alter the behavior of a sub-set of KF routines without taking on the task of changing ALL of them, this presents its own set of unique problems so we went the route that we did.

So the bottom line is that, even with the changes that we made in NX 8.0, the behavior of KF routines used in an Expression has NOT changed.

Now that we've got that out-of-the-way, exactly what are you expecting to even USE this 'ug_askCurrentWorkPart()' Expression FOR? After all, once a part is open which contains this Expression, the ONLY thing that you can do to actually CHANGE what the value would be is to do a 'Save-As'. What's next?

Anyway, I hope this helps explain what is and what is not happening.

John R. Baker, P.E.
Product 'Evangelist'
Product Engineering Software
Siemens PLM Software Inc.
Industry Sector
Cypress, CA
UG/NX Museum:
To an Engineer, the glass is twice as big as it needs to be.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor