Question #704551 on Yade changed: https://answers.launchpad.net/yade/+question/704551
Status: Answered => Open Leonard is still having a problem: Hi Jan and Karol, Thanks for your MWEs. Because I use an old version of Yade (2018.02b), consequently executing the MWE gives error: ValueError: too many values to unpack[1]. Thereby, I need to adapt the MWE to my old verison. I successfully adapted Karol's MWE: # exporter.exportSpheres(ids='all',what=dict(rotation_method_1 = 'b.state.rot()',rotation_method_2 = '(b.state.refOri.conjugate()*b.state.ori).toRotationVector() ')) ###### change to exporter.exportSpheres(ids='all',what=[('rotation_method_1','b.state.rot()'),('rotation_method_2','(b.state.refOri.conjugate()*b.state.ori).toRotationVector()')]) But I didn't make it for Jan's MWE. What I tried is: from yade import export import builtins # to store "data" and access them from a string command spheres = [ sphere((0,0,0),1), sphere((3,0,0),1), sphere((6,0,0),1), ] O.bodies.append(spheres) data = [ # e.g. angle 1, 2, 3, ] builtins.data = data # make data "global", visible in export module vtk = export.VTKExporter("test-angle") # vtk.exportSpheres(what=dict(angle="data[b.id]")) ## change it to vtk.exportSpheres(ids='all',what=[('ids','b.id'),('pos','b.state.pos'),('angle','data[b.id]')]) It returns the following error: Traceback (most recent call last): File "/usr/bin/yade", line 182, in runScript execfile(script,globals()) File "Jan_MWE.py", line 22, in <module> vtk.exportSpheres(ids='all',what=[('ids','b.id'),('pos','b.state.pos'),('angle','data[b.id]')]) File "/usr/lib/x86_64-linux-gnu/yade/py/yade/export.py", line 431, in exportSpheres test = eval(command) # ... eval one example to see what type (float, Vector3, Matrix3) the result is ... File "<string>", line 1, in <module> NameError: name 'data' is not defined Could you please give some instructions? Thanks Leonard [1]https://answers.launchpad.net/yade/+question/695966 -- You received this question notification because your team yade-users is an answer contact for Yade. _______________________________________________ Mailing list: https://launchpad.net/~yade-users Post to : yade-users@lists.launchpad.net Unsubscribe : https://launchpad.net/~yade-users More help : https://help.launchpad.net/ListHelp