yade.ymport module

Import geometry from various formats (‘import’ is python keyword, hence the name ‘ymport’).

yade.ymport.ele(nodeFileName, eleFileName, shift=(0, 0, 0), scale=1.0, **kw)[source]

Import tetrahedral mesh from .ele file, return list of created tetrahedrons.

Parameters:
  • nodeFileName (string) – name of .node file
  • eleFileName (string) – name of .ele file
  • shift ((float,float,float)|Vector3) – (X,Y,Z) parameter moves the specimen.
  • scale (float) – factor scales the given data.
  • **kw – (unused keyword arguments) is passed to utils.polyhedron
yade.ymport.gengeo(mntable, shift=Vector3(0, 0, 0), scale=1.0, **kw)[source]

Imports geometry from LSMGenGeo library and creates spheres. Since 2012 the package is available in Debian/Ubuntu and known as python-demgengeo http://packages.qa.debian.org/p/python-demgengeo.html

Parameters:
mntable: mntable

object, which creates by LSMGenGeo library, see example

shift: [float,float,float]

[X,Y,Z] parameter moves the specimen.

scale: float

factor scales the given data.

**kw: (unused keyword arguments)

is passed to utils.sphere

LSMGenGeo library allows one to create pack of spheres with given [Rmin:Rmax] with null stress inside the specimen. Can be useful for Mining Rock simulation.

Example: examples/packs/packs.py, usage of LSMGenGeo library in examples/test/genCylLSM.py.

yade.ymport.gengeoFile(fileName='file.geo', shift=Vector3(0, 0, 0), scale=1.0, orientation=Quaternion((1, 0, 0), 0), **kw)[source]

Imports geometry from LSMGenGeo .geo file and creates spheres. Since 2012 the package is available in Debian/Ubuntu and known as python-demgengeo http://packages.qa.debian.org/p/python-demgengeo.html

Parameters:
filename: string

file which has 4 colums [x, y, z, radius].

shift: Vector3

Vector3(X,Y,Z) parameter moves the specimen.

scale: float

factor scales the given data.

orientation: quaternion

orientation of the imported geometry

**kw: (unused keyword arguments)

is passed to utils.sphere

Returns:

list of spheres.

LSMGenGeo library allows one to create pack of spheres with given [Rmin:Rmax] with null stress inside the specimen. Can be useful for Mining Rock simulation.

Example: examples/packs/packs.py, usage of LSMGenGeo library in examples/test/genCylLSM.py.

yade.ymport.gmsh(meshfile='file.mesh', shift=Vector3(0, 0, 0), scale=1.0, orientation=Quaternion((1, 0, 0), 0), **kw)[source]

Imports geometry from .mesh file and creates facets.

Parameters:
shift: [float,float,float]

[X,Y,Z] parameter moves the specimen.

scale: float

factor scales the given data.

orientation: quaternion

orientation of the imported mesh

**kw: (unused keyword arguments)

is passed to utils.facet

Returns:

list of facets forming the specimen.

mesh files can easily be created with GMSH. Example added to examples/packs/packs.py

Additional examples of mesh-files can be downloaded from http://www-roc.inria.fr/gamma/download/download.php

yade.ymport.gts(meshfile, shift=Vector3(0, 0, 0), scale=1.0, **kw)[source]

Read given meshfile in gts format.

Parameters:
meshfile: string

name of the input file.

shift: [float,float,float]

[X,Y,Z] parameter moves the specimen.

scale: float

factor scales the given data.

**kw: (unused keyword arguments)

is passed to utils.facet

Returns:

list of facets.

yade.ymport.iges(fileName, shift=(0, 0, 0), scale=1.0, returnConnectivityTable=False, **kw)[source]

Import triangular mesh from .igs file, return list of created facets.

Parameters:
  • fileName (string) – name of iges file
  • shift ((float,float,float)|Vector3) – (X,Y,Z) parameter moves the specimen.
  • scale (float) – factor scales the given data.
  • **kw – (unused keyword arguments) is passed to utils.facet
  • returnConnectivityTable (bool) – if True, apart from facets returns also nodes (list of (x,y,z) nodes coordinates) and elements (list of (id1,id2,id3) element nodes ids). If False (default), returns only facets
yade.ymport.stl(file, dynamic=None, fixed=True, wire=True, color=None, highlight=False, noBound=False, material=-1)[source]

Import geometry from stl file, return list of created facets.

yade.ymport.text(fileName, shift=Vector3(0, 0, 0), scale=1.0, **kw)[source]

Load sphere coordinates from file, returns a list of corresponding bodies; that may be inserted to the simulation with O.bodies.append().

Parameters:
  • filename (string) – file which has 4 colums [x, y, z, radius].
  • shift ([float,float,float]) – [X,Y,Z] parameter moves the specimen.
  • scale (float) – factor scales the given data.
  • **kw – (unused keyword arguments) is passed to utils.sphere
Returns:

list of spheres.

Lines starting with # are skipped

yade.ymport.textClumps(fileName, shift=Vector3(0, 0, 0), discretization=0, orientation=Quaternion((1, 0, 0), 0), scale=1.0, **kw)[source]

Load clumps-members from file, insert them to the simulation.

Parameters:
  • filename (str) – file name
  • format (str) – the name of output format. Supported x_y_z_r`(default), `x_y_z_r_clumpId
  • shift ([float,float,float]) – [X,Y,Z] parameter moves the specimen.
  • scale (float) – factor scales the given data.
  • **kw – (unused keyword arguments) is passed to utils.sphere
Returns:

list of spheres.

Lines starting with # are skipped

yade.ymport.textExt(fileName, format='x_y_z_r', shift=Vector3(0, 0, 0), scale=1.0, attrs=[], **kw)[source]

Load sphere coordinates from file in specific format, returns a list of corresponding bodies; that may be inserted to the simulation with O.bodies.append().

Parameters:
  • filename (str) – file name
  • format (str) – the name of output format. Supported x_y_z_r`(default), `x_y_z_r_matId, ‘x_y_z_r_attrs’
  • shift ([float,float,float]) – [X,Y,Z] parameter moves the specimen.
  • scale (float) – factor scales the given data.
  • attrs (list) – attrs read from file if export.textExt(format=’x_y_z_r_attrs’) were used (‘passed by refernece’ style)
  • **kw – (unused keyword arguments) is passed to utils.sphere
Returns:

list of spheres.

Lines starting with # are skipped

yade.ymport.textPolyhedra(fileName, material, shift=Vector3(0, 0, 0), scale=1.0, orientation=Quaternion((1, 0, 0), 0), **kw)[source]
yade.ymport.unv(fileName, shift=(0, 0, 0), scale=1.0, returnConnectivityTable=False, **kw)[source]

Import geometry from unv file, return list of created facets.

param string fileName:
 name of unv file
param (float,float,float)|Vector3 shift:
 (X,Y,Z) parameter moves the specimen.
param float scale:
 factor scales the given data.
param **kw:(unused keyword arguments) is passed to utils.facet
param bool returnConnectivityTable:
 if True, apart from facets returns also nodes (list of (x,y,z) nodes coordinates) and elements (list of (id1,id2,id3) element nodes ids). If False (default), returns only facets

unv files are mainly used for FEM analyses (are used by OOFEM and Abaqus), but triangular elements can be imported as facets. These files cen be created e.g. with open-source free software Salome.

Example: examples/test/unv-read/unvRead.py.