yade.ymport module

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

yade.ymport.blockMeshDict(path, patchasWall=True, emptyasWall=True, **kw)[source]

Load openfoam’s blockMeshDict file’s “boundary” section as facets.

Parameters:
  • path (str) – file name. Typical value is: “system/blockMeshDict”.
  • patchasWall (bool) – load “patch”-es as walls.
  • emptyasWall (bool) – load “empty”-es as walls.
  • **kw – (unused keyword arguments) is passed to utils.facet
Returns:

list of facets.

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.polyMesh(path, patchasWall=True, emptyasWall=True, **kw)[source]

Load openfoam’s polyMesh directory as facets.

Parameters:
  • path (str) – directory path. Typical value is: “constant/polyMesh”.
  • patchAsWall (bool) – load “patch”-es as walls.
  • emptyAsWall (bool) – load “empty”-es as walls.
  • **kw – (unused keyword arguments) is passed to utils.facet
Returns:

list of facets.

yade.ymport.stl(file, dynamic=None, fixed=True, wire=True, color=None, highlight=False, noBound=False, material=-1, scale=1.0, shift=Vector3(0, 0, 0))[source]

Import a .stl geometry in the form of a set of Facet-shaped bodies.

Parameters:
  • file (string) – the .stl file serving as geometry input
  • dynamic (bool) – controls Body.dynamic
  • fixed (bool) – controls Body.dynamic (with fixed = True imposing Body.dynamic = False) if dynamic attribute is not given
  • wire (bool) – rendering option, passed to Facet.wire
  • color – rendering option, passed to Facet.color
  • highlight (bool) – rendering option, passed to Facet.highlight
  • noBound (bool) – sets Body.bounded to False if True, preventing collision detection (and vice-versa)
  • material – defines material properties, see Defining materials for usage
  • scale (float) – scaling factor to e.g. dilate the geometry if > 1
  • shift (Vector3) – for translating the geometry
Returns:

a corresponding list of Facet-shaped bodies

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 in a format selected by the format argument, insert them to the simulation.

Parameters:
  • filename (str) – file name
  • format (str) – selected input 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 a format selected by the format argument, returns a list of corresponding bodies; that may be inserted to the simulation with O.bodies.append().

Parameters:
  • filename (str) – file name
  • format (str) – selected input 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 reference’ style)
  • **kw – (unused keyword arguments) is passed to utils.sphere
Returns:

list of spheres.

Lines starting with # are skipped

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

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

Parameters:
  • filename (str) – file name
  • format (str) – selected input format. Supported 'x1_y1_z1_x2_y2_z2_x3_y3_z3'``(default), ``'x1_y1_z1_x2_y2_z2_x3_y3_z3_matId', 'id_x1_y1_z1_x2_y2_z2_x3_y3_z3_matId' or 'x1_y1_z1_x2_y2_z2_x3_y3_z3_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 (‘passed by reference’ style)
  • **kw – (unused keyword arguments) is passed to utils.facet
Returns:

list of facets.

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]

Load polyhedra from a text file.

Parameters:
  • filename (str) – file name. Expected file format is the one output by export.textPolyhedra.
  • shift ([float,float,float]) – [X,Y,Z] parameter moves the specimen.
  • scale (float) – factor scales the given data.
  • orientation (quaternion) – orientation of the imported polyhedra
  • **kw – (unused keyword arguments) is passed to polyhedra_utils.polyhedra
Returns:

list of polyhedras.

Lines starting with # are skipped

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.