Expression Update
Expression Update
(OP)
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..?





RE: Expression Update
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
http://www.siemens.com/plm
UG/NX Museum: http://www.plmworld.org/p/cm/ld/fid=209
To an Engineer, the glass is twice as big as it needs to be.
RE: Expression Update
RE: Expression Update
John R. Baker, P.E.
Product 'Evangelist'
Product Engineering Software
Siemens PLM Software Inc.
Industry Sector
Cypress, CA
http://www.siemens.com/plm
UG/NX Museum: http://www.plmworld.org/p/cm/ld/fid=209
To an Engineer, the glass is twice as big as it needs to be.
RE: Expression Update
RE: Expression Update
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.
RE: Expression Update
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
http://www.siemens.com/plm
UG/NX Museum: http://www.plmworld.org/p/cm/ld/fid=209
To an Engineer, the glass is twice as big as it needs to be.