Exemple #1
0
def createPlugs():
    windows.clear()
    windowNumber = 0
    for row in range(0, SQUARE_ROWS):
        for column in range(0, SQUARE_COLUMNS):
            createSquare(
                SQUARE_ANGLE1 + (SQUARE_ANGLE2 - SQUARE_ANGLE1) * column /
                (SQUARE_COLUMNS - 1),
                SQUARE_Z1 + (SQUARE_Z2 - SQUARE_Z1) * row / (SQUARE_ROWS - 1),
                windowNumber)
            windowNumber += 1

    for row in range(0, TRI_ROWS):
        #for row in range(0, 1):
        for column in range(0, TRI_COLUMNS):
            #for column in range(1, 2):
            # inset the front row
            if row < TRI_ROWS - 1 or \
                (column > 0 and column < TRI_COLUMNS - 1):
                xRotate = 0
                if (column % 2) == 0:
                    xRotate = bfs.toRad(180)
                createTriangle(
                    TRI_ANGLE1 + (TRI_ANGLE2 - TRI_ANGLE1) * column /
                    (TRI_COLUMNS - 1),
                    TRI_Z1 + (TRI_Z2 - TRI_Z1) * row / (TRI_ROWS - 1),
                    windowNumber, xRotate, row, column)
                windowNumber += 1
Exemple #2
0
booster = bfs.selectByName("booster5")
booster.hide = True

bpy.ops.object.duplicate()
bpy.context.scene.objects.active = bfs.getSelected()[0]
bpy.context.scene.objects.active.hide = False
bpy.context.scene.objects.active.name = 'booster'
booster = bpy.context.scene.objects.active

xPlug = bfs.findObject('x plug')
x1 = bfs.cookieCut(booster, xPlug, "x1", "BMESH")

bfs.selectActivate(xPlug)
xPlug.location.x *= -1
# rotation applies the location change to matrix_world
bpy.ops.transform.rotate(value=bfs.toRad(180), axis=(0.0, 0.0, 1.0))

x2 = bfs.cookieCut(booster, xPlug, "x2", "BMESH")

bfs.selectActivate(xPlug)
bpy.ops.transform.rotate(value=bfs.toRad(180), axis=(0.0, 0.0, 1.0))
xPlug.location.x *= -1

spacePlug = bfs.findObject('space plug')
space1 = bfs.cookieCut(booster, spacePlug, "space1", "BMESH")

bfs.selectActivate(spacePlug)
bpy.ops.transform.translate(value=(-9.0, 0.0, 0.0))
space2 = bfs.cookieCut(booster, spacePlug, "space2", "BMESH")
bfs.selectActivate(spacePlug)
bpy.ops.transform.translate(value=(9.0, 0.0, 0.0))
Exemple #3
0
bpy.context.scene.objects.active.data.use_auto_smooth = True
bpy.context.scene.objects.active.data.show_double_sided = True
top_fuse = bpy.context.scene.objects.active

print("Creating windows")
windows.createWindows()

# create canard

obj = bfs.duplicateByName("canard2", "canard1")
bpy.ops.transform.mirror(constraint_axis=(False, True, False),
                         constraint_orientation='GLOBAL')
bpy.ops.transform.translate(value=(0.0, 3.43207 * 2, 0.0))

obj = bfs.duplicateByName("canard flange2", "canard flange1")
bpy.ops.transform.rotate(value=bfs.toRad(-18.1), axis=(1.0, 0.0, 0.0))
bpy.ops.transform.mirror(constraint_axis=(False, True, False),
                         constraint_orientation='GLOBAL')
bpy.ops.transform.rotate(value=bfs.toRad(-18.1), axis=(1.0, 0.0, 0.0))

# create wings
obj = bfs.duplicateByName("wing base3", "wing base2")
obj.hide = False
r = obj.matrix_world[0][3]
bpy.ops.transform.rotate(value=bfs.toRad(-120.0), axis=(0.0, 0.0, 1.0))
bpy.ops.transform.translate(value=(-r + r * math.cos(bfs.toRad(-120)),
                                   r * math.sin(bfs.toRad(-120)), 0.0))

obj = bfs.duplicateByName("wing base4", "wing base2")
obj.hide = False
r = obj.matrix_world[0][3]
Exemple #4
0
def createTriangle(angle, z, number, xRotate, row, column):
    if (row % 2) == 1:
        if xRotate > bfs.toRad(90):
            xRotate = 0
        else:
            xRotate = bfs.toRad(180)

    obj = makeCube(angle, z, TRI_RADIUS, number, xRotate)
    obj.scale = [TRI_DEPTH, TRI_W, TRI_H]

    # now define some edges
    bm = bfs.edit(obj)

    i = 0
    topRight = None
    topLeft = None
    bottomLeft = None
    bottomRight = None
    for edge in bm.edges:
        #print (str(edge.verts[0].co.x - edge.verts[1].co.x))
        if abs(edge.verts[0].co.x - edge.verts[1].co.x) > 0.5:
            i += 1
            if i == 1:
                bottomRight = edge
            if i == 2:
                topRight = edge
            if i == 3:
                bottomLeft = edge
            if i == 4:
                topLeft = edge

    # delete an edge
    topLeft.verts[0].select = True
    topLeft.verts[1].select = True
    bpy.ops.mesh.delete(type='VERT')
    bottomLeft.select = True
    topRight.select = True
    # make a new face
    bpy.ops.mesh.edge_face_add()
    # move the remaneing edge
    topRight.verts[0].co.y = 0
    topRight.verts[1].co.y = 0

    # narrow the bottom face
    bpy.ops.mesh.select_all(action='DESELECT')
    bottomRightVert = bottomRight.verts[1]
    bottomLeftVert = bottomLeft.verts[0]
    newW = TRI_W * (TRI_RADIUS - TRI_DEPTH / 2) / (TRI_RADIUS + TRI_DEPTH / 2)
    bottomRightVert.select = True
    bottomLeftVert.select = True
    bottomRightVert.co.y = newW / 2
    bottomLeftVert.co.y = -newW / 2

    # chop side windows in half
    if (row % 2) == 1:
        if column == 0:
            bottomLeft.verts[1].co.y = 0
            bottomLeft.verts[0].co.y = 0
        elif column == TRI_COLUMNS - 1:
            bottomRight.verts[1].co.y = 0
            bottomRight.verts[0].co.y = 0
    else:
        if column == 0:
            bottomRight.verts[1].co.y = 0
            bottomRight.verts[0].co.y = 0
        elif column == TRI_COLUMNS - 1:
            bottomLeft.verts[1].co.y = 0
            bottomLeft.verts[0].co.y = 0

    # subdivide
    bpy.ops.mesh.loopcut_slide(
        calculateOverride(),
        MESH_OT_loopcut={
            "number_cuts": 5,
            "smoothness": 0,
            "falloff": 'SMOOTH',  # Was 'INVERSE_SQUARE' that does not exist
            "edge_index": 2,
            "mesh_select_mode_init": (True, False, False)
        },
        TRANSFORM_OT_edge_slide={
            "value": 0,
            "mirror": False,
            "snap": False,
            "snap_target": 'CLOSEST',
            "snap_point": (0, 0, 0),
            "snap_align": False,
            "snap_normal": (0, 0, 0),
            "correct_uv": False,
            "release_confirm": False
        })

    bm.free()
    bpy.ops.object.mode_set(mode='OBJECT')
Exemple #5
0
# blender script to create big f*****g windows

import bpy, bmesh
import importlib
import bfs
importlib.reload(bfs)

# outer coordinates of the triangle windows
Z1 = 45.0
Z2 = 49.0
RADIUS1 = 3.2
RADIUS2 = 1.36125

# coordinates of the square centers
SQUARE_ANGLE1 = bfs.toRad(-70.0)
SQUARE_ANGLE2 = bfs.toRad(70.0)
SQUARE_Z1 = 36
SQUARE_Z2 = 44
SQUARE_RADIUS = 4
SQUARE_DEPTH = 1.5
SQUARE_ROWS = 6
SQUARE_COLUMNS = 8

SQUARE_W = .5
SQUARE_H = .5
PREFIX = "window_"

# limit of the boolean
TRI_W = 1.26
TRI_H = .7
TRI_RADIUS = 2.25