Using a little bit of Knowledge Fusion functions, it's easily possible to interact expressions with attributes, and vice versa.
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) )
stringValue is another KF function to convert a numeric value into a string, which ug_setPartAttrValue requires.
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" ))
where test2 is the expression to be updated.
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) )