You're blocking ads, which pay for BlenderNation. Read about other ways to support us.

Video: Molecular Signaling Pathway of Interleukin 1

10

Another biochemical project, this time by Marcin Klapczynski (check out Ricardo Raimundo's work as well, in case you missed it). Marcin animated over 5,000 objects using a simple Python script, which he shares below.

Marcin writes:

I made a short animation of molecular signaling pathway of Interleukin 1, which is important part of our immune system response:

There are over 5 thousands objects in the scene, and majority of them, like phospholipids in the cell membrane or tiny molecules like ATP and aminoacids, are animated using Python scripting. It wouldn't be possible to animate them manually giving them random, more realistic pattern.

Here's the Python script, some of you may find it useful. The script works on selected objects only, so the workflow is:

  • select objects to animate
  • insert keyframe (location rotation)
  • move timeline to desired frame
  • run script
  • insert keyframe (location rotation)
  • repeat

The below script will select random value from -5 to 5 Blender units for location and from -15 to 15 euler for rotation. These values can be changed to achieve desired effect. Some lines can be commented out or removed if changes are desired only in particular axes.

Here's the script:

selected_objects = bpy.context.selected_objects
for object in selected_objects:
x_value = random.uniform(-5.00,5.00)
y_value = random.uniform(-5.00,5.00)
z_value = random.uniform(-5.00,5.00)
x_value_rot = random.uniform(-15,15)
y_value_rot = random.uniform(-15,15)
z_value_rot = random.uniform(-15,15)
object.location.x += x_value
object.location.y += y_value
object.location.z += z_value
object.rotation_euler.x += x_value_rot
object.rotation_euler.y += y_value_rot
object.rotation_euler.z += z_value_rot

Enjoy!

10 Comments

  1. I rather enjoyed that, thank you!
    I don't normally follow the scientific posts, but I'm glad I did.
    There was a definite sense of drama as the process picked up pace. I particularly liked the purposeful snap of movement in the later stages of the cascade!

  2. Kirill Trideshny on

    This can be interesting for my sister :) She has a degree in chemistry. Is it looks like that in a powerful microscope?

    • Marcin Klapczynski on

      No, it's pure imagination. Scanning electron microscope can pick up large molecules, but not to this level. Also, the actual cascade timing is matter of microseconds. The inside of a living cell is much more complex and crowded - this is only one out of thousands of molecular cascades.

  3. Lawrence D’Oliveiro on

    Much as I am a Python fan, and still consider it as my language of first choice whenever I think of a new programming project, this is yet another example of why its reliance on whitespace for block structuring was such an unfortunate design decision.

    Where exactly is that for-loop supposed to end? Your guess is as good as mine.

    • Marcin Klapczynski on

      Agreed. Why not curly braces like elsewhere? It got changes after I pasted the code in the post.

      All lines below the line where the loop starts are in the loop. All the spatial operations are executed for each active object.

      • Lawrence D’Oliveiro on

        Try this:

        from __future__ import braces

        to see GvR’s answer to requests for adding braces to Python.

Leave A Reply

To add a profile picture to your message, register your email address with Gravatar.com. To protect your email address, create an account on BlenderNation and log in when posting a message.