Functions for bars and flats

We are going to define a few more functions to build bars and flats. All of them are short and easy to understand.

def bar_x(x, y, z, length, m):
    for i in range(x, x + length):
        block(i, y, z, m)

def bar_y(x, y, z, length, m):
    for j in range(y, y + length):
        block(x, j, z, m)

def bar_z(x, y, z, length, m):
    for k in range(z, z + length):
        block(x, y, k, m)

def flat_xy(x, y, z, h, w, m):
    for j in range(y, y + h):
        bar_x(x, j, z, w, m) 

def flat_yz(x, y, z, h, d, m):
    for j in range(y, y + h):
        bar_z(x, j, z, d, m) 

# roof
def flat_xz(x, y, z, d, w, m):
    for k in range(z, z + d):
        bar_x(x, y, k, w, m) 

def wall(x, z, h, w, m):
    for i in range(x,(x + w)):
        column(i, z, h, m)

def side_wall(x, z, h, w, m):
    for k in range(z, z + w):
        column(x, k, h, m)

Demo

# some bars, flats
bar_x(0, 5, -20, 10, 'linen_blue')
bar_y(2, 8, -20, 8, 'linen_blue')
bar_z(-1, 10, -20, 6, 'linen_blue')

flat_xy(8, 9, -20, 4, 4, 'linen_yellow')
flat_xz(6, 12, -16, 6, 6, 'diamond')
flat_yz(-4, 5, -20, 5, 8, 'linen_light_blue')

results matching ""

    No results matching ""