← Back to team overview

yade-users team mailing list archive

Re: [Question #658629]: Oedometric consolidation test

 

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

Jan Stránský proposed the following answer:
(6) you can use this or similar function to create a cylindrical surface. Top and bottom box is easy. Have a look at [1] for engines to use
###
from math import sin,cos

def cylSurf(center,radius,height,nSegments=12,thick=0,**kw):
   """creates cylinder made of boxes. Axis is parallel with z+"""
   center = Vector3(center)
   angles = [i*2*pi/nSegments for i in range(nSegments)]
   pts = [center + Vector3(radius*cos(a),radius*sin(a),.5*height) for a in angles]
   ret = []
   for i,pt in enumerate(pts):
      l = pi*radius/nSegments
      es = (.5*thick,l,.5*height)
      ori = Quaternion((0,0,1),i*2*pi/nSegments)
      ret.append(box(pt,es,ori,**kw))
   return ret

surf = cylSurf((1,2,3),4,5,nSegments=12,thick=.1)
O.bodies.append(surf)
###

cheers
Jan

[1] https://github.com/yade/trunk/blob/master/examples/simple-scene
/simple-scene.py

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