Real world, practical use cases of Python for architectural design for beginners

Hello everyone,
what do you use python for in your daily workflows? I am looking for examples to give to my students at the TU Darmstadt.

I am teaching a course on the basics of computational design that aims to cover the core concepts behind this broad field such as combinatorial design, generative design and computational analysis. Here is the intro video to the course (What is Computational Design? And 9 Concepts Related to It - YouTube).

The upcoming tutorial is about python scripting.

I plan to give a basic intro to the language but also want to illustrate the tutorial with a simple use case. I would like to avoid the most popular agents simulation example (flocking) as in my experience it had little practical relevance.

I have two questions to the community here:

  1. What do you use python in for?
  2. what would be for you the core python example for a complete beginner that is still linked to the design practice and not too computer-sciency :slight_smile:

My idea is to point my students to this very post so I hope for an interesting discussion and a diverse set of example use cases.

1 Like

My use for Python (directly in Rhino, not GH) is not as a design/generative tool, but rather as a way to streamline repetitive and complex/time consuming tasks and use them via aliases/toolbar buttons to work practically like Rhino native tools.

Cases in point might be scripts for interactive correction of contour curves for topo maps, trimming massive amounts of curves inside or outside of a closed boundary, projecting simple but copious numbers of building volumes to seat themselves on/in a terrain mesh/surface map, etc.

5 Likes

Hi @antonsavov,

I use Python mostly do automate repetitive tasks, for which Rhino does not supply a good native answer.
Examples for this would be:

  • Mass file import / export
  • Mass text / annotation manipulation
  • Mass distribution of blocks / assets for realistic-ish landscapes
  • Mass layer manipulation for layouts

Design-wise Python really shines were it exceeds the capabilities of Grasshopper.
Any design that depends on recursion, or a graph-like structure, needs a programming language to back it.
An example for a design where I heavily used python would be those ‘Rhythmogramme’, which are based on simulating multiple pendulums:


Another example would be the manipulation of meshes, which are by-nature graph-like, to get interesting patterns, from for example a basic square tiling:


When I started to learn python I really enjoyed doing fractals as they are nice to look at and by their recursive nature can’t be implemented in plain Grasshopper. As it’s still winter time and snowy right now, maybe start them off with some Koch snowflakes :wink:

4 Likes

I most frequently use custom GHPython scripts for generating and optimizing stairs and windows/facades, and for coming up with very basic, random (ground)plan layouts (if I feel uninspired), but that I heavily rework manually later.
I also have a script which turns a simple line network into thickened outer and inner walls with customizable thicknesses, windows, doors, and floorplates, and diverse tagging and annotation tools.
I also use Python to do simulations (rainwater drainage, sun/shadow, etc).

Privately, I use GHPython for fun computational design projects. :slight_smile:
Here are same examples:

transformations

Mesh Me, Baby!

Mesh Me, Baby!.2021-01-24 09_15_13

Beyond Rhino and Grasshopper, I use CPython to automate some general stuff on my computer and server. I dabble in Blender Python and have some hardware projects, where I use Mirco or CircuitPython to control or manage sensors, motors, servos, buttons, etc., when I’m too lazy to use Arduino (C++).

4 Likes

Contrary to your experience, I think that agent-based simulations have lots of applications, especially in architecture (crowd and traffic simulations, water drainage simulations, discreet design, etc.), and are one of the best things to start with - after you get the Python basics down.

First of all, you can explore object-oriented programming and more modular code structures with different classes (mover/agent, particle system, etc.) and start very small and simple.

Second, particle systems can be quite easily extended or outfitted with other algorithms or principles to make them really fun and/or useful, beyond the Boyd-ish agent behaviors.

Also, they are usually animated which is kinda great for demonstrations, and seeing how things evolve over time.
They don’t have to look like the typical moving dot, arrow, or trail either. I’d think of it in a more abstract way. Each particle can represent no matter what geometry or data. The possibilities are literally endless!

1 Like

I second @Helvetosaur and @lando.schumpich posts. This is what I have also used it most for. I had a similar activity teaching Python to architectural students, but my experience is that most of the students having a really hard time getting into this topic at all. So keeping it really simple, always fully and slowly explaining, is very important. Only a few will actually apply this knowledge at a later point. Usually selecting, modifying and creating geometry will totally enough for a beginner. I would also explain basic FileIO, string formatting and simple recursion, since this will be beneficial knowledge at a later point, plus some very basic math. Usually the small helper scripts are the most important ones. I wouldn’t even teach OOP at this point. But of course it depends on the hours such a course has… Oh and reading and dealing with errors is important. Debugging in general!

2 Likes

So I did a 3 day python in rhino and grasshopper course in the UK, by Long Nguyen, and I was the only non architect on the course. They all seemed to be most interested in data structures, and echo one of the above posts mentioning what extends the functionality of grasshopper with looping, as they were also all savvy with grasshopper and less interested in surface modelling (matching / blending etc).

I wanted to do more in native rhino, for removing repetitive standard rhino tasks and extending native rhino functions (for example, flow along surface to multiple target surfaces; because who wants to boot up grasshopper and then select a definition just to do that? Wouldn’t it be nicer to try and extend rhino functionality if you think it can be improved).

All the best for the class!

2 Likes

Thank you all for the examples and for sharing these inspiring images, @lando.schumpich and @diff-arch!
If I were to draw an intermediate summary of the main categories of examples, then we have:

  • automating repetitive 2D drafting tasks or such with large number of objects
  • automating 3D modelling tasks
  • reading and exporting data from files
  • crowd, water drainage simulation (agents-based)
  • sun/shadow analysis
  • discrete design (@diff-arch I like how you connected this to agents systems and not to the usual suspects of rule-based approaches such as L-Systems or Graph-Grammars)
  • fractals (recursion-based)
  • generating floor plan layouts

Of course such a summary is quite dry without the specifically described use case and the pictures above but maybe inspires more people to add a new category of examples or add more examples of one of the mentioned categories.

I think some kind of 2D drafting automation example and a fractal example would fit quite well in the scope of the course and offer a nice mix of practicality and inspiration.

As far as the fractal example goes, I already posted one! The fourth image from the top in my previous post shows the chaos game fractal. You can even download the file here.

Numerous 2D drafting automation scripts can also be discovered here in the forums.
For instance, here’s a pretty handy, yet simple example that I shared some time ago. It allows you to tag whatever you want with colorful text dots from Grasshopper. It’s pretty useful!

Here’s another example that I use to preview CNC cutting paths in Rhino with. You can enter the diameter of your drill bit and set tabs. Tabs are used to keep the material in place, when you don’t want to glue it to the spoilboard or don’t have a vaccum table that holds it down while milling.

Unfortunately, the thread where I posted it originally was deleted by its OP some time ago.
No idea why, but anybody who wants to take the script for a spin can PM me! It’s RhinoPython not GHPython though.

I keep my architectural automation scripts under wraps for now. :wink:
I guess they wouldn’t be good examples for Python beginners either, because all of them are quite complex with hundreds or even thousands lines of code and multiple, implemented algorithms. Oftentimes the results are also not very spectacular in terms of visuals. It’s quite technical stuff really.

One example that is always impressive to check out is @AndersDeleuran’s car simulation, written in GHPython: https://www.instagram.com/p/BlIg3K8HEcW/
I love it and it was a huge inspiration for me back in day. :slight_smile:

2 Likes

The most practical use of Python in Architecture is pyRevit, which is relevant to Rhino with Rhino Inside Revit & Python’s use in prototyping of components, which are primarily written by the same person. [Ehsan Iran-Nejad]

you mean for those architects that use revit, obviously

2 Likes

Yup, which is Real World, practical use cases of Python for architectural design for beginners, granted its all simulacra.

The entire pyRevit and RiR is open source and well documented as well, great for the beginner or intermediate.

no, its just “your” real world…
image

He is “looking for examples to give to my students at the TU Darmstadt [Germany].”
Oh, and he also tagged the post with “mac” and Revit happens to be a windows only app.

source: https://www.e-zigurat.com/blog/en/state-of-bim-adoption-europe/

Thanks, Very informative, great to see a move away from the oppression of Autodesk.

As a drafter i think Architects should stick to colored pencils :slight_smile:

1 Like