How does yade import models externally

Asked by Wang Haijiang

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!

Question information

Language:
English Edit question
Status:
Expired
For:
Yade Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Jan Stránský (honzik) said :
#1

Hello,

this is very difficult to answer without actual files..

Is using STL a problem?

Cheers
Jan

Revision history for this message
Wang Haijiang (ksr945) said :
#2

Hello Jan,

Thank you for your answer,I have sloved the question

Cheers
Wang

Revision history for this message
Karol Brzezinski (kbrzezinski) said :
#3

Hi,

would you mind sharing with us how the problem was solved?

Cheers,
Karol

Revision history for this message
Launchpad Janitor (janitor) said :
#4

This question was expired because it remained in the 'Needs information' state without activity for the last 15 days.