home - services - guestblog
 
last update: 06.11.2006 - blender 2.42a
PARAMETRIC OBJECTS IN BLENDER
This is a small article presenting ideas I have had about making parametric objects in Blender. As I am myself an architect, it is mostly oriented towards the use of Blender by architects. Engineers will forgive me if I give a very rough and unprecise description of what is parametric modelling, and for people used to animation mechanics, this will probably be well-known stuff.

INTRODUCTION
If you happen to paste this title in google, your first result will probably say "Blender is not and will never be a parametric modeller".  Actually, the concept of parametric modelling has evolved so much in these last years that not only parametric modelling is already possible in Blender, even in a very rough and not very useful manner, but you would be surprised to see how close we are to really professionally usable objects.

Parametric modelling is a term you hear a lot in the fields of engineering and architecture. It is actually a way to define objects in a 3D world:
In classical 3D environment, like Blender for example, objects are defined by their components: for example, we have a cube which has 8 vertices. Each of these vertices has a (x, y, z) position. This group of vertex is what defines our cube. The only way to edit an object is to edit its components, for example by moving some vertices.
In typical parametric modelling, our cube would br defined for example by its (x, y, z) position, a "width" parameter, a "length" parameter and a "height" parameter. This would allow us to modify easily our cube later. I wrote "for example" because the great cool thing about parametric modelling is of course the ability to create your own object types, and give it the parameters you want. For example I would create a door object, give it "width", "frame thickness", "door type" and "opening angle" parameters, and I would have a kind of door block I could use everywhere in my model, but each one with different values for the parameters.

To resume a bit, in Blender, a parametric object would be an object you can modify without entering editmode.

HOW THEY DO THAT
If you look at recent architecture software that use parametric modelling (again, the engineers will forgive me for not talking about the many other high-end softwares they use...) like Archicad and Revit, they have different approach for letting you create your own parametric objects:
Archicad uses a kind of scripting language, in which you define the parameters and the geometry of your object.
Revit lets you do that all graphically. Basically, you create layout elements, like axis and points, and then you draw a geometry locked onto those layout elements. Finally, you add parameters, also locked to those elements. When you are done, you can change the parameter value, which will move the layout elements accordingly, which in turn will stretch your geometry.
As an interesting third example, new versions of Autocad also try themselves at parametric design (until now only in 2D): You have now "smart" blocks that can contain parameters that can modify the block's geometry , and obviously several instances of the same block can have different value for their parameters.

All of this leads us to think that parametric modelling today is not anymore something that has to be coded right from the very core of the program, but rather something you have to develop by making interaction between objects possible. For example, in the Revit case, interaction between geometry and those layout elements. In the Archicad case, scripts that operate on geometry. Parametric objects are more and more compound objects made of simple elements, assembled graphically rather than hard-coded complicated data structures.

WHAT WE HAVE IN BLENDER
Actually it came to my mind that Blender has two very useful tools that can be used to give graphically parameters to objects: shapekeys and armature. And with python scripting there is also all that is needed to make them communicate.
Shapekeys are a way to store different vertex positions in a mesh. You can therefore create for example a door model, and have a "closed" vertices situation and an "open" one. To open your door, just increase your "open" parameter. This is truly what we expect of parametric objects.
Armatures can be used to create much smarter objects. By linking a mesh to an armature, you can have the same behaviour as the Revit objects. You move the bones, and the object is stretched accordingly.
Python scripting is of course the most powerful feature, but since we are architects and not programmers, we'll try to use as little as possible, and make as much as possible with graphical tools.

EXAMPLES
Below are a couple of examples of what is possible. Please don't consider these files as an architectural objects library, since they will probably be too buggy or unadapted for use in real production work. They are just there if you are curious about how it is made.

1. a sliding window
This is the most basic use we can do of shapekeys. There is no python programming here. Just three shapekeys positions, a "basic", a "frame thickness" and an "opening". The two last ones are parameters that receive a slider in the Action window. There you can play with them, and adjust every window without having to enter editmode. See the .blend file, it's very easy and quick to set up, and doesn't involve any programming.
download zipped .blend file
2. a dimension Dimension
This one is made of three objects: an armature, a black mesh which is the dimension line, and a text that displays the dimension value. The armature consists of two bones, and the black dimension line has its two vertical bars linked to the bones. A scriptlink, activated on redraw, measures the distance between the bones and, if changed, updates the text value. Maybe not very useful right now, but who knows, when exporter scripts to 2d vector formats will work well?
download zipped .blend file
3. a door
This one is a bit trickier, as I wanted to control everything with the shapekey sliders, including the rotation of the door. Shapekeys allow you to move vertices, not rotate. So I placed a bone at the base of the door, linked to the door, and the rotation of this bone is controlled by a slider of my door, using pydrivers. See the .blend file to see how this is made. Here too, thanks the shapekeys, there is very little programming, just two lines for the pydrivers.
download zipped .blend file
4. stairs
Here the particularity is that you cannot use the shapekeys, since they won't let you add faces to the mesh when they are set up. So I created a little marker object, that you move to increase the number of steps. For who knows, it works like Autocad grips. This stairs object is entirely controlled by script, which is a pain for who is not used to programming, but currently necessary to achieve more complex mesh operations.
download zipped .blend file
5. a curtain wall
You want to make curved glasswalls, like Frank Gehry? Here it is! Here there is nothing new actually, it's a simple curtain wall element that can be deformed in a couple of ways. The detail is that everything is controlled from the shapekeys sliders. Here again, a compound object (mesh + armature), and just a couple of python expressions to fill the pydrivers. No programming, no inverse kinematics. Currently, modifiers still cannot be controlled that way, but this will surely happen soon. 
download zipped .blend file
THE FUTURE
Several new features are programmed for future releases of Blender, that will help us much to simplify the creation and control of such objects...
  • Better group selection: If we make compound objects, with an armature and a mesh,  you need to be able to select and manipulate that group of objects like any other single object. Blender's object groups just lack a bit of refining, like for example the way to select them. This kind of things is already on the request lists. Since groups are a relatively new feature of Blender, probably the concept will be refined progressively in a near future, so I don't think we need to worry about that.
  • Custom properties for objects. This is already a well comented subject in forums. This is really what would allow us to imagine all kind of parameters and behaviour to our new objects.  This is already partially implemented in the objects structure, it's nearly here...
  • Custom panels: For displaying and manipulating our parameters, we would need custom panels, probably in Object Properties Panel (the F9 window). This is also considered in the same discussions as custom properties, so it's on its way too. Since Blender VIP's are currently talking about it, I'm pretty confident that this will happen soon.
  • Object snapping or an automatic way to detect objects or points by proximity. This is already more or less possible by scripting, and several scripts have their try at addressing the problem. The subject is also well commented on forums. This would allow us to make objects that interact with others like for example, a window that automatically opens a hole in a wall when it is placed on it. This is really the part one could create himself, and there is no doubt that it could be solved without any change in Blender code. But, since many people talk and ask for it, maybe someday it will become much easier...
So I think almost everything is there for Blender to enter the circle of professional architecture development tools. Imagine, "Intelligent objects" libraries in Blender, that will for sure smell delicious for many of us architects (we are a bit addicted to objects libraries). I remind you too that everything is already there to make such libraries and even put its components in the "add" menu...

I'll try to start a repository one of these days.

I hope this was interesting. As always, don't hesitate to mail me if I can clarify something.

Yorik - yorik.orgfree.com