← Back to team overview

yade-users team mailing list archive

Re: [Question #692568]: Changing joint frictional properties for specific bodies later

 

Question #692568 on Yade changed:
https://answers.launchpad.net/yade/+question/692568

    Status: Open => Answered

Jan Stránský proposed the following answer:
Hello,

bodies has their material attribute, accessible as
b.material
or
b.mat
You can change it easily:
b.mat.jointFrictionAngle = whatever

b.mat is a reference to already instantiated material, so you can achieve the same by e.g.
O.materials[0].jointFrictionAngle = whatever
or
###
mat = JCFpmMat(...)
...
mat.jointFrictionAngle = whatever
###
(depending on how you use materials in the script)

However (!!!):
- note1: b.mat is a reference to existing Material instance, possibly (most likely) shared among other particles. If you modify it from one particle, it will affect all other particles sharing this material
- note2: it will have no effect on existing interactions

solution of note1 (if undesired): assign new material to the bodies (it will leave the existing material untouched for the rest of particles)
###
newMat = JCFpmMat(...)
for b in bodiesToBeUpdated:
   b.material = newMat
###

solution of note2 (if undesired): loop over O.interactions and modify i.phys accordingly
###
for i in O.interactions:
   if i.id1 in idsToBeUpdated or i.id2 in idsToBeUpdated:
      i.phys.someAttribute = someValue
###

cheers
Jan

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