yade-users team mailing list archive
-
yade-users team
-
Mailing list archive
-
Message #13661
Re: [Question #403663]: Modeling 2 materilas by CPM model
Question #403663 on Yade changed:
https://answers.launchpad.net/yade/+question/403663
Status: Solved => Open
Seti is still having a problem:
Hi Jan,
Just a quick question, I am wondering to combine more materials in CPM model ( say 5 items), would you please advise me how I can specify the percentage of each material?
My idea is as per below:
##############
from yade import pack
import random
mat1 = CpmMat() # ...
mat2 = CpmMat() # ...
mat3 = CpmMat() # ...
mat4 = CpmMat() # ...
mat5 = CpmMat() # ...
sp = pack.randomDensePack(pack.inAlignedBox((0,0,0),(1,1,1)),
radius=.05,spheresInCell=500,returnSpherePack=True)
sp.toSimulation()
for b in O.bodies:
if random.random() < 0.2:
b.mat = mat1
b.shape.color = (1,0,0)
elif random.random() < 0.1:
b.mat = mat2
b.shape.color = (0,1,0)
elif random.random() < 0.3:
b.mat = mat3
b.shape.color = (0,0,1)
elif random.random() < 0.2:
b.mat = mat4
b.shape.color = (1,1,0)
else:
b.mat = mat5
b.shape.color = (0,1,1)
Cheers,
Seti
--
You received this question notification because your team yade-users is
an answer contact for Yade.