Beispiel #1
0
rad,gap=.15,.02

#Add material
O.materials.append(FrictMat(young=10e9,poisson=.25,frictionAngle=0.5,density=1e3))

#Parameters, which will be passed into spheres and facets creators
kw={'material':0}
kwBoxes={'color':[1,0,0],'wire':False,'dynamic':False,'material':0}
kwMeshes={'color':[1,1,0],'wire':True,'dynamic':False,'material':0}

O.bodies.append(
	pack.regularHexa(
		(pack.inSphere((0,0,4),2)-pack.inSphere((0,-2,5),2)) & pack.notInNotch(centerPoint=(0,0,4),edge=(0,1,0),normal=(-1,1,-1),aperture=.2)
		,radius=rad,gap=gap,color=(0,1,0),material=0) # head
	+[utils.sphere((.8,1.9,5),radius=.2,color=(.6,.6,.6),material=0),utils.sphere((-.8,1.9,5),radius=.2,color=(.6,.6,.6),material=0),utils.sphere((0,2.4,4),radius=.4,color=(1,0,0),material=0)] # eyes and nose
	+pack.regularHexa(pack.inCylinder((-1,2.2,3.3),(1,2.2,3.3),2*rad),radius=rad,gap=gap/3,color=(0.929,0.412,0.412),material=0) #mouth
)
groundId=O.bodies.append(utils.facet([(12,0,-6),(0,12,-6,),(-12,-12,-6)],dynamic=False)) # ground

for part in [
	pack.regularHexa (
		pack.inAlignedBox((-2,-2,-2),(2,2,2))-pack.inCylinder((0,-2,0),(0,2,0),1),
		radius=1.5*rad,gap=2*gap,color=(1,0,1),**kw), # body,
	pack.regularOrtho(pack.inEllipsoid((-1,0,-4),(1,1,2)),radius=rad,gap=0,color=(0,1,1),**kw), # left leg
	pack.regularHexa (pack.inCylinder((+1,1,-2.5),(0,3,-5),1),radius=rad,gap=gap,color=(0,1,1),**kw), # right leg
	pack.regularHexa (pack.inHyperboloid((+2,0,1),(+6,0,0),1,.5),radius=rad,gap=gap,color=(0,0,1),**kw), # right hand
	pack.regularOrtho(pack.inCylinder((-2,0,2),(-5,0,4),1),radius=rad,gap=gap,color=(0,0,1),**kw) # left hand
	]: O.bodies.appendClumped(part)


# Example of geom.facetBox usage 
Beispiel #2
0
from woo import *
from woo.core import *
from woo.dem import *
from minieigen import *
from woo import pack,log
import woo
log.setLevel('PeriIsoCompressor',log.DEBUG)

"""Simple script to create tunnel with random dense packing of spheres.
The tunnel is difference between an axis-aligned box and cylinder, or which
axis is going through the bottom wall (-z) of the box.

The tunnel hole is oriented along +y, the face is in the xz plane.

The first you run this scipt, a few minutes is neede to generate the packing. It is
saved in /tmp/triaxPackCache.sqlite and at next time it will be only loaded (fast).
"""
# set some geometry parameters: domain box size, tunnel radius, radius of particles
boxSize=Vector3(5,8,5)
tunnelRad=2
rSphere=.1
# construct spatial predicate as difference of box and cylinder:
# (see scripts/test/pack-predicates.py for details)
pred=pack.inAlignedBox((-.5*boxSize[0],-.5*boxSize[1],0),(.5*boxSize[0],.5*boxSize[1],boxSize[2])) - pack.inCylinder((-.5*boxSize[0],0,0),(.5*boxSize[0],0,0),tunnelRad)
# Use the predicate to generate sphere packing inside 
pack.randomDensePack(pred,radius=rSphere,rRelFuzz=.3,memoizeDb='/tmp/triaxPackCache.sqlite',spheresInCell=3000).toSimulation(woo.master.scene)

from woo import qt
qt.Controller()
qt.View()
Beispiel #3
0
O.bodies.append(
    pack.regularHexa((pack.inSphere((0, 0, 4), 2) - pack.inSphere(
        (0, -2, 5), 2)) & pack.notInNotch(centerPoint=(0, 0, 4),
                                          edge=(0, 1, 0),
                                          normal=(-1, 1, -1),
                                          aperture=.2),
                     radius=rad,
                     gap=gap,
                     color=(0, 1, 0),
                     material=0)  # head
    + [
        utils.sphere((.8, 1.9, 5), radius=.2, color=(.6, .6, .6), material=0),
        utils.sphere((-.8, 1.9, 5), radius=.2, color=(.6, .6, .6), material=0),
        utils.sphere((0, 2.4, 4), radius=.4, color=(1, 0, 0), material=0)
    ]  # eyes and nose
    + pack.regularHexa(pack.inCylinder((-1, 2.2, 3.3), (1, 2.2, 3.3), 2 * rad),
                       radius=rad,
                       gap=gap / 3,
                       color=(0.929, 0.412, 0.412),
                       material=0)  #mouth
)
groundId = O.bodies.append(
    utils.facet([(12, 0, -6), (
        0,
        12,
        -6,
    ), (-12, -12, -6)], dynamic=False))  # ground

for part in [
        pack.regularHexa(pack.inAlignedBox(
            (-2, -2, -2), (2, 2, 2)) - pack.inCylinder((0, -2, 0),
Beispiel #4
0
log.setLevel('PeriIsoCompressor', log.DEBUG)
"""Simple script to create tunnel with random dense packing of spheres.
The tunnel is difference between an axis-aligned box and cylinder, or which
axis is going through the bottom wall (-z) of the box.

The tunnel hole is oriented along +y, the face is in the xz plane.

The first you run this scipt, a few minutes is neede to generate the packing. It is
saved in /tmp/triaxPackCache.sqlite and at next time it will be only loaded (fast).
"""
# set some geometry parameters: domain box size, tunnel radius, radius of particles
boxSize = Vector3(5, 8, 5)
tunnelRad = 2
rSphere = .1
# construct spatial predicate as difference of box and cylinder:
# (see scripts/test/pack-predicates.py for details)
pred = pack.inAlignedBox(
    (-.5 * boxSize[0], -.5 * boxSize[1], 0),
    (.5 * boxSize[0], .5 * boxSize[1], boxSize[2])) - pack.inCylinder(
        (-.5 * boxSize[0], 0, 0), (.5 * boxSize[0], 0, 0), tunnelRad)
# Use the predicate to generate sphere packing inside
pack.randomDensePack(pred,
                     radius=rSphere,
                     rRelFuzz=.3,
                     memoizeDb='/tmp/triaxPackCache.sqlite',
                     spheresInCell=3000).toSimulation(woo.master.scene)

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