# yade-users team mailing list archive

## Re: [Question #670255]: Modelling a Homogenous slope with properties of rock

```Question #670255 on Yade changed:

Luc Scholtès proposed the following answer:
Alright,

>From what I understand, your problem is related to the generation of a
packing of particles using the pack.inGtsSurface().

I am sorry but I don't understand this:

"But it's doesn't help me because he was adding in left out space which
doesn't consist facets."

I am a bit clueless but I'll give you an example script below that works
for a simple mesh (a cube) and I would suggest that you try to make the
script work (you will have to create the cube.gts on your own) before
going into a more complex configuration. At first, I would suggest that
you try to generate a "regular packing" in your previously generated
cube (using the regularHexa() function) and then, when you are sure that
it works, you can experiment with the random packing functions.

###

from yade import pack, export, ymport
import gts, os.path, locale

#### control parameters
mesh='cube' #name of gts mesh
sizeRatio=10. # defines discretisation (sizeRatio=meshLength/particleDiameter)

#### import mesh
locale.setlocale(locale.LC_ALL,'en_US.UTF-8')   #gts is locale-dependend.  If, for example, german locale is used, gts.read()-function does not import floats normally

print 'closed? ', surface.is_closed()

#### generate packing
if surface.is_closed():
pred=pack.inGtsSurface(surface)
# get characteristic dimensions
aabb=pred.aabb()
dim=pred.dim()
center=pred.center()
minDim=min(dim[0],dim[1],dim[2])
# define discretisation
print center, dim, ' | minDim=', minDim, ' | diameter=', 2*radius
### packing functions
# non periodic packing
# periodic packing
### if you want to translate the surface away from the packing
#surface.translate(dim[0],0,0)

#### import mesh
O.bodies.append(pack.gtsSurface2Facets(surface,color=(0.8,0.8,0.8),wire=True))

#### export packing in a text file
export.text(mesh+'_'+str(int(sizeRatio))+'.spheres')

#### open the GUI to see the packing and the mesh

--