Question #706976 on Yade changed: https://answers.launchpad.net/yade/+question/706976
Status: Open => Answered Karol Brzezinski proposed the following answer: Hi Kyle, If you use ymport.text() function, you don't have to append bodies (it is included in the function). If you want to differentiate between clump properties, you can do it in two ways (at least): 1) put each clump in a separate file and load it with different keyword arguments passed to ymport.text() function. 2) put all the clumps in one file, and load them at once. Next, iterate over bodies in the simulation and apply required properties. Please see example of using the second approach below: ####### input file with clumps "clumps.txt" 0.068037 0.02416 0.0017637 0.0011423 1 0.068615 0.022601 0.0014278 0.00077244 1 0.069542 0.023528 0.0017906 0.00071539 1 0.066801 0.025141 0.0019788 0.0006786 1 0.049731 0.03499 0.0017112 0.00070436 10 0.048747 0.034309 0.0013637 0.00063928 10 0.047719 0.034628 0.0014651 0.00056027 10 0.047299 0.035323 0.0020008 0.00052311 10 ##### Yade script from yade import ymport spheres = ymport.textClumps('clumps.txt') currentClumpId = O.bodies[0].clumpId color = randomColor() for b in O.bodies: if b.clumpId != currentClumpId:#change color each time clumpId changes currentClumpId = b.clumpId color = randomColor() if isinstance(b.shape,Sphere):#colorize spheres b.shape.color = color ### Cheers, Karol -- 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