yade-users team mailing list archive
-
yade-users team
-
Mailing list archive
-
Message #28531
[Question #703626]: How does yade import models externally
New question #703626 on Yade:
https://answers.launchpad.net/yade/+question/703626
Hello all:
I tried importing the Rhino-generated gts model into yade, but it ran incorrectly. Then use Rhino to export stl file, after conversion into gts file can be run
from yade import pack
import gts, os.path, locale
surf=gts.read(open('1027.gts'))
if surf.is_closed():
pred=pack.inGtsSurface(surf)
aabb=pred.aabb()
dim0=aabb[1][0]-aabb[0][0]; radius=dim0/70. # get some characteristic dimension, use it for radius
O.bodies.appendClumped(pack.regularHexa(pred,radius=radius,gap=radius/4.))
surf.translate(0,-(aabb[1][1]-aabb[0][1])/2.0,-(aabb[1][2]-aabb[0][2])) # move surface down so that facets are underneath the falling spheres
O.bodies.append(pack.gtsSurface2Facets(surf,wire=True))
O.engines=[
ForceResetter(),
InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Facet_Aabb()],label='collider'),
InteractionLoop(
[Ig2_Sphere_Sphere_ScGeom(),Ig2_Facet_Sphere_ScGeom()],
[Ip2_FrictMat_FrictMat_FrictPhys()],
[Law2_ScGeom_FrictPhys_CundallStrack()],
),
NewtonIntegrator(damping=.1,gravity=[0,0,-500.0]),
PyRunner(iterPeriod=1000,command='timing.stats(); O.pause();'),
PyRunner(iterPeriod=10,command='addPlotData()')
]
O.dt=.7*PWaveTimeStep()
O.saveTmp()
O.timingEnabled=True
O.trackEnergy=True
from yade import plot
plot.plots={'i':('total',O.energy.keys,)}
def addPlotData(): plot.addData(i=O.iter,total=O.energy.total(),**O.energy)
plot.plot(subPlots=False)
from yade import timing
from yade import qt
qt.View()
Traceback (most recent call last):
File "/usr/bin/yade", line 336, in runScript
execfile(script,globals())
File "/usr/lib/python3/dist-packages/past/builtins/misc.py", line 87, in execfile
exec_(code, myglobals, mylocals)
File "HT.py", line 8, in <module>
surf=gts.read(open('1027.gts'))
RuntimeError: expecting a number (z coordinate)
Thank you in advance!
--
You received this question notification because your team yade-users is
an answer contact for Yade.