2
$\begingroup$

I'm new to blender and have just discovered Archipack. I've done some coding in my past and was curious to see if there is an API(?) for Archipack? I've done some digging but haven't found anything solid yet.

I've found this archipack link but it doesn't seem to have much documentation on it regarding this topic. I'm basically just looking to see if I can put together a simple script that will create a square/rectangular room for starters.

Any and all help/direction is be appreciated.

$\endgroup$
3
  • $\begingroup$ The plugin is written in Python and source code is available in the scripts/addons/archimesh/ folder of your Blender install. $\endgroup$
    – Ron Jensen
    Sep 21, 2021 at 19:49
  • $\begingroup$ @RonJensen, I was hoping there was a simple tutorial somewhere with examples I could follow. Python isn't exactly my strongest language but thanks. I'll take a look and see what I can find. $\endgroup$
    – Cflux
    Sep 21, 2021 at 20:54
  • $\begingroup$ Be careful Archimesh and Archipack are not the same add-on although they offer similar features. Are you using the pro or free (default shipped with Blender) version ? $\endgroup$
    – Gorgious
    Sep 22, 2021 at 9:08

1 Answer 1

1
$\begingroup$

Here's a very simple example using an operator to create a 5u*5u square room in the Archipack version that's shipped with Blender :

import bpy

bpy.ops.archipack.wall2()  # This creates a simple wall span
o = bpy.context.active_object
m = o.data
prop = m.archipack_wall2[0]  # Access the Archipack wall object
prop.n_parts = 3  # Add 2 wall spans, they are automaticcaly added at a 90° angle
prop.closed = True  # Close the walls
for part in prop.parts:
    part.length = 5  # Increase the wall spans lengths

Result of running the script :

enter image description here

If you want a rectangular room, for instance, replace the last lines with :

for i, part in enumerate(prop.parts):
    part.length = 3 + (i % 2) * 3

enter image description here

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .