Modeling for architecture with Python scripts: Collecting ideas

In just a few days I will start a new research project involving the development of a few tools and scripts for Blender, aimed in architectural modeling. I know that some of those tools may already exist, but the focus of the project is to find the best way to manage procedural modeling in Blender. Since Blender is a general modeling tool it lacks tools to enhance the workflow of architectural modeling. For instance, there is no dedicated tool to create stairs or doors.

The objective of the project is to create those tools and help architectural visualization artists. I already have a few ideas, like a tool to create stairs and doors.

If you could point out an object or architectural element that is hard to model in Blender, and would work better as a parametric modeling tool, which object is that?

As a way to start the project I was thinking about curtain walls or maybe stairs. By the time those tools are working, I will of course release them as a free download here, and distribute them to help architectural visualization artists.

I`m open to suggestions on what objects to focus first.

Blender 3D Architect Pro

Comments

  • Tella

    Great idea!

    Roofs are always hard.

    A catalog of easy to setup moldings (by line).

    I haven’t seen any curtain procedurals, but it would be awesome, as they are quite time consuming.

    Cheers!

  • Allan Brito

    Thanks.

    Roofs will be a lot of fun to work with! 🙂

  • maces

    Hi,

    AFAIK there is a script for stairs, and it works well(249b).

    I already have an idea for something like an array modifier in two dimensions at once and with a random factor for loc/rot/scale. It could use given objects (UV-mapped ect.) and place them with fixed count (array) or to fill a given area (maybe with holes in that area). You could use this for several parts of old buildings, like an exterior paver floor with broken and rotated paver or for roofs, ect.

    Well I never had written a Script for blender, but I know a bit of Python and I’m willing to learn how to do this.

    It would be very cool if you could open a Forum (discussion, testing beta-tutorials) and a Wiki (working tutorials ect)(I could help settings this up, if you like) or get space at blender.org/. For first tests an irc channel and a static page on your blog would be enough, I think.

    I think this is a very cool Project and I’m glad to help, if possible.

    maces

  • maces

    Hi,

    there is a stairs script for 249b, AFAIK.

    It would be cool if you could setup a forum and a wiki for discussion and documentation (I could help you with this, if you like). For first tests and IRC channel and a static page on you blog would be enough, I think.

    My first idea:

    – Advanced array:
    – use several objects for the array (each with UV-mpa ect. by user)
    – two dimensions at once (so you don’t have to set everything twice)
    – random for loc/rot/scale
    – beside fixed count and “fill area” option
    – will fill a given area and bear in mind of holes in that area
    => would be perfect for old, broken paver and roofs
    – You can fill places and Roofs very fast
    – You can (with curve modifier) setup a paver/…-path in exteriors
    – if it is performable you could try it with grass 😛

    maces

  • maces

    Woops sorry I forgot that you setup your blog to review the posts before there are showing, could you please use the second post? the one which contains parts of the third (which isn’t needed then)

    maces

  • differentsmoke

    Allan,

    (firefox blinked and a rather extensive post suddenly wasn’t there anymore… the most annoying thing I’ve experienced yet… here I go again)

    To me the least architectural feature of Blender has always been the lack of a good drafting interface.

    Honestly, while premade “parametric”(a word that hides more than it communicates, nowadays) solutions are very useful from massive comercial point of view, as a purely disciplinary concern I think they hinder design more than they enrich it.

    If you’ll go into parametrization, then I’d rather have abstract work benches rather than concrete solutions: maybe a complexification of the Array modifier, or a more straightfoward use of things like curvePaths+dupilframes, which allow from some interesting “Arrays”.

    Still, my main issue with blender for architecture is to have an easier way to go from dragins to 3d models and back to drawings again. I think the capabilities are all there(specially with the advent of BMesh), but they have to be articulated as a coherent workflow(and AFAIK, that’s one of python’s main roles in the new blender).

    Those are my thoughts: I apologize if they are not useful to your original purpose.

    One more thing, as a colleague interested in Blender, scripting and OSS in general, I’d be very interested in participating, if I can. Unfortunately, my BPython skills are currently almost non-existant(I’m teaching myself python again, and I’m trying to make sense of the API), but I do have experience with coding(RhinoScript, Processing, Action/JavaScript) and I did manage to program Conway’s Game of Life once in Blender 2.4X.

    cheers,
    Pablo.

  • Chris Landau

    This is great news. More Complex Arrays have my vote. The ability to randomize instance properties based on sliders, etc would be excellent. Is there a way to add an Attractor modifier to the array tool? (Like this: http://api.ning.com/files/SvYus8Zcpw5MdVd-PJCp7O30fCey1UJ729Pu4BId-C*D7W8ut8LiX7ndREJjOe9K/PolylineAttractorRender1.png )

  • rbtyod

    Allan,
    Traditional double hung windows provide endless variations that could be parametrized in a generation script.

    …Bob

    P.S.
    I love your website.

  • Trumpetto

    Great idea!

    My problem is maybe the same. There are a lot of pieces but I miss the bundling of them all. I ‘write’ my houses in OpenSCAD (openscad.org/) and as I’m a programmer that is the perfect thing for me. On the way I wrote a lot of functions for different elements.

    A bundling of tools for door, window, roof, wall, staircase and floors in Blender would make me think again.

  • Benjamin Bailey (Banor)

    Awesome, man! Alright, here’s my suggestion: a fence. Not a simple white-washed fence, but a chain-link fence. This script could also have an option to not include the post or gate, but just the mesh-like fence, which could be useful for things like office pencil holders or a wire grate.

  • Yorik

    I recently came across this:
    http://parama.sourceforge.net/
    Seems pretty interesting, but I didn’t have enough time to dig further. And the project is quite old already and not maintained anymore. Also, take a look at something called structuresynth… Not python or blender, but good ideas to grab.
    I have that project to try to integrate something like that in freecad too one of these days…

  • Luis

    I’d suggest the possibility of an snapping tool easier to use and closer to that used in cad sistems (autocad).
    In the second hand, the possibility of copying several objects at the same time, via the array modificator or not would be very useful in my opinion.

  • ERasnier

    Don’t know if it’s achievable but it would be awesome to have a 3D to 2D export kind of thing for blueprints with dimensions scale, author/drawing details etc. Both for Architecture and objects.

  • eks

    Hai, A rectangle curve(not mesh). An architectural modeler need it always. Now we have to make a circle and convert it to a rectangle or make by shape tool in normal way. I think it is important. If anybody can make an add-on script or something like that it will be very helpfull.
    thank you

  • Rémi

    Maybe it could be of some help, here are a lot of ruby scripts for sketchup : http://www.crai.archi.fr/RubyLibraryDepot

    Ok it’s not coded in python and it’s not intented for blender but the algorithm should be pretty much the same…

  • Garu

    i also vote for roofs! and curtains? they’re really time consuming to model..

  • Alain

    As you already know, there are alot of CAD-Tools Projects in the pipe already (ProCAD, CAD-Tools (from Migius)) and there has been an extra roundtable at the blender conference (I can’t remember which year it was, I guess 2008).
    But they all lack in the ease of use.

    Beside al the things that have been mention already there are the following points I would add/ think about:
    -Generel: Connect your ideas together an do not split your CAD-Project-groups all over the world
    -Railings
    -Some functions like Scatter for 3d max
    -A script like the “Floor Generator” for 3d max http://www.cg-source.com/floorgenerator.php
    -Unique material ID like here: http://www.cg-source.com/uniquematerialids.php
    -A “Cut by plane” Modifier

    Kind regards
    Alain

  • George

    Something like paneling tools for rhino would be nice, maybe using more advance arrays over surfaces!

    To be able to accurately parallel offset edges of complex shapes would be a dream.

    And a hidden line render would be great like in sketch up! to render out drawings it would be great ( i don”t mean wireframe, I mean the object edges (simplified Subsurf edges) that are on the visible faces.)

    Some sort of pipe tool would be great. Like the pipe tool in rhino or the follow me tool in sketch up. To be able to draw a section profile and the extrude it along a curve or even an edge would be good.

  • stanmarsh

    hi allan,

    this is a great initiative!

    i like to see in blender a way to draft 2d objects like lines and curves easily. the idea is similar to “surface sketching” but with greater 12control for archviz.

    Surface Sketching by Blend_Ideas
    http://vimeo.com/10695820

    cheers

  • Tom

    From the point of view of green architecture and analysis (see your former post dated April 6), it would be very nice to have these kind of tools available in Blender.
    From commercial point of view it would then be nice to have a tool that creates 3d models out of 2d drawings. Next to this it would be very helpful to have some kind of “standard objects/materials” like a wall with customizable thickness, air gap, isolation,… (features available in Autodesk Revit for example).
    It seems to me you’d have a powerful tool for optimizing design and you get stunning 3d vizualizations almost for free.

    I also apologize if this posting was not that useful for the original purpose of this thread because of the focus on a tool to (automatically) create 3d objects from 2d drawings. It seems to me that such a tool would be very useful, but currently not available.

    Kind regards

  • Jerry

    Hello!

    Parametric tools are great when the amount of parameters to enter is minimal, or appear only when the context is relevant, or when one asks for more.

    Perhaps a tool for drawing a road and projecting or placing it on a terrain model might be useful?

    However on top of my wish list is a tool for rendering any type of projection (ortho, central, curvilinear, 360 …), into useful 2D vector graphics files. Perhaps Freestyle (or Pantograph?) will be able to do this?

  • maces

    Well I think for organizing an improved outliner would be good, I have some ideas in mind, including a “database” (blendfiles) with materials, objects, animations and so on in them.

    I would suggest to let us some time to get creative and think off tools and let us inspire. Then we should meet on irc/whereever and discuss them, make project groups. While doing this we should use a wikipage(blender.org?)/images ect. to dokument and clarify what we’re meaning 😉

    maces

  • Allan Brito

    Thanks to everyone for your suggestions. They will really help me to start of the project.

    Soon I will create a wiki or forum to post the progression on the development. And for those willing to help, any contribution will be welcome!

  • Allan Brito

    I just found a great reference.There is a script for SketchUp called 1001bits. My idea would be to create something like it for Blender. They have lots of parametric modeling tools:
    http://www.1001bit.com/

  • nf3

    great idea. my 2cts:

    a) for me, a holy grail would be the already mentioned proposal of a sort of ‘duplimaterials’, ie, a way to set duplicated objects with variations in the material, to easily develop tiles, bricks and the like

    b) the ‘improved array’ also is a choice. maybe like a configurable grid to place objects at will, also with configurable independent rotations. Dupliobjects is cumbersome to set up and rotations depend on non editable vertex normals.

    c) another choice I considered, but out of my capabilities: a script of scripts, wich blends in one single front end some useful for architecture editing scripts: Big numbers toolkit, RobertT aligner, geom tools, Loop tools…

    d) there was also the discontinued Kloputils script, wich contained many useful ideas. It’s unstable now, it would be good someone updated it.

  • Mark

    AFAIK none of the existing stairs scripts create nice railings. One that does would be nice to have but somewhat challenging to make.

  • Nick

    I made a script to create stairs with railings in Blender 2.49. Here it is:

    #! /usr/bin/env python

    ”’
    Title: Stairs and railing creator script for blender 2.49
    Author: Nick Trefiak
    Date: 2010 08 09

    Description:
    Creates a straight-run staircase with railings and stringer
    All components are optional and can be turned on and off by setting e.g. makeTreads=True or makeTreads=False
    No GUI for the script, all parameters must be defined below
    Current values assume 1 blender unit = 1 metre

    Stringer will rest on lower landing and hang from upper landing
    Railings start on the lowest step and end on the upper landing

    NOTE: You must have numpy installed for this script to work!
    numpy is used to easily perform the necessary algebra
    numpy can be found at http://www.scipy.org/Download

    Note: I’m not sure how to use recalcNormals so not all normals points ouwards.
    Perhaps someone else can contribute this.
    ”’

    #———————————————————————
    ”’define all parameters here”’

    global rise, run
    rise=0.20 #single tread rise, including the tread height
    run=0.30 #single tread run, not including the nosing

    #for treads
    makeTreads=True
    wT=1.2 #tread width
    hT=0.04 #tread height
    tT=0.03 #tread toe, a.k.a. nosing
    nT=10 #number of treads

    #for posts
    makePosts=True
    dP=0.04 #post depth
    wP=0.04 #post width
    nP=5 #number of posts

    #for railings
    makeRailings=True
    wR=0.12 #rail width
    tR=0.03 #rail thickness
    hR=0.90 #rail height

    #for retainers
    makeRetainers=True
    wRR=0.01 #retainer width
    hRR=0.01 #retainer height
    nRR=3 #number of retainers

    #for stringer
    makeStringer=True
    wS=0.15 #stringer width, set equal to tread width for fully enclosed riser

    #———————————————————————
    ”’import modules”’
    from Blender import *
    import bpy
    import math
    from numpy import *

    #———————————————————————
    ”’classes for mesh creation”’

    class General:

    ”’common data, methods needed for other objects”’

    def __init__(self,rise,run,N):
    self.start=zeros((3))
    self.stop=float(N)*array([run,0,rise])
    self.slope=rise/run
    self.angle=arctan(self.slope)
    #identical quads for all objects except stringer
    self.faces=[[0,1,3,2],[0,1,5,4],[0,2,6,4],[4,5,7,6],[2,3,7,6],[1,3,7,5]]

    def Make_mesh(self,coords,faces,meshname,objname):
    ”’make a mesh given the vertex coordinates, faces, and names for mesh and object”’
    me = bpy.data.meshes.new(meshname)
    me.verts.extend(coords.tolist())
    me.faces.extend(faces)
    scn = bpy.data.scenes.active
    ob = scn.objects.new(me, objname)

    class Treads:

    ”’class for creating treads”’

    def __init__(self,w,h,d,r,toe,N):
    self.w=w #tread width
    self.h=h #tread height
    self.d=d #tread run
    self.r=r #tread rise
    self.t=toe #tread nosing
    self.N=N #number of treads
    self.Create()

    def Create(self):
    for i in range(self.N):
    coords=zeros((8,3))
    coords[0,:]=[-self.t,0,0]
    coords[1,:]=[self.d,0,0]
    coords[2,:]=[-self.t,self.w,0]
    coords[3,:]=[self.d,self.w,0]
    coords[4:,:]=coords[0:4,:]+array([0,0,-self.h])
    coords=coords+array([i*self.d,0,i*self.r])
    G.Make_mesh(coords,G.faces,’tMesh’,’tObj’)

    class Posts:

    ”’class to create posts”’

    def __init__(self,d,w,wT,nP,hR,tR):
    self.x1=G.start+array([0,0,hR-tR]) #rail start
    self.x2=G.stop+array([0,0,hR-tR]) #rail stop
    self.d=d #post depth
    self.w=w #post width
    self.wT=wT #tread width
    self.nP=nP #number of posts
    self.sp=array([(self.x2[0]-self.x1[0])/float(nP+1),0,0]) #spacing between posts
    self.Create()

    def Intersect(self,i,d):
    ”’find intersection point, x, for rail and post”’
    x3=self.x1+i*self.sp+d
    x4=x3+array([0,0,self.x2[-1]])
    a=self.x2-self.x1
    b=x4-x3
    c=x3-self.x1
    cr_ab=cross(a,b)
    mag_cr_ab=(cr_ab**2).sum()
    return self.x1+a*(dot(cross(c,b),cr_ab)/mag_cr_ab)

    def Create(self):
    for i in range(0,self.nP+2,1):
    coords=zeros((8,3))
    #intersections with rail
    coords[0]=self.Intersect(i,0.0)
    coords[1]=self.Intersect(i,self.d)
    #intersections with tread
    coords[2]=array([self.x1[0]+i*self.sp[0],0,int(coords[0,0]/run)*rise])
    coords[3]=coords[2]+array([self.d,0,0])
    #inner face
    coords[4:,:]=coords[0:4,:]+array([0,self.w,0])
    G.Make_mesh(coords,G.faces,’pMesh’,’pObj’)
    #make post on other side of steps as well
    coords=coords+array([0,self.wT-self.w,0])
    G.Make_mesh(coords,G.faces,’pMesh’,’pObj’)

    class Rails:

    ”’class for creating railings”’

    def __init__(self,w,t,h,tT,wP,dP,wT):
    self.w=w #rail width
    self.t=t #rail thickness
    self.h=h #rail height
    self.start=G.start+array([0,0,self.h-self.t]) #rail start
    self.stop=G.stop+array([0,0,self.h-self.t]) #rail stop
    self.tT=tT #tread toe
    self.wP=wP #post width
    self.dP=dP #post depth
    self.wT=wT #tread width
    self.Create()

    def Create(self):
    #determine offset to include railing toe
    offset=array([self.tT,0,self.tT*tan(G.angle)])
    coords=zeros((8,3))
    coords[0]=self.start-offset
    coords[1]=self.stop+offset+array([self.dP,0,self.dP*tan(G.angle)])
    coords[2]=self.start-offset+array([0,self.w,0])
    coords[3]=self.stop+offset+array([self.dP,self.w,self.dP*tan(G.angle)])
    coords[4:,:]=coords[0:4,:]+array([0,0,self.t])
    #centre over posts
    coords=coords+array([0,0.5*(-self.w+self.wP),0])
    G.Make_mesh(coords,G.faces,’rMesh’,’rObj’)
    #make rail on other side
    coords=coords+array([0,self.wT-self.wP,0])
    G.Make_mesh(coords,G.faces,’rMesh’,’rObj’)

    class Retainers:

    ”’class for creating retainers”’

    def __init__(self,w,h,wP,wT,nR):
    self.w=w #retainer width
    self.h=h #retainer height
    self.wP=wP #post width
    self.wT=wT #tread width
    self.nR=nR #number of retainers
    self.sp=hR/float(nR+1) #retainer spacing
    self.Create()

    def Create(self):
    for i in range(self.nR):
    coords=zeros((8,3))
    offset=(i+1)*array([0,0,self.sp])
    coords[0]=G.start+offset
    coords[1]=G.stop+offset
    coords[2]=G.start+offset+array([0,self.w,0])
    coords[3]=G.stop+offset+array([0,self.w,0])
    coords[4:,:]=coords[0:4,:]+array([0,0,self.h])
    #centre in posts
    coords=coords+array([0,0.5*(self.wP-self.w),0])
    G.Make_mesh(coords,G.faces,’rrMesh’,’rrObj’)
    #make retainer on other side
    coords=coords+array([0,self.wT-self.wP,0])
    G.Make_mesh(coords,G.faces,’rrMesh’,’rrObj’)

    class Stringer:

    ”’class for creating stringer”’

    def __init__(self,w,nT,hT,wT):
    self.w=w #stringer width
    self.nT=nT #number of treads
    self.hT=hT #tread height
    self.wT=wT #tread width
    self.faces=[[0,1,3,2],[1,5,3],[3,5,4],[6,7,9,8],[7,11,9],[9,11,10],[0,2,8,6],[0,1,7,6],[1,5,11,7]]
    self.Create()

    def Create(self):
    for i in range(self.nT):
    coords=zeros((12,3))
    coords[0]=G.start+array([0,0,-rise])
    coords[1]=G.start+array([run,0,-rise])
    coords[2]=G.start+array([run*0,0,-self.hT])
    coords[3]=G.start+array([run*1,0,-self.hT])
    coords[4]=G.start+array([run*1,0,0])
    coords[5]=G.start+array([run*2,0,0])
    coords[6:]=coords[0:6]+array([0,self.w,0])
    coords=coords+i*array([run,0,rise])
    #centre below tread
    coords=coords+array([0,0.5*(self.wT-self.w),0])
    G.Make_mesh(coords,self.faces,’sMesh’,’sObj’)

    #———————————————————–
    ”’create meshes”’

    editmode = Window.EditMode() # are we in edit mode? If so …
    if editmode: Window.EditMode(0) # leave edit mode before getting the mesh

    global G
    G=General(rise,run,nT)
    if makeTreads: Treads(wT,hT,run,rise,tT,nT)
    if makePosts: Posts(dP,wP,wT,nP,hR,tR)
    if makeRailings: Rails(wR,tR,hR,tT,wP,dP,wT)
    if makeRetainers: Retainers(wRR,hRR,wP,wT,nRR)
    if makeStringer: Stringer(wS,nT,hT,wT)

    if editmode: Window.EditMode(1) # optional, just being nice

  • Nick

    Since this site strips leading spaces all the indentation in my previous post is lost. http://pastebin.com/RwnRXgZ7 has the code with indents.

  • indianfriend

    Allan, a tool to create slopping roof by giving angle will be a great thing for architectural visualizers

  • archimage

    Hi Allan, Very nice work !

    Looking at revit’s basic toolbox could be a good starting point : wall, floor, openings, window, door

    This kind of tools are very useful to work fast in architecture, especially when they are parametric.

    Using parametric dimensions between vertices, edges or faces could be also a good thing.

    I think more complex tools like paneling tools but for more specific projects…

    Good luck !

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Blender 3D Architect Newsletter

Receive free assets, news, and resources for architecture

We respect your privacy and do not tolerate spam and will never sell, rent, lease or give away your information (name, address, email, etc.) to any third party. Nor will we send you unsolicited email.