← Back to team overview

yade-users team mailing list archive

[Question #668727]: How to give each clump a new material and a new color?

 

New question #668727 on Yade:
https://answers.launchpad.net/yade/+question/668727

Hi,

I have different clumps like:

###script

sp=pack.SpherePack()

c1=pack.SpherePack([((0,0,0),.08/1000)])
c2=pack.SpherePack([((0,0,0),.2/1000)])
c3=pack.SpherePack([((0,0,0),.3/1000),((0.4/1000,0,0),.3/1000)])
c4=pack.SpherePack([((0,0,0),.6/1000),((-0.8/1000,0,0),.3/1000),((0.8/1000,0,0),.3/1000)])
c5=pack.SpherePack([((0,0,0),0.001),((0.0015,0,0),0.001),((0.0015/2,0.0015,0),0.001)])
#c6=pack.SpherePack([((0,0,0),0.0024),((0.003,0,0),0.0024),((0,0.003,0),0.0024),((0.003,0.003,0),0.0024)])
sp=pack.SpherePack()
print 'Generated # of clumps:',sp.makeClumpCloud((0,0,0),(0.06,0.02,0.06),[c1,c2,c3,c4,c5],num=num_particles,periodic=False,seed=1)
sp.toSimulation(material='sphereMat',color=(255,153,0))

######################

Here, instead of giving one material and one color to all clump particles, How can I give different color and different material to each clump? foe eg: I want to give something like

for clump c1: material =x, color=(255,1,1)
for clump c2: material =Y, color=(255, 0,0) and so on.
I need to do this for at least two different clump type.

I am new to python code so, I want to know what is the script for it.

Any reference and script is much appreciated.

Kind regards,
Kalyan Khanal


-- 
You received this question notification because your team yade-users is
an answer contact for Yade.