fromEquation error

I use fromEquation I found here Library - kangaroobuilder.com

But is no work, I get

File “C:\kangarooBuilder_5_13\scripts\kangarooTools\nodes.py” , line 1501, in traverseParenthesis
sLastPart = createNodes(sEquNew)
^^^^^^^^^^^^^^^^^^^^
File “C:\kangarooBuilder_5_13\scripts\kangarooTools\nodes.py” , line 1475, in createNodes
_connectOrSet(sAddition, ‘%s.input1D[%d]’ % (sPlusMinus, i))
File “C:\kangarooBuilder_5_13\scripts\kangarooTools\nodes.py” , line 1247, in _connectOrSet
cmds.connectAttr(xValue, sAttr, f=bForce)
RuntimeError: The source attribute ‘1e’ cannot be found.

but I call very simple, just nodes.fromEquation(f’{strength} + {sLoc}.tx’)

The problem is the string formatting - if you have a float variable like strength in your case, you’ll have to write it like this:

nodes.fromEquation(f'{strength:.8f} + {sLoc}.tx')

basically adding the :.8f after the strength, telling him to do 8 digits after the comma. If you don’t do that and strength is very small, it might write it in scientific notations like 1e-08, and the fromEquation function doesn’t get along with that.

BTW - I would recommend to only use the fromEquation() function on more complex equations, if you have simple things where you just add or multiply 2 numbers, it might be easer and more readable to just use the other createAdditionNode() or createMultiplyNode() functions

I try, but same error

Wait no, it work! thanks!

1 Like