Gable roof script

Hello

I’m just starting to learn about Python scripting.

I would like to write a script for a gable roof. Simply a box with a triangle on it, but as one solid. And I’m racking my brains over how best to approach it. Ideally, I’d like it to work like the "box, 3 points, height” command. And I was wondering if there’s a way to create the gable roof in advance, specify the corner points, and then define them by clicking in the drawing. It seems like such a simple task to me, yet I can’t find a easy way to create a script for it.

Thanks for any help:)

Hi Joya,

Did manage to get some results already?

One approach could be that you create all the points of the sideview,
From that create a polyline and extrude that to become a solid:

gable_roof_house.py (2.4 KB)

Does this help?

I made a bunch of scripts for this a long, long time ago…

Roof4Pan4PtsHt.py (1.9 KB)

Roof3Pan4PtsHt.py (1.8 KB)

Roof2Pan4PtsHt.py (1.8 KB)

Basically click 4 corner points and enter a height.

Pick the four corner points starting with the shortest side. It will try to orient the roof peak between the two short sides. If it sees the first two points represent a long side, it will ask you if you want to invert. Works on unequal-sided, non-rectangular 4-sided figures as well (in theory).

There are more that I have, and they haven’t been updated in awhile, but might get you started.