Getting started with python for home design

I’m just getting started with my first Blender project. I am considering some addition ideas to my home and would like to model both the existing house and the house with the proposed addition. I would like to use python to provide exact construction of the fundamental structure. Later I will learn about textures, lighting and the other very powerful features of Blender.

I have gone through many tutorials including the excellent “Python Crash Course for Blender” by Curtis Holt. I have had many false starts and am both wasting a lot of time and getting very frustrated. It seems to me that a very useful sample program can be written with about 7 lines of code. I think I already know the first four so it is very annoying that I just can’t get a clean start.

The sample code that I think I want will just make a single wall section and place it in a reasonable place. If I can make and place one 3D rectangular object then I can build a house out of several hundred of them.

First I’ll list my sample pseudo-code and then I’ll explain it.

import bpy
from math import radians
so = bpy.context.active_object
# resize to make a wall, possibly move to (0,0)
# cut window
# translate to final location

To provide a little explanation:

  • The first four lines are from the Curtis Holt tutorial on YouTube.

  • I would like to use code to make the wall the desired size. Ideally the mesh would be created with the correct size but tutorials seem to add a default sized mesh and then resize (rescale and I never get all 3 dimensions to work). Positioning the lower left corner of the wall at (0,0) might make it easier to cut windows and doors. For this example assume the wall section is 10m wide, 3m tall and 0.1m thick.

  • Cut a window. The real project might cut numerous windows and doors in a single wall. For this example assume a single window is 1m tall, 0.75m wide and the bottom left corner is located at (2, 1.5).

  • Move to final location. Assume that the SW corner of the property is (0, 0, 0). Assume that the building is to be oriented on a SW to NE diagonal. Locate the SW corner of the wall at (10, 5, 1). Assume the wall is oriented 45 degrees east of north. Assume that we want the garage to drain any water that comes in as rain or snow on a car. Let the NE corner of the wall be located at an elevation of 1.05m.

This seems like it should be a rather straightforward task that would require about 3 more lines of code than I have provided. Could someone please either provide the necessary “about 3 lines” of code or help me understand what I am doing wrong in my approach to this project.

Thank you,

why don’t you use archi pack addon
it already can do all the building features like doors windows
wall ect…

might be much simpler and faster

happy bl