Re: [Yade-users] [Question #294908]: Remove Spheres Randomicaly from Pack
Question #294908 on Yade changed: https://answers.launchpad.net/yade/+question/294908 Luis Barbosa posted a new comment: Hi Jan, Working on it! Thanks. Luis -- 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
Re: [Yade-users] [Question #294908]: Remove Spheres Randomicaly from Pack
Question #294908 on Yade changed: https://answers.launchpad.net/yade/+question/294908 Status: Answered => Solved Luis Barbosa confirmed that the question is solved: Thanks velimier, that solved my question. -- 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
Re: [Yade-users] [Question #294908]: Remove Spheres Randomicaly from Pack
Question #294908 on Yade changed: https://answers.launchpad.net/yade/+question/294908 Jan Stránský proposed the following answer: Hi Luis, I like the approach of Veljko. Aternativally you can implement something like removeRandom() method, but it would need some c++ coding (as the core of SpherePack is implemented in c++) cheers Jan 2016-06-06 12:58 GMT+02:00 velimier : > Question #294908 on Yade changed: > https://answers.launchpad.net/yade/+question/294908 > > Status: Open => Answered > > velimier proposed the following answer: > Hi, > maybe you can randomly append spheres from packing but excluding certain > number of spheres. > > from yade import pack > import random > > sp = SpherePack() > sp = pack.regularOrtho(pack.inAlignedBox((0,0,0),(1,1,1)),radius=.05,gap=0) > > n=350 #number of spheres to exclude > > #randomly append spheres from packing > for i in range(0, len(sp)-n): > b = sp[random.randint(0,len(sp)-1)] > O.bodies.append(b) > sp.remove(b) > > Hope it suits your need, > Veljko > > -- > 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 > -- 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
Re: [Yade-users] [Question #294908]: Remove Spheres Randomicaly from Pack
Question #294908 on Yade changed: https://answers.launchpad.net/yade/+question/294908 Status: Open => Answered velimier proposed the following answer: Hi, maybe you can randomly append spheres from packing but excluding certain number of spheres. from yade import pack import random sp = SpherePack() sp = pack.regularOrtho(pack.inAlignedBox((0,0,0),(1,1,1)),radius=.05,gap=0) n=350 #number of spheres to exclude #randomly append spheres from packing for i in range(0, len(sp)-n): b = sp[random.randint(0,len(sp)-1)] O.bodies.append(b) sp.remove(b) Hope it suits your need, Veljko -- 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
[Yade-users] [Question #294908]: Remove Spheres Randomicaly from Pack
New question #294908 on Yade: https://answers.launchpad.net/yade/+question/294908 Hi everyone, After creating a packing of spheres, I would like to remove randomicaly some spheres from inside the pack. Does anyone has some experience on this? Thanks, Luis -- 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