Applying force on Stl imported file

Asked by Luis Barbosa

Dear all,

I would like to have the inertial behaviour of an imported stl surface as a solid body.

For this I am using:

roddd = O.bodies.append(ymport.stl(mesh+'.stl',wire=True,material='wall'))

roddd = O.bodies[a]
O.forces.setPermF(roddd.id,(0,-300,0))
roddd.dynamic = True
roddd.state.mass = 200
roddd.state.inertia =(1,1,1)
roddd.state.blockedDOFs = 'Z'

But the problem is in "roddd = O.bodies[a]" because it does not accept a list of id's. In this way I have to set only one value to "a". Which makes such body to be independent from the stl body.

Do you have any suggestions?

Question information

Language:
English Edit question
Status:
Solved
For:
Yade Edit question
Assignee:
No assignee Edit question
Solved by:
Robert Caulk
Solved:
Last query:
Last reply:
Revision history for this message
Robert Caulk (rcaulk) said :
#1

>> roddd = O.bodies.append(ymport.stl(mesh+'.stl',wire=True,material='wall'))

This command sets roddd as a list of ids comprising the facet. So iterate on that list:

for b in roddd:
    b.state.inertia=(1,1,1)
    b.state.blockedDOFs='Z'
    O.forces.setPermF(b.id,(0,-300,0))

Revision history for this message
Luis Barbosa (luis-pires-b) said :
#2

Thank you Robert,

I have tried it but I got the error:

Traceback (most recent call last):
  File "/usr/bin/yade", line 182, in runScript
    execfile(script,globals())
  File "atrito.py", line 46, in <module>
    b.state.inertia=(1,1,1)
AttributeError: 'int' object has no attribute 'state'

Revision history for this message
Best Robert Caulk (rcaulk) said :
#3

O.bodies[b].state.inertia

Revision history for this message
Jan Stránský (honzik) said :
#4

Or with more intuitive variable namings:
###
for id in roddd:
   b = O.bodies[id]
   b.state.whatever ...
   ...
###

cheers
Jan

Revision history for this message
Luis Barbosa (luis-pires-b) said :
#5

Thanks Robert Caulk, that solved my question.