if gs_detlevel_3d=0 then end
PEN gs_cont_pen
MATERIAL roof_mat
ALPHA=ABS(ATN(COS(G)*TAN(P)))
M=A*TAN(ALPHA)
N=H/COS(ALPHA)
T=T/2
U=T/SIN(G)
W=W/2
D=ABS(90-G)
S=W/COS(D)
IF G<0 THEN V=0 ELSE V=1
IF G>90 THEN V2=0 ELSE V2=1
unID=1
HOTSPOT 0,-B/4,(H/2)/(cos(ALPHA))-(A/2*tan(ALPHA)),unID=unID+1 !! Hotspots in axis
HOTSPOT A/2,-B/4,(H/2)/(cos(ALPHA)),unID=unID+1
HOTSPOT U,0,-A*tan(ALPHA)+U*tan(ALPHA),unID=unID+1 !! lower Hotspots
HOTSPOT A-S,0,-S*tan(ALPHA),unID=unID+1
HOTSPOT U,0,-A*tan(ALPHA)+U*tan(ALPHA)+H/2/(cos(ALPHA)),unID=unID+1 !! middle Hotspots
HOTSPOT A-S,0,-S*tan(ALPHA)+H/2/(cos(ALPHA)),unID=unID+1
HOTSPOT U,0,-A*tan(ALPHA)+U*tan(ALPHA)+H/(cos(ALPHA)),unID=unID+1 !! upper Hotspots
HOTSPOT A-S,0,-S*tan(ALPHA)+H/(cos(ALPHA)),unID=unID+1
ADDZ -M
ROTX 90
ADDX U
ROTY G
CUTPLANE 1, 1, 0, V !Cut at the Bottom1
DEL 2
IF G<90 THEN GOSUB 1 ELSE GOSUB 2
ADDX A-S
ROTY G
CUTPLANE 1, 1, 0 !Cut at the top1
DEL 2
ADDX A-S
ROTY G-90
CUTPLANE 1, 1, 0, V2 !Cut at the top2
DEL 2
ADDZ -B/2
PRISM 5, B,
0, 0,
A, M,
A, M+N,
0, N,
0, 0
CUTEND
CUTEND
CUTEND
CUTEND
plane 4, 0.006,0,0,0.006,-b/2,h,a-.006,-b/2,h,a-.006,0,0
plane 4, 0.006,0,h,0.006,-b/2,0,a-.006,-b/2,0,a-.006,0,h
DEL TOP
END
1:
ADDX U
ROTY G+90
CUTPLANE 1, 1, 0, V !Cut at the Bottom2
DEL 2
RETURN
2:
ADDX U
ROTY G-90
CUTPLANE 1, 1, 0, V !Cut at the Bottom2
DEL 2
RETURN
so that's the code right now. p is an angle type variable that the tells the rafter what pitch the roof is and i only see it mentioned once in the alpha equation up at the top. you can see where i slapped the plane command in there.