← Back to team overview

yade-users team mailing list archive

Re: [Question #293955]: How to generate dense packing of aggregates

 

Question #293955 on Yade changed:
https://answers.launchpad.net/yade/+question/293955

Jan Stránský proposed the following answer:
Hi Varun,


> For translation, I was trying to use
>
> for s in sp:
>   s.state.pos[0] = s.state.pos[0] - 1.9603017657
>   s.state.pos[1] = s.state.pos[1] - 1.04086
>   s.state.pos[2] = s.state.pos[2] - 2.01932
>
> which doesn't work.
>

You have to assign all pos at once:
##########################
b = sphere((1,2,3),1)
b.state.pos[0] = 10 # does not work
b.state.pos = (10,2,3) # works ok
b.state.pos = b.state.pos - (1.96,1.04,2.02) # also works ok
##########################


>
> Then, I noticed from the Yade user manual that there is a function
> translate((Vector3)arg2) which translate all spheres by given vector. I
> tried using it as:
> sp.translate(-1.96030,-1.04086,-2.01932)
>
> but this gives me the error: AttributeError: 'list' object has no
> attribute 'translate'. Mostly, I am using it wrong. Could you please
> point me to the correct usage ?
>
>
for this, you need SpherePack instance, not just list of particles (as the
error says). But the first approach works ok, so no need to use this
function

cheers
Jan

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.