Clumping can't give color to each layer
I try to change color for each sphere layer, but it doesn't seems to work. I want to give layer that is divisible by 2 to be brown and layer that isn't divisible by two as white.
-------
# Check if the sphere is within the clump limit
if abs(xi) <= clumpLimit and abs(yi) <= clumpLimit and math.sqrt(xi**2 + yi**2) <= diameter/2:
# Move spheres in layers 2, 4, 6, and 8 in x and y axes by 2mm
if layer % 2:
# Assign material properties to the sphere
# Assign color
-------
#### My Code ###
import random
import math
from yade import geom, pack, utils, plot, ymport, export
import numpy as np
# Define cylinder with funnel parameters
center = (0, 0, 0)
diameter = 0.102
height = 0.18
# create cylindrical body with radius 0.102 m and height 0.064 m
cylinder = geom.facetCylin
# add cylinder to simulation
O.bodies.
# plate properties
clump_plate = CohFrictMat(density = 7500, label = 'clump_plate')
# add properties
O.materials.
# clumping parameters
bodyList = []
zi = 0.1
radius_clump = 0.00221
clumpLimit = (diameter/2) - 0.005
# layer and offset condition
num_layers = 8
z_offset_increment = 0.00128
for layer in range(num_layers):
z_offset = layer * z_offset_increment # Adjust the z-coordinate based on the layer
for xi in range(-50, 51, 4):
xi = xi / 1000
for yi in range(-50, 51, 4):
yi = yi / 1000
# Check if the sphere is within the clump limit
if abs(xi) <= clumpLimit and abs(yi) <= clumpLimit and math.sqrt(xi**2 + yi**2) <= diameter/2:
# Move spheres in layers 2, 4, 6, and 8 in x and y axes by 2mm
if layer % 2:
# Assign material properties to the sphere
Question information
- Language:
- English Edit question
- Status:
- Solved
- For:
- Yade Edit question
- Assignee:
- No assignee Edit question
- Solved by:
- Huan
- Solved:
- Last query:
- Last reply: