def create_2by12s(scene):
    print("Adding in 2by12's")
    y = feet(4) + 48
    z = 18
    backstop_x = 24
    rotation = (0, radians(90), 0)
    _2by12s = [
        [backstop_x, y, z],
        [backstop_x, y, z + 11.5],
        [backstop_x, y, z + 11.5 * 2],
        [backstop_x, y, z + 11.5 * 3],
        [backstop_x, y, z + 11.5 * 4],
        [backstop_x, y, z + 11.5 * 5],
        # [backstop_x, y, z + 11.5 * 6],
        # [backstop_x, y, z + 11.5 * 7],
        # [backstop_x, y, z + 11.5 * 8],
        # [backstop_x, y, z + 11.5 * 9],
    ]
    for location in _2by12s:
        obj = add_2by12(scene, feet(18), location, rotation)

    print("Adding South 2x12's")
    y = 60 + 4 * 12
    z = 18
    x = backstop_x + 2
    rotation = (0, radians(90), radians(-124))
    _2by12s = [
        [x, y, z],
        [x, y, z + 11.5],
        [x, y, z + 11.5 * 2],
        [x, y, z + 11.5 * 3],
        [x, y, z + 11.5 * 4],
        [x, y, z + 11.5 * 5],
        # [x, y, z + 11.5 * 6],
        # [x, y, z + 11.5 * 7],
        # [x, y, z + 11.5 * 8],
        # [x, y, z + 11.5 * 9],
    ]
    for location in _2by12s:
        obj = add_2by12(scene, feet(10), location, rotation)

    print("Adding North 2x12's")
    y = feet(24.5)
    z = 18
    x = backstop_x + 1.5
    rotation = (0, radians(90), radians(-54.5))
    _2by12s = [
        [x, y, z],
        [x, y, z + 11.5],
        [x, y, z + 11.5 * 2],
        [x, y, z + 11.5 * 3],
        [x, y, z + 11.5 * 4],
        [x, y, z + 11.5 * 5],
        # [x, y, z + 11.5 * 6],
        # [x, y, z + 11.5 * 7],
        # [x, y, z + 11.5 * 8],
        # [x, y, z + 11.5 * 9],
    ]
    for location in _2by12s:
        obj = add_2by12(scene, feet(10), location, rotation)
def create_berm(scene):
    foo = 0.85
    d_theta = foo * pi
    rot = 180 * (1 - (1 - foo) / 2)
    rotation = (0, 0, radians(rot))
    location = (feet(14.5), feet(17), 0)
    radius = feet(13)
    berm = Berm('berm', radius, feet(5), feet(5), d_theta, location, rotation)
    scene.objects.link(berm.object)
    bpy.context.scene.objects.active = berm.object
    bpy.context.object.active_material.diffuse_color = (0.5, 0.3, 0)
Exemplo n.º 3
0
def create_ground(scene):
    width = feet(100)
    flat_length = feet(38) * 12
    verts = [
        Vector((feet(-20), feet(-20), 0)),  # SW Corner
        Vector((flat_length, feet(-20), 0)),  # SE Corner
        Vector((flat_length, width, 0)),  # NE Corner
        Vector((feet(-20), width, 0)),  # NW Corner
        Vector((flat_length + 20 * 12, 0, 6 * 12)),
        Vector((flat_length + 20 * 12, width, 6 * 12)),
    ]

    edges = []
    faces = [[0, 1, 2, 3], [1, 2, 5, 4]]

    mesh = bpy.data.meshes.new(name="Ground")
    mesh.from_pydata(verts, edges, faces)
    mesh.validate(verbose=True)
    obj = bpy.data.objects.new(GROUND, mesh)
    obj.location = (0, 0, 0)
    obj["scripted"] = True
    scene.objects.link(obj)
    mat = bpy.data.materials.new(name="MaterialName")
    bpy.context.scene.objects.active = obj
    obj.data.materials.append(mat)
    bpy.context.object.active_material.diffuse_color = GRASS_GREEN
Exemplo n.º 4
0
    def __init__(self, name, dy, dx, height, type='2by6'):
        self.name = name
        self.dx = dx
        self.dy = dy
        self.height = height
        self.spacing = 0.25
        self.beam_center = feet(4)

        self.board_width = self.get_board_width(type)

        self.num_boards = self.get_num_boards()
        self.num_beams = self.get_num_beams()
        self.boards = self.get_surface()

        beams = self.get_beams()
        self.boards.extend(beams)
def create_aline(scene, anchor):
    print("Creating A line jumps")

    aline_y_offset = feet(2)

    gap = feet(17)
    height = feet(6)
    width = feet(4)
    takeoff_dx = feet(7)
    landing_dx = feet(11)
    rotation = (0, 0, radians(5))
    # lip of take is 60 from tree1, the x-location is the location of the end of the landing.
    x = anchor[0] + (feet(60) - gap - landing_dx)
    locations = [
        (x, anchor[1] + aline_y_offset, 0.1),
    ]

    for location in locations:
        obj = create_double_jump(height, width, gap, takeoff_dx, landing_dx,
                                 location, rotation)
        scene.objects.link(obj)
        bpy.context.scene.objects.active = obj
        obj.data.materials.append(mat_dirt)
        bpy.context.object.active_material.diffuse_color = (0.5, 0.3, 0)
 def __init__(self, label, height, length):
     thickness = feet(0.25)
     super(Window, self).__init__(label, length, thickness, height)
Exemplo n.º 7
0
def create_deck(scene):
    length = DECK_LENGTH
    width = DECK_WIDTH
    height = DECK_HEIGHT

    name = 'new_deck'
    decking = Decking(name, length, width, height)

    for board in decking.boards:
        scene.objects.link(board)
    # Rotate and translate deck
    bpy.ops.object.select_all(action='DESELECT')
    objects = bpy.context.scene.objects
    for obj in objects:
        label = obj.get('label', None)
        if label and label == name:
            print("Selecting {0}".format(label))
            obj.select = True
            obj.data.materials.append(mat_decking)
            bpy.context.scene.objects.active = obj
            bpy.context.object.active_material.diffuse_color = DECK_COLOR

    bpy.ops.object.join()
    bpy.ops.transform.translate(value=(DECK_X_OFFSET, DECK_Y_OFFSET, 0))
    bpy.ops.transform.rotate(value=pi/2, axis=(False, False, True))
    bpy.context.scene.objects.active = None


    # Add step extension
    name = 'step_extension'
    step_extension = Decking(name, STEP_EXTENSION_LENGTH, STEP_EXTENSION_WIDTH, STEP_EXTENSION_HEIGHT)

    for board in step_extension.boards:
        scene.objects.link(board)
    # Rotate and translate deck
    bpy.ops.object.select_all(action='DESELECT')
    objects = bpy.context.scene.objects
    for obj in objects:
        label = obj.get('label', None)
        if label and label == '{0}'.format(name):
            print("Selecting {0}".format(label))
            obj.select = True
            obj.data.materials.append(mat_decking)
            bpy.context.scene.objects.active = obj

    bpy.ops.object.join()
    bpy.ops.transform.translate(value=(STEP_EXTENSION_X_OFFSET, STEP_EXTENSION_Y_OFFSET, 0))
    bpy.ops.transform.rotate(value=pi/2, axis=(False, False, True))
    bpy.context.scene.objects.active = None


    # Add stairs
    name = 'stairs'
    rise = 8.0
    height = DECK_HEIGHT
    length = feet(4)
    board_width = 5.5
    boards_per_step = 2
    stairs = Stairs(name, rise, height, length, board_width, boards_per_step)

    for board in stairs.boards:
        scene.objects.link(board)

    # Rotate and translate stairs
    bpy.ops.object.select_all(action='DESELECT')
    objects = bpy.context.scene.objects
    for obj in objects:
        label = obj.get('label', None)
        if label and label == '{0}'.format(name):
            print("Selecting {0}".format(label))
            obj.select = True
            obj.data.materials.append(mat_decking)
            bpy.context.scene.objects.active = obj

    bpy.ops.object.join()
    bpy.ops.transform.translate(value=(STAIRS_X_OFFSET, STAIRS_Y_OFFSET - feet(0.5), 0))
    bpy.ops.transform.rotate(value=pi, axis=(False, False, True))
    bpy.context.scene.objects.active = None


    # Add a table
    table = Table('table', dx=feet(3), dy=feet(4), height=feet(2.5))
    for object in table.objects:
        scene.objects.link(object)

    bpy.ops.object.select_all(action='DESELECT')
    objects = bpy.context.scene.objects
    for obj in objects:
        label = obj.get('label', None)
        if label and label == 'table'.format(name):
            print("Selecting {0}".format(label))
            obj.select = True
            obj.data.materials.append(mat_doors)
            bpy.context.scene.objects.active = obj

    bpy.ops.object.join()
    bpy.ops.transform.rotate(value=pi/2, axis=(False, False, True))
    bpy.ops.transform.translate(value=(STAIRS_X_OFFSET - feet(1), STAIRS_Y_OFFSET + feet(2), DECK_HEIGHT))
Exemplo n.º 8
0
def create_house(scene):
    location = (0, HOUSE_Y_OFFSET, 0)



    SW_CORNER_BOT = Vector((0, 0, 0))
    SW_CORNER_TOP = Vector((0, 0, WALL_HEIGHT))

    SE_CORNER_TOP = Vector((SOUTH_LENGTH, 0, WALL_HEIGHT))
    SE_CORNER_BOT = Vector((SOUTH_LENGTH, 0, 0))

    NW_CORNER_TOP = Vector((0, WEST_LENGTH, WALL_HEIGHT))
    NW_CORNER_BOT = Vector((0, WEST_LENGTH, 0))

    NE_CORNER_TOP = Vector((SOUTH_LENGTH, WEST_LENGTH, WALL_HEIGHT))
    NE_CORNER_BOT = Vector((SOUTH_LENGTH, WEST_LENGTH, 0))

    verts = [
        # South Wall
        SW_CORNER_BOT,
        SW_CORNER_TOP,
        SE_CORNER_TOP,
        SE_CORNER_BOT,

        # West All
        SW_CORNER_BOT,
        SW_CORNER_TOP,
        NW_CORNER_TOP,
        NW_CORNER_BOT,

        # North Wall
        NW_CORNER_BOT,
        NW_CORNER_TOP,
        NE_CORNER_TOP,
        NE_CORNER_BOT,

        # East Wall
        NE_CORNER_BOT,
        NE_CORNER_TOP,
        SE_CORNER_TOP,
        SE_CORNER_BOT
    ]

    edges = []
    faces = [
        [0, 1, 2, 3],
        [4, 5, 6, 7],
        [8, 9, 10, 11],
        [12, 13, 14, 15]
    ]
    # House sides
    mesh = bpy.data.meshes.new(name="South Exterior Wall")
    mesh.from_pydata(verts, edges, faces)
    mesh.validate(verbose=True)
    obj = bpy.data.objects.new("house_sides", mesh)
    obj.location = location
    obj["scripted"] = True
    scene.objects.link(obj)
    obj.data.materials.append(mat_house)
    bpy.context.scene.objects.active = obj
    bpy.context.object.active_material.diffuse_color = COLOR_HOUSE

    # House roof
    verts = [
        # ROOF
        SW_CORNER_TOP,
        SE_CORNER_TOP,
        NE_CORNER_TOP,
        NW_CORNER_TOP
    ]
    faces = [
        [0, 1, 2, 3]
    ]
    mesh = bpy.data.meshes.new(name="Roof")
    mesh.from_pydata(verts, edges, faces)
    mesh.validate(verbose=True)
    obj = bpy.data.objects.new("roof", mesh)
    obj.location = location
    obj["scripted"] = True
    scene.objects.link(obj)
    obj.data.materials.append(mat_roof)
    bpy.context.scene.objects.active = obj
    bpy.context.object.active_material.diffuse_color = COLOR_ROOF


    name = 'kitchen_exterior_door'
    door_y_offset = CURRENT_DECK_Y_OFFSET + feet(4)
    length = feet(3.33)
    height = feet(7)
    door = Door(name, height=height, length=length)
    scene.objects.link(door.object)
    bpy.ops.object.select_all(action='DESELECT')
    door.object.select = True
    door.object.data.materials.append(mat_doors)
    bpy.context.scene.objects.active = door.object
    bpy.context.object.active_material.diffuse_color = (1, 1, 1)
    bpy.ops.transform.translate(value=(DECK_X_OFFSET - DECK_LENGTH, door_y_offset, DECK_HEIGHT))
    bpy.context.scene.objects.active = None

    name = 'large_window'
    window_y_offset = door_y_offset + feet(8)
    length = feet(6)
    height = feet(4)
    window = Window(name, height=height, length=length)
    scene.objects.link(window.object)
    bpy.ops.object.select_all(action='DESELECT')
    window.object.select = True
    window.object.data.materials.append(mat_windows)
    bpy.context.scene.objects.active = window.object
    bpy.context.object.active_material.diffuse_color = (1, 1, 1)
    bpy.ops.transform.translate(value=(DECK_X_OFFSET - DECK_LENGTH, window_y_offset, DECK_HEIGHT + feet(2)))
    bpy.context.scene.objects.active = None

    name = 'se_large_window_bot'
    length = feet(5)
    height = feet(3)
    window = Window(name, height=height, length=length)
    scene.objects.link(window.object)
    bpy.ops.object.select_all(action='DESELECT')
    window.object.select = True
    window.object.data.materials.append(mat_windows)
    bpy.context.scene.objects.active = window.object
    bpy.context.object.active_material.diffuse_color = (1, 1, 1)
    bpy.ops.transform.translate(value=(SOUTH_LENGTH - feet(4), HOUSE_Y_OFFSET - 3, feet(3)))
    bpy.ops.transform.rotate(value=pi/2, axis=(False, False, True))
    bpy.context.scene.objects.active = None

    name = 'sw_large_window_bot'
    length = feet(5)
    height = feet(3)
    window = Window(name, height=height, length=length)
    scene.objects.link(window.object)
    bpy.ops.object.select_all(action='DESELECT')
    window.object.select = True
    window.object.data.materials.append(mat_windows)
    bpy.context.scene.objects.active = window.object
    bpy.context.object.active_material.diffuse_color = (1, 1, 1)
    bpy.ops.transform.translate(value=(feet(10), HOUSE_Y_OFFSET - 3, feet(3)))
    bpy.ops.transform.rotate(value=pi/2, axis=(False, False, True))
    bpy.context.scene.objects.active = None


    name = 'se_large_window_top'
    window_y_offset = HOUSE_Y_OFFSET - 3
    length = feet(5)
    height = feet(3)
    window = Window(name, height=height, length=length)
    scene.objects.link(window.object)
    bpy.ops.object.select_all(action='DESELECT')
    window.object.select = True
    window.object.data.materials.append(mat_windows)
    bpy.context.scene.objects.active = window.object
    bpy.context.object.active_material.diffuse_color = (1, 1, 1)
    bpy.ops.transform.translate(value=(SOUTH_LENGTH - feet(3.25), window_y_offset, DECK_HEIGHT + feet(3)))
    bpy.ops.transform.rotate(value=pi/2, axis=(False, False, True))
    bpy.context.scene.objects.active = None
Exemplo n.º 9
0
import bpy, os, pdb, sys
from mathutils import Vector

from lumber_yard.accessaries import Table
from lumber_yard.decking import Decking, Stairs
from lumber_yard.doors import Door, Window
from lumber_yard.utils import feet



COLOR_SADDLE = (107.0/255, 78.0/255, 19.0/255)
COLOR_HOUSE = (163.0/255, 94.0/255, 26.0/255)
COLOR_ROOF = (15.0/255, 80.0/255, 10.0/255)

HOUSE_Y_OFFSET = feet(60)
WALL_HEIGHT = feet(20)
SOUTH_LENGTH = feet(40)
WEST_LENGTH = feet(27.8)


DECK_COLOR = COLOR_SADDLE
DECK_HEIGHT = feet(12)
DECK_LENGTH = feet(12.25)
CURRENT_DECK_WIDTH = feet(19)
CURRENT_DECK_Y_OFFSET = HOUSE_Y_OFFSET + feet(3)

DECK_WIDTH = CURRENT_DECK_WIDTH + feet(9)
DECK_Y_OFFSET = HOUSE_Y_OFFSET - feet(6)
DECK_X_OFFSET = feet(40) + DECK_LENGTH
Exemplo n.º 10
0
def create_trees(scene, anchor):
    location = anchor
    trunk_radius = 12
    trunk_height = feet(25)
    canopy_radius = feet(3)
    canopy_depth = feet(20)
    canopy_height = feet(30)
    create_tree(location, 'tree_1', trunk_radius, trunk_height, canopy_radius,
                canopy_depth, canopy_height)

    location = (anchor[0] - feet(5), anchor[1] + feet(5), anchor[2])
    trunk_radius = 12
    trunk_height = feet(25)
    canopy_radius = feet(3)
    canopy_depth = feet(20)
    canopy_height = feet(30)
    create_tree(location, 'tree_2', trunk_radius, trunk_height, canopy_radius,
                canopy_depth, canopy_height)

    trunk_radius = 16
    location = (anchor[0] + feet(34), anchor[1], anchor[2])
    trunk_height = feet(25)
    canopy_radius = feet(3)
    canopy_depth = feet(20)
    canopy_height = feet(30)
    create_tree(location, 'tree_3', trunk_radius, trunk_height, canopy_radius,
                canopy_depth, canopy_height)

    trunk_radius = 10
    location = (anchor[0] + feet(46), anchor[1] + feet(22.5), anchor[2])
    trunk_height = feet(25)
    canopy_radius = feet(3)
    canopy_depth = feet(20)
    canopy_height = feet(30)
    create_tree(location, 'tree_4', trunk_radius, trunk_height, canopy_radius,
                canopy_depth, canopy_height)
def create_berm_posts(scene, TREE_LOCATION):

    backstop_x = 18.5
    tree_y_offset = TREE_LOCATION[1]
    tree_x_offset = TREE_LOCATION[0]

    back_tree_y_offset = feet(10)
    berm_posts = [((backstop_x, back_tree_y_offset + feet(5), -feet(3)),
                   (radians(90), 0, 0)),
                  ((backstop_x, back_tree_y_offset + feet(9), -feet(3)),
                   (radians(90), 0, 0)),
                  ((backstop_x, back_tree_y_offset + feet(15), -feet(3)),
                   (radians(90), 0, 0)),
                  ((backstop_x + feet(6), back_tree_y_offset + feet(19),
                    -feet(3)), (radians(90), 0, 0))]

    height = feet(10)
    boards = []
    label = 'berm_post'
    for post in berm_posts:
        location = post[0]
        rotation = post[1]
        board = FourBySix(label, height, location, rotation=rotation)
        boards.append(board.object)
        scene.objects.link(board.object)

    bpy.ops.object.select_all(action='DESELECT')
    objects = bpy.context.scene.objects
    for obj in objects:
        obj_label = obj.get('label', None)
        if obj_label and obj_label == label:
            print("Selecting {0}".format(label))
            obj.select = True
            # obj.data.materials.append(mat_doors)
            bpy.context.scene.objects.active = obj

    bpy.ops.object.join()
def create_table_tops(scene, anchor):

    print("Create_table_tops")

    y_offset = anchor[1] + feet(10)
    x_offset = anchor[0] + feet(12)
    return_x_offset = anchor[0] + feet(8)
    return_y_offset = anchor[1] + feet(21)

    rotation = (0, 0, radians(8))
    locations = [
        ('table_b1', (anchor[0] + x_offset, y_offset - feet(5), 0), rotation),
        ('table_b2', (anchor[0] + x_offset + feet(18), y_offset - feet(2.5),
                      0), rotation),
        ('table_b3', (anchor[0] + x_offset + feet(36), y_offset - feet(0), 0),
         rotation),
        ('table_b4', (anchor[0] + return_x_offset, return_y_offset, 0),
         rotation),
        ('table_b5', (anchor[0] + return_x_offset + feet(18),
                      return_y_offset + feet(3), 0), (0, 0, 0)),
        # ('table_b6', (anchor[0] + x_offset + feet(36), return_y_offset + feet(2), 0), (0, 0, 0))
    ]

    total_length = feet(10)
    top_length = feet(4)
    width = feet(4)
    height = feet(4)
    for location in locations:
        obj = create_table_top(location[0],
                               total_length,
                               top_length,
                               width,
                               height,
                               location[1],
                               rotation=location[2])
        scene.objects.link(obj)
        bpy.context.scene.objects.active = obj
        obj.data.materials.append(mat_dirt)
        bpy.context.object.active_material.diffuse_color = (0.5, 0.3, 0)