Read Geometry Data

You can query Geometry information in a similar way to querying particles.

To read Geometry data:
Use the following command:
# This time we query a specific timestep index
timestep_index = 6
# Geometry can also be referred to either by name or by its index
geom_name = "Geometry Box 1"
geom = deck.timestep[timestep_index][geom_name]
Geometries are described by the following two lists:
  • Lists the coordinates of each vertex.
  • Lists the groups of vertices (expressed as indices) that form each triangle.
Example

The following example creates an interactive 3D plot all of the Geometries in a given Time Step using Matplotlib:

import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from edempy import Deck    
with Deck('RockBox_Example.dem') as deck:
     timestep = deck.timestep[3]
     geometries = timestep.geometry
     ax = plt.axes(projection='3d')
     for i in range(timestep.numGeoms):
         coords = geometries[i].getCoords()
         tri = geometries[i].getTriangleNodes()
         ax.plot_trisurf(
             coords[:,0], # x-coordinates
             coords[:,1], # y-coordinates
             coords[:,2], # z-coordinates
             triangles=tri,
             alpha=0.2,
             color='lightgrey'
     )
plt.show()

Geometry sections also provide access to other information, such as forces, torques and transformations. For more information about Geometry sections, see the EDEMpy API Reference Help included in the EDEM installation folder.