← Back to team overview

yade-dev team mailing list archive

Re: Python scripts and clump creation

 

Hi,

I will post the solution tomorrow. Clumps are not yet wrapped in python, but it is fairly easy thing to do: function taking list of bodies and appending those as clump to the body container.

For the obscurity of syntax, there are 2 points.

1. Creating instance of a class. It used to be obsucre like StandAloneEngine("PersistentSAPCollider",{'haveDistantTransient':True}). I introduced new syntax for it (like a month ago), which is much more pythonic: PersistentSAPCollider(haveDistantTransient=True). Have a look at scripts/simple-scene.py, I think it is more readable now.

2. Accessing attributes. You have to use object['attribute'] notation to get real (serializable) attributes. It would be best to use object.attribute instead, but I am still investigating how to do it, as there are non-c++ attributes that are accessed in this way (like methods or object.name and so on).

Regards, Vaclav

I would like to use clumps in Yade. I started with python which is very interesting despite a somewhat obscure syntax (for beginners who are accustomed to C++). I have found the clump 'extra-package' and read the comments in the file clump.hpp Now, I would like to know how to access the method 'createOneClump' (for example) from a python script.
Does anyone (Vaclav ?) can help me?




Follow ups

References