Hello,
please find below a short python code snippet that :
- read a series of gdd files
- extract forces and position for each discrete elements
import pygranoo as gr
import glob
dom = gr.domain.get()
files = glob.glob('*.gdd') # read all gdd files in the current dir
for f in files:
print('reading {}...'.format(f))
dom.clear()
dom.load(f)
print('')
el_set = gr.element_set.get('Global')
for i, el in enumerate(el_set):
force = el.force
pos = el.pos
print('Parsing the {}th element...'.format(i))
print(' - pos = ({},{},{}) m'.format(pos.x , pos.y , pos.z ))
print(' - force = ({},{},{}) N'.format(force.x, force.y, force.z))
Hope this help, good luck, Damien.