Applying force on Stl imported file

Asked by Luis Barbosa on 2020-02-19

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:
Answered
For:
Yade Edit question
Assignee:
No assignee Edit question
Last query:
2020-02-19
Last reply:
2020-02-19
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))

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'

Robert Caulk (rcaulk) said : #3

O.bodies[b].state.inertia

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

Can you help with this problem?

Provide an answer of your own, or ask Luis Barbosa for more information if necessary.

To post a message you must log in.