← Back to team overview

yade-users team mailing list archive

Re: [Question #688818]: Rototraslation of a cylinder

 

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

    Status: Answered => Open

Paolo is still having a problem:
Hi!

I succeeded in doing the rototranslation of the roller pretty well also
thanks to a code I found here [1] and the erasing too, but I have
trouble in generating the second roller after the deleting of the
previous one. Actually I was able to write a script which generates 2
rollers at the very start of the simulation which are overlapped. The
simulation makes firstly the first roller move, erases it and then the
second one strarts to move. However, I'd like to generate the second one
after the deleting of the firt one because I think that the final
simulation could be faster if I have one cylinder at a time. Here's a
draft of the code.

rullo = geom.facetCylinder((0,0,0),radius=r,height=d,orientation=Quaternion((0,1,0),pi/2),wallMask=7,segmentsNumber=50,material=Mat1)
O.bodies.append(rullo)
idsr = [r1.id for r1 in rullo]

rullo1 = geom.facetCylinder((0,0,0),radius=r,height=d,orientation=Quaternion((0,1,0),pi/2),wallMask=7,segmentsNumber=50,material=Mat1)
O.bodies.append(rullo1)
idsr1 = [r2.id for r2 in rullo1]

O.engines=[
..........
	
		CombinedKinematicEngine(ids=idsr,label='combEngine') + TranslationEngine(translationAxis=(0,1,0),velocity=0) + RotationEngine(rotationAxis=(1,0,0), angularVelocity=0,rotateAroundZero=True,zeroPoint=(0,0,0)),
		
.....
 	 ]

transEngine, rotEngine = combEngine.comb[0], combEngine.comb[1]

def updateRoller():
	transEngine.velocity = vel
	rotEngine.angularVelocity = angVel
	rotEngine.zeroPoint += Vector3(0,1,0)*vel*O.dt
	if rotEngine.zeroPoint[1]>limit:
		for t in range(min(idsr),max(idsr)+1):
			rotEngine.zeroPoint *= 0
			transEngine.velocity = 0
			rotEngine.angularVelocity = 0
			O.bodies.erase(t)
			checker.command='step2()'

def step2():
	combEngine.ids=idsr1
	transEngine.velocity = vel	
	rotEngine.angularVelocity = angVel	
	rotEngine.zeroPoint += Vector3(0,1,0)*vel*O.dt


[1]: https://gitlab.com/yade-dev/trunk/blob/master/examples/test
/combined-kinematic-engine.py

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