Filling GTS geometry of multiple separate mesh bodies with clumps
I have a GTS file with several closed polyhedra in it (representing aggregates of asphalt), looking at the example posted at the yade-dem website for gts-stl conversion and filling it with a clump:
https://www.youtube.com/watch?v=MvxHr7mCR0A
I did the same with my script and it indeed filled all the polyhedra in the geometry with clumps, the question is, is it a "single" clump, or those are separate clumps (as i intended to make), and if it is indeed a single clump, is there a way to separate those or better way to fill a geometry of many separated bodies in one file?
Thanks.
The script:
```python
from yade import pack, geom, qt
import gts, os.path, locale
from yade import O, Material, FrictMat, utils
from numpy import linspace
import subprocess
bash_script = 'convert2stl.sh'
# Run the bash script
result = subprocess.run(['bash', bash_script], capture_output=True, text=True)
# Check if the script ran successfully
if result.returncode == 0:
print("Script executed successfully")
print("Output:", result.stdout)
else:
print("Error:", result.stderr)
# Function to set the color of all spheres
def setColorForAllSpheres(color):
for b in O.bodies:
if isinstance(b.shape, geom.Sphere):
b.shape.color = color
surf = gts.read(open('polyhedra.gts'))
p = pack.inGtsSurface(surf)
material = FrictMat(density=2600, young=1E6, poisson=0.3, frictionAngle=0.1, label='clumpMaterial')
if surf.is_closed():
pred = pack.inGtsSurface(surf)
aabb = pred.aabb()
aabb = pred.aabb()
dim0 = aabb[1][0] - aabb[0][0]
radius = dim0 / 600. # get some characteristic dimension, use it for radius
clump_bodies = pack.regularHexa(pred, radius=radius/0.8, gap=0, material=material)
O.bodies.appendClumped(clump_bodies) ```