yade-users team mailing list archive
-
yade-users team
-
Mailing list archive
-
Message #16281
[Question #661017]: call a class from yade
New question #661017 on Yade:
https://answers.launchpad.net/yade/+question/661017
Good evening,
What i am trying to do is bundle the yade simulation in a class which works
from yade.pack import *
from yade import ymport
import math
class simul():
def run(self):
O.bodies.append([
sphere((0,0,4),1),
sphere(center=(0,0,0),radius=.5,fixed=True)
])
O.engines=[
ForceResetter(),
InsertionSortCollider([Bo1_Sphere_Aabb()]),
InteractionLoop(
[Ig2_Sphere_Sphere_ScGeom()],
[Ip2_FrictMat_FrictMat_FrictPhys()],
[Law2_ScGeom_FrictPhys_CundallStrack()]
),
NewtonIntegrator(gravity=(0,0,-9.81),damping=0.1),
]
O.dt=.5e-4*PWaveTimeStep()
#simulation=simul()
#simulation.run()
and call it from another file
import math
import operator
import gts
from yade.pack import *
from yade import ymport
from myclass import simul
simulation=simul()
simulation.run()
i get this
yade run.py
Welcome to Yade 1.20.0
TCP python prompt on localhost:9000, auth cookie `ucsdsy'
XMLRPC info provider on http://localhost:21000
Running script run.py
Traceback (most recent call last):
File "/usr/bin/yade", line 182, in runScript
execfile(script,globals())
File "run.py", line 10, in <module>
from myclass import simul
ImportError: No module named myclass
[[ ^L clears screen, ^U kills line. F12 controller, F11 3d view (use h-key for showing help), F10 both, F9 generator, F8 plot. ]]
[0;34mYade [[1;34m1[0;34m]: [0m
Thank you for the help
(PS, amazing community)
--
You received this question notification because your team yade-users is
an answer contact for Yade.