← Back to team overview

yade-users team mailing list archive

Re: [Question #497350]: Export a polyhedron into a *.stl or * .gts file

 

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

    Status: Answered => Open

Tina Asia is still having a problem:
Hi Jan,

Thanks for your patience, but I got an error by importing the *.stl file
generated by the above code. The error and my new code are as follows.

from yade import ymport
from yade import pack
from yade import qt

pred=O.bodies.append(ymport.stl('tina.stl'))
spheres=pack.randomDensePack(pred,radius=0.001,rRelFuzz=0.3,spheresInCell=500,color=(1,0,1))
O.bodies.append(spheres)

qt.View()
qt.Controller()

I got this error:

$ yade fillsphere.pyWelcome to Yade 2017.01a 
TCP python prompt on localhost:9000, auth cookie `sdcaek'
XMLRPC info provider on http://localhost:21000
Running script fillsphere.py
ERROR /home/tina/YADE/trunk/pkg/dem/STLImporter.cpp:23 import: Can't open file: tina.stl
Traceback (most recent call last):
  File "/home/tina/YADE/install/bin/yade", line 182, in runScript
    execfile(script,globals())
  File "fillsphere.py", line 6, in <module>
    spheres=pack.randomDensePack(pred,radius=0.001,rRelFuzz=0.3,spheresInCell=500,color=(1,0,1))
  File "/home/tina/YADE/install/lib/x86_64-linux-gnu/yade/py/yade/pack.py", line 490, in randomDensePack
    if not dim: dim=predicate.dim()
AttributeError: 'list' object has no attribute 'dim'
[[ ^L clears screen, ^U kills line. F12 controller, F11 3d view (use h-key for showing help), F10 both, F9 generator, F8 plot. ]]

Besides, I also tried pack.inConvexPolyhedron (https://www.yade-
dem.org/doc/yade.pack.html?highlight=pack.in#yade.pack.inConvexPolyhedron)
to fill a polyhedron with many sub-particles, but this one got error
too:

This is my code:

from yade import polyhedra_utils

rock = PolyhedraMat()
rock.IsSplitable = True
rock.strength = 6e3

poly = polyhedra_utils.polyhedra(rock, size=(0.01,0.02,0.01), seed=1)
O.bodies.append(poly)

pred=pack.inConvexPolyhedron(poly)
aabb=pred.aabb()
dim0=aabb[1][0]-aabb[0][0]
spheres=O.bodies.append(pack.randomDensePack(pred,radius=0.001,rRelFuzz=0.3,spheresInCell=300))
O.bodies.append(spheres)

from yade import qt
qt.View()
qt.Controller()

and this is the error:

~/Desktop/polyhedra$ yade poly.py
Welcome to Yade 2017.01a 
TCP python prompt on localhost:9000, auth cookie `yudssc'
XMLRPC info provider on http://localhost:21000
Running script poly.py
Traceback (most recent call last):
  File "/home/tina/YADE/install/bin/yade", line 182, in runScript
    execfile(script,globals())
  File "poly.py", line 10, in <module>
    pred=pack.inConvexPolyhedron(poly)
  File "/home/tina/YADE/install/lib/x86_64-linux-gnu/yade/py/yade/pack.py", line 208, in __init__
    self._inHalfSpaces = [inHalfSpace(c,d) for c,d in planes]
TypeError: 'Body' object is not iterable
[[ ^L clears screen, ^U kills line. F12 controller, F11 3d view (use h-key for showing help), F10 both, F9 generator, F8 plot. ]]

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