← Back to team overview

yade-users team mailing list archive

Re: [Question #691026]: Loading the stored the position of plank, but it wrong

 

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

Jan Stránský proposed the following answer:
> my facet is a quadrangle, and consist with two triangles.
> I used the " pack.sweptPolylines2gtsSurface([positionWind[0]], capStart=True, capEnd=True)" to create the plank, but I do not know why the quadrangle consists with two triangles. That is source of my problem.

sweptPolylines2gtsSurface - gts means GNU **Triangulated** Surface [1], therefore the result are triangles
Yade facet = triangle. Yade currently does not support more general planar shapes.
You can use box [2] with zero or "small" thick if your aim is a rectangle.

> My script is similar with yours.

Ok, now we are targeting the source of the problem :-)
Yade Body has a State, which has position (pos), but also an orientation (ori). Depending on the shape, to be able to restore the position AND orientation, you should save state.pos, but also state.ori.

> I modified the script as follow, I hope it can meet the MWE

getting closer, thanks :-) but I will update my MWE:
### script 1
f = facet(((0,0,0),(1,0,0),(0,1,0)))
O.bodies.append(f)
f.state.vel = (.1,0,0)
f.state.angVel = (0,0,.1)
O.run(10,True)
data = []
for b in O.bodies:
   axis,angle = b.state.ori.toAxisAngle()
   data.append([b.id,b.state.pos,axis,angle])
numpy.save("f",data)
### script 2
f = facet(((0,0,0),(1,0,0),(0,1,0)))
O.bodies.append(f)
print(numpy.load("f.npy",allow_pickle=True))
[[i,pos,axis,angle]] = numpy.load("f.npy",allow_pickle=True)
f.state.pos = pos
f.state.ori = Quaternion(axis,angle)
###

a few notes:
- as pointed above, consider an external program for visualization
- instead of pos or ori, you can save vertices of facets, which is somehow more general than just pos and ori and depending on the geometry to be hard-coded (similarly to other shapes e.g. you switch to box)

cheers
Jan

[1] http://gts.sourceforge.net/
[2] https://yade-dem.org/doc/yade.utils.html#yade.utils.box

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