September 25, 2013




Generator is a plugin for the Cinema4D R12 Python API that uses iteration to create geometric objects. The idea is loosely based on an application called Structure Synth, as well as the scripting language which is based on Eisenscript.

The syntax will take a bit to get used to – it’s not the most advanced parser in the world. It will however give you quite some freedom to create interesting, iterative structures.


The rules

Rules are at the core of Generator. They govern what happens at each generation, how often, where and when an object is placed etc. It even caters of recursive function calls.

It is probably easiest to start with a sample rule:

*rule r1 { x 50 y 10 z 5 ry CURRENT_ITERATION*2.5 s 0.96 } box

*rule r1 { z random.randint(0,50) } custom1

rule r2 { x 250 sx 1.1 r1 10 } box


Easy! 😉


Okay, let’s have a look at the first rule. Notice how everything is seperated by a blank (space) character. This is the separator we use and you need to make sure to not to add it everywhere, even before and after brackets.


rule r2

Every rule begins with the term “rule”.  It is followed by the name for the rule, which is its identifier. It does not have to be unique! More about that later though.


*rule r1

Same as before, but if the rule is defined using “*rule”, it is not executed each iteration, but instead it is just used as a rule definition to be called by another rule.


{ … } box

All rule parameters are surrounded by curly braces. Immediately after the closing brace, it expects to see what kind of object to draw. Possible objects are: box, sphere, pyramid, particle and custom1-custom4. The custom1-4 objects are the ones that can be dragged into the link fields on top of the plugin.


x 50 y 10 z 5

Translation values. x y and z are possible. All values are floating point.



Rotation values. rx ry and rz are possible. All values are floating point.

CURRENT_ITERATION is a special variable that is basically a counter that goes up by one each iteration.

Notice how you can use it with arithmetics etc., all values are evaluated as python commands! So you can also use python’s math and random functions for example.


s 0.96

Scale values. s scales the object uniformly. sx sy sz scale only in that dimension.


In rule r2: “r1 10”

This is a function call. Rule r2 will call rule r1 ten times. Then the next iteration starts, and rule r1 will be called another ten times from rule r2.


Notice how rule r1 is defined twice. This is no accident, it’s a feature to bring some variation into each iterations. If several rules are defined using the same name, they are grouped together into a rule group. When rule r1 is called now, instead of calling a specific rule, the plugin will randomly select one rule from the rule group. (Note that if you are to use a specific seed for your randomisation, this will always happen in the same order)