Macro to draw a Hip Roof

  •  Here's a macro for generating roofs.

    Instructions:
    1] Draw a complete 2d plan of the roof in 3d space in the X-Z plane...
    2] Run the Macro. You will be asked for the pitch. If it is a 6/12 pitch, for example, then enter 6...
    3] You will generate each plane of the roof by snapping to the perimeter of a roof-plane, starting at the outter edge (the roof line). Snap 2 point at what would be the base of that plane (move in the positive X or Z direction) and then continue snapping around the perimeter of that plane on the 2d plan, stopping at the point before where you started. Press Enter. The roof plane will be generated in 3d space at the pitch specified. Continue doing this for all the roof planes. Press Esc when done. If the roof perimeter contains angled lines, do the straight ones first, end the macro, rotate the plan, then do the others.

    Be careful to SNAP at the points in the 2d roof plan and not at the roof planes generated by the macro. If you zoom in close to the generated roof intersections the points of the different planes may not meet.

    This macro was written by me for my own use so it's not as tidy as it could be.

    Lar
"hiproof.d3m" frist written by Lar, 1996, last update Nov, 1998

dim xx(200), yy(200), zz(200)
precision 4
input "Enter rise in inches (do not put inch symbol)." r
rr=r/12
message "Set 2 points (positive X or Z direction) at base, then continue around...(Or press Esc to end)"
top:
setpoint "Set 2 points (pos. direction) at base...(Or press Esc to end)" 2
pointval x y z 1
pointval x2 y2 z2 2

setpoint "Set other points for pitch (continue from previous)...(Or press Esc to end)" 200

n=sys(1)
if n<1 then
message "You haven't set any points..."
goto top
end if

for nn=1 to n
pointval xx(nn) yy(nn) zz(nn) nn
next

if x2-x<z2-z and xx(1)>x then goto xpos 'zbase, positive x
if x2-x<z2-z and xx(1)<x then goto xneg 'zbase, negative x

if z2-z<x2-x and zz(1)>z then goto zpos
if z2-z<x2-x and zz(1)<z then goto zneg

end

xpos:
>plane
{
<pointxyz [x, y, z]
<pointxyz [x2, y2, z2]
for nnn=1 to n
<pointxyz [xx(nnn), y+((xx(nnn)-x)*rr), zz(nnn)]
next
<pointxyz [x, y, z]
}
goto top

xneg:
>plane
{
<pointxyz [x, y, z]
<pointxyz [x2, y2, z2]
for nnn=1 to n
<pointxyz [xx(nnn), y+((x-xx(nnn))*rr), zz(nnn)]
next
<pointxyz [x, y, z]
}
goto top

zpos:
>plane
{
<pointxyz [x, y, z]
<pointxyz [x2, y2, z2]
for nnn=1 to n
<pointxyz [xx(nnn), y+((zz(nnn)-z)*rr), zz(nnn)]
next
<pointxyz [x, y, z]
}
goto top

zneg:
>plane
{
<pointxyz [x, y, z]
<pointxyz [x2, y2, z2]
for nnn=1 to n
<pointxyz [xx(nnn), y+((z-zz(nnn))*rr), zz(nnn)]
next
<pointxyz [x, y, z]
}
goto top

 

File to Download:

hiproof.zip