Beispiel #1
0
 def stackTower():
     spacer = aecSpacer()
     levels = randint(5, 70)
     floor = randomFloor(aecPoint(0, 0, 0))
     if not floor: return
     height = floor.height
     floors = [floor] + spacer.stack(floor, levels - 1)
     if uniform(1, 3) == 1:
         plinth = aecSpace()
         plinthLevels = randint(1, 3)
         plinthHeight = height * plinthLevels
         plinth.wrap(floor.points_floor)
         plinth.height = plinthHeight
         pScale = uniform(1, 2)
         plinth.scale(pScale, pScale, 1)
         floors = floors[plinthLevels:]
         floors = [plinth] + floors
     colors = [aecColor.blue, aecColor.green]
     tower = aecSpaceGroup()
     tower.spaces = floors
     tower.setColor(colors[randint(0, 1)])
     tower.rotate(uniform(0, 360))
     if levels >= 10:
         index = 10
         while index < levels:
             tower.scale(0.8, 0.8, 1, index=index)
             index += 1
     if levels >= 30:
         index = 30
         while index < levels:
             tower.scale(0.8, 0.8, 1, index=index)
             index += 1
     return tower.spaces
def makeShelfDouble(rotation: float, color: int, moveBy: List[float]):
    components = aecSpaceGroup();
    base = aecSpace();
    length = 200
    base.boundary = shaper.makeBox(aecPoint(), 100, length)
    base.height = 25
    divider = aecSpace();
    divider.boundary = shaper.makeBox(aecPoint(), 4, length - 10)
    divider.height = 125
    divider.moveTo(fromPnt = aecPoint(), toPnt = aecPoint(48, 5, 25))
    lowShelfFront = aecSpace();
    lowShelfFront.boundary = shaper.makeBox(aecPoint(), 43, length - 10)
    lowShelfFront.height = 2                     
    lowShelfFront.moveTo(fromPnt = aecPoint(), toPnt = aecPoint(52, 5, 65))
    lowShelfBack = spacer.copy(lowShelfFront)
    lowShelfBack.mirror([aecPoint(50, 0), aecPoint(50, 500)])
    highShelfFront = spacer.copy(lowShelfFront, z = 40)
    highShelfBack = spacer.copy(lowShelfBack, z = 40)
    components.add([base, divider, lowShelfFront, lowShelfBack, highShelfFront, highShelfBack])
    components.moveBy(moveBy[0], moveBy[1])
    components.rotate(uniform(0, rotation), base.center_floor)
    color = getColor(color)
    for component in components.spaces:
        mesh = component.mesh_graphic
        model.add_triangle_mesh(mesh.vertices, mesh.normals, mesh.indices, color)    
def siteDevelopment(diameter: float = 100, targetArea: float = 100000):
    spacer = aecSpacer()        
    sitWest = aecSpace()
    sitEast = aecSpace()
    sitWest.boundary = siteWest
    sitEast.boundary = siteEast
    sitWest.height = 20    
    sitWest.level = -20
    sitEast.height = 20   
    sitEast.level = -20
    mesh = sitWest.mesh_graphic
    model.add_triangle_mesh(mesh.vertices, mesh.normals, mesh.indices, colorSand)  
    mesh = sitEast.mesh_graphic
    model.add_triangle_mesh(mesh.vertices, mesh.normals, mesh.indices, colorSand)      
    spcGroup = aecSpaceGroup()
    allLevels = 0
    area = 0
    for building in buildings:
        if randint(0, 1) == 0 : site = sitWest
        else: site = sitEast
        boundary = site.points_floor
        point = site.point_ceiling
        xSize = diameter * uniform(1, 3)
        ySize = diameter * uniform(1, 3)
        targetArea = uniform((targetArea - 20000), (targetArea + 20000))        
        space = None
        while not space:
            space = makeSpace(building, point, xSize, ySize)
            if not space.fitWithin(boundary): 
                point = site.point_ceiling
                space = None
        space.height = 15
        build = [space] + spacer.stackToArea(space, targetArea)
        spcGroup.clear()
        spcGroup.add(build)
        levels = spcGroup.count
        allLevels += levels
        area += spcGroup.area
        if building['name'] != 'parking':
            if levels >= 10:
                index = 10
                while index < levels:
                    spcGroup.scale(0.8, 0.8, 1, index = index)
                    index += 1
            if levels >= 20:
                index = 20
                while index < levels:
                    spcGroup.scale(0.8, 0.8, 1, index = index)
                    index += 1                   
            if levels >= 30:
                index = 30
                while index < levels:
                    spcGroup.scale(0.8, 0.8, 1, index = index)
                    index += 1      
        build = spcGroup.spaces
        color = building['color']
        for space in build:
            mesh = space.mesh_graphic
            model.add_triangle_mesh(mesh.vertices, mesh.normals, mesh.indices, color)                  
    return {"model": model.save_base64(), 'computed':{'floors':allLevels, 'area':area}}   
Beispiel #4
0
def makeSpaceTower(stories: int = 5, mostRooms: int = 4):
    x = 0
    y = 0
    z = 0
    rows = 1
    columns = 1
    spaces = []
    vector = [0, 0, 0]
    xOffset = 100000
    yOffset = 90000
    zOffset = 3500
    
    while y < rows:
        while x < columns:
            rotate = 0
            while z < stories:
                spcGroup = aecSpaceGroup()
                offset = 0            
                if z == 0: 
                    southRooms = 0
                    zOffset = 10000
                else:
                    zOffset = 3500
                    southRooms = randint(1, 2)
                shell = makeFloor(offset = offset,
                                  rotation = rotate,
                                  roomsSouth = southRooms, 
                                  roomsEast = randint(1, mostRooms), 
                                  roomsNorth = 1, 
                                  roomsWest= randint(1, mostRooms),
                                  roomsNorthSize = randint(8000, 15000),
                                  roomsSouthSize = randint(8000, 15000))
                spcGroup.add([shell.corridor.space])
                spcGroup.add(shell.rooms.spaces)                  
                spcGroup.moveBy(vector[0], vector[1], vector[2])
                vector[2] += zOffset
                spaces += spcGroup.spaces               
                z += 1        
            z = 0
            x += 1
            vector[2] = 0
            vector[0] += xOffset      
        x = 0
        vector[0] = 0
        vector[2] = 0
        vector[1] += yOffset
        y += 1
        xCoord = 10000
        yCoord = 70000
        point = aecPoint(xCoord, yCoord, 0)
        core = aecSpace()
        shaper = aecShaper()
        core.boundary = shaper.makeBox(point, 10000, 10000)
        core.height = ((stories - 1) * 3500) + 15000
        core.color = aecColor.granite
        core.name = 'Shaft'
        spaces += [core]
        return spaces
Beispiel #5
0
 def __init__(self):
     self.__corridor = aecCorridor()
     self.__floor = aecSpace()
     self.__rooms = aecSpaceGroup()
     points = self.__shaper.makeBox(xSize=15000, ySize=10000)
     if points:
         self.__floor.boundary = points
         self.__floor.height = 4000
         self.__floor.level = 0.0
         self.__corridor.space.height = 4000
Beispiel #6
0
def develop():
    spacer = aecSpacer()
    sitWest = aecSpace()
    sitEast = aecSpace()
    sitWest.boundary = siteWest
    sitEast.boundary = siteEast
    sitWest.color = aecColor.sand
    sitEast.color = aecColor.sand
    spaces = [sitWest, sitEast]
    spcGroup = aecSpaceGroup()
    for building in buildings:
        if randint(0, 1) == 0: site = sitWest
        else: site = sitEast
        boundary = site.points_floor
        point = site.point_ceiling
        xWidth = randint(building['diameter'][0], building['diameter'][1])
        yDepth = randint(building['diameter'][0], building['diameter'][1])
        space = None
        while not space:
            space = makeSpace(building, point, xWidth, yDepth)
            if not space.fitWithin(boundary):
                point = site.point_ceiling
                space = None
        space.height = building['height']
        space.level = building['level']
        space.color = building['color']
        area = randint(building['area'][0], building['area'][1])
        if building['name'] == 'parking':
            build = [space] + spacer.stackToArea(space, area)
        else:
            build = [space] + spacer.stackToArea(space, area)
        spcGroup.clear()
        spcGroup.add(build)
        levels = spcGroup.count
        if building['name'] != 'parking':
            if levels >= 10:
                index = 10
                while index < levels:
                    spcGroup.scale(0.8, 0.8, 1, index=index)
                    index += 1
            if levels >= 20:
                index = 20
                while index < levels:
                    spcGroup.scale(0.8, 0.8, 1, index=index)
                    index += 1
            if levels >= 30:
                index = 30
                while index < levels:
                    spcGroup.scale(0.8, 0.8, 1, index=index)
                    index += 1
        build = spcGroup.spaces
        spaces += build
    return spaces
Beispiel #7
0
def makeRackRound():
    components = aecSpaceGroup()
    base = aecSpace()
    base.boundary = shaper.makeCylinder(radius=40)
    base.height = 5
    support = aecSpace()
    support.boundary = shaper.makeCylinder(radius=5)
    support.height = 125
    support.moveBy(0, 0, 5)
    top = aecSpace()
    top.boundary = shaper.makeCylinder(radius=50)
    top.height = 3
    top.moveBy(0, 0, 130)
    components.add([base, support, top])
    components.setColor(aecColor.sand)
    return components
Beispiel #8
0
def makeShelfSingle(length=200):
    components = aecSpaceGroup()
    base = aecSpace()
    base.boundary = shaper.makeBox(aecPoint(), 50, length)
    base.height = 25
    divider = aecSpace()
    divider.boundary = shaper.makeBox(aecPoint(), 4, length - 10)
    divider.height = 125
    divider.moveTo(fromPnt=aecPoint(), toPnt=aecPoint(0, 5, 25))
    lowShelfFront = aecSpace()
    lowShelfFront.boundary = shaper.makeBox(aecPoint(), 43, length - 10)
    lowShelfFront.height = 2
    lowShelfFront.moveTo(fromPnt=aecPoint(), toPnt=aecPoint(4, 5, 65))
    highShelfFront = spacer.copy(lowShelfFront, 0, 0, 40)
    components.add([base, divider, lowShelfFront, highShelfFront])
    components.rotate(uniform(0, 360), base.center_floor)
    components.setColor(aecColor.sand)
    return components
Beispiel #9
0
def makeCheckOut():
    components = aecSpaceGroup()
    base = aecSpace()
    base.boundary = shaper.makeBox(aecPoint(), 75, 150)
    base.height = 100
    top = aecSpace()
    top.boundary = shaper.makeU(aecPoint(),
                                xSize=170,
                                ySize=80,
                                xWidth1=20,
                                xWidth2=20,
                                yDepth=20)
    top.height = 30
    top.rotate(90)
    top.moveBy(-25, 50, 100)

    components.add([base, top])
    components.setColor(aecColor.sand)
    return components
def makeRackRound(color: int, moveBy: List[float]):
    components = aecSpaceGroup();
    base = aecSpace();
    base.boundary = shaper.makeCylinder(radius = 40)
    base.height = 5
    support = aecSpace();
    support.boundary = shaper.makeCylinder(radius = 5)
    support.height = 125
    support.moveBy(0, 0, 5)
    top = aecSpace();
    top.boundary = shaper.makeCylinder(radius = 50)
    top.height = 3
    top.moveBy(0, 0, 130)
    components.add([base, support, top])
    components.moveBy(moveBy[0], moveBy[1])
    color = getColor(color)
    for component in components.spaces:
        mesh = component.mesh_graphic
        model.add_triangle_mesh(mesh.vertices, mesh.normals, mesh.indices, color)
def makeRackCross(rotation: float, moveBy: List[float]):
    components = aecSpaceGroup();
    base = aecSpace();
    base.boundary = shaper.makeCylinder(aecPoint(), radius = 40)
    base.height = 5
    support = aecSpace()
    support.boundary = shaper.makeCylinder(aecPoint(), radius = 5)
    support.height = 157
    support.moveBy(0, 0, 5)
    top = aecSpace();
    top.boundary = shaper.makeCross(aecPoint(-50, -50), 100, 100, xWidth = 10 , yDepth = 10)
    top.height = 4
    top.moveBy(0, 0, 162)
    components.add([base, support, top])
    components.moveBy(moveBy[0], moveBy[1], moveBy[2])
    components.rotate(uniform(0, rotation), base.center_floor)
    for component in components.spaces:
        mesh = component.mesh_graphic
        model.add_triangle_mesh(mesh.vertices, mesh.normals, mesh.indices, colorSilver)
Beispiel #12
0
def makeShelfTiered(length=150):
    components = aecSpaceGroup()
    lowShelf = aecSpace()
    lowShelf.boundary = shaper.makeBox(aecPoint(), 100, length)
    lowShelf.height = 3
    lowShelf.moveBy(z=27)
    midShelf = spacer.copy(lowShelf, z=30)
    midShelf.scale(0.75, 0.75, 1)
    topShelf = spacer.copy(midShelf, z=30)
    topShelf.scale(0.75, 0.75, 1)
    base = spacer.copy(lowShelf, z=-27)
    base.scale(0.75, 0.75, 9)
    support1 = spacer.copy(base, z=30)
    support1.scale(0.25, 0.5, 1)
    support1.height = 27
    support2 = spacer.copy(support1, z=30)
    components.add([base, lowShelf, midShelf, topShelf, support1, support2])
    components.rotate(uniform(0, 360), base.center_floor)
    components.setColor(aecColor.sand)
    return components
def makeCheckOut(color: int = 0):
    components = aecSpaceGroup();
    base = aecSpace();
    base.boundary = shaper.makeBox(aecPoint(), 75, 150)
    base.height = 100
    top = aecSpace();
    top.boundary = shaper.makeU(aecPoint(), 
                                xSize = 170, 
                                ySize = 80, 
                                xWidth1 = 20, 
                                xWidth2 = 20, 
                                yDepth = 20)
    top.height = 30
    top.rotate(90)
    top.moveBy(-25, 50, 100)
    components.add([base, top])
    components.moveBy(70, 70)
    color = colorBrown
    for component in components.spaces:
        mesh = component.mesh_graphic
        model.add_triangle_mesh(mesh.vertices, mesh.normals, mesh.indices, color)
Beispiel #14
0
def makeRackCross():
    components = aecSpaceGroup()
    base = aecSpace()
    base.boundary = shaper.makeCylinder(aecPoint(), radius=40)
    base.height = 5
    support = aecSpace()
    support.boundary = shaper.makeCylinder(aecPoint(), radius=5)
    support.height = 157
    support.moveBy(0, 0, 5)
    top = aecSpace()
    top.boundary = shaper.makeCross(aecPoint(-50, -50),
                                    100,
                                    100,
                                    xWidth=10,
                                    yDepth=10)
    top.height = 4
    top.moveBy(0, 0, 162)
    components.add([base, support, top])
    components.rotate(uniform(0, 360), base.center_floor)
    components.setColor(aecColor.sand)
    return components
def makeShelfTiered(rotation: float, color: int, moveBy: List[float]):
    components = aecSpaceGroup();
    lowShelf = aecSpace();  
    lowShelf.boundary = shaper.makeBox(aecPoint(), 100, 150)
    lowShelf.height = 3
    lowShelf.moveBy(z = 27)
    midShelf = spacer.copy(lowShelf, z = 30)
    midShelf.scale(0.75, 0.75, 1)
    topShelf = spacer.copy(midShelf, z = 30)
    topShelf.scale(0.75, 0.75, 1)   
    base = spacer.copy(lowShelf, z = -27)
    base.scale(0.75, 0.75, 9)
    support1 = spacer.copy(base, z = 30)
    support1.scale(0.25, 0.5, 1)
    support1.height = 27
    support2 = spacer.copy(support1, z = 30)
    components.add([base, lowShelf, midShelf, topShelf, support1, support2])
    components.moveBy(moveBy[0], moveBy[1])
    components.rotate(uniform(0, rotation), base.center_floor)
    color = getColor(color)
    for component in components.spaces:
        mesh = component.mesh_graphic
        model.add_triangle_mesh(mesh.vertices, mesh.normals, mesh.indices, color)  
Beispiel #16
0
def makeShelfDouble(length=200):
    components = aecSpaceGroup()
    base = aecSpace()
    base.boundary = shaper.makeBox(aecPoint(), 100, length)
    base.height = 25
    divider = aecSpace()
    divider.boundary = shaper.makeBox(aecPoint(), 4, length - 10)
    divider.height = 125
    divider.moveTo(fromPnt=aecPoint(), toPnt=aecPoint(48, 5, 25))
    lowShelfFront = aecSpace()
    lowShelfFront.boundary = shaper.makeBox(aecPoint(), 43, length - 10)
    lowShelfFront.height = 2
    lowShelfFront.moveTo(fromPnt=aecPoint(), toPnt=aecPoint(52, 5, 65))
    lowShelfBack = spacer.copy(lowShelfFront)
    lowShelfBack.mirror([aecPoint(50, 0), aecPoint(50, 500)])
    highShelfFront = spacer.copy(lowShelfFront, z=40)
    highShelfBack = spacer.copy(lowShelfBack, z=40)
    components.add([
        base, divider, lowShelfFront, lowShelfBack, highShelfFront,
        highShelfBack
    ])
    components.rotate(uniform(0, 360), base.center_floor)
    components.setColor(aecColor.sand)
    return components
# Import the classes we'll need.

from aecSpace.aecColor import aecColor
from aecSpace.aecPoint import aecPoint
from aecSpace.aecSpace import aecSpace
from aecSpace.aecSpacer import aecSpacer
from aecSpace.aecSpaceGroup import aecSpaceGroup
from aecSpace.aecSpaceDrawOCC import aecSpaceDrawOCC

# Create class instances.

colors = aecColor()
space = aecSpace()
spacer = aecSpacer()
spaces = aecSpaceGroup()
spaceDrawer = aecSpaceDrawOCC()

# Create a rectangular aecSpace at the origin.

space.points_floor = [
    aecPoint(0, 0),
    aecPoint(20, 0),
    aecPoint(30, 30),
    aecPoint(20, 50),
    aecPoint(0, 50)
]
space.height = 5

# Create copies of the initial aecSpace and arrange them in a row.
Beispiel #18
0
def makeTowerShell(xSize: float = 60,
                   ySize: float = 60,
                   levels: int = 10,
                   floorType: int = 1):
    def randomFloor(point, xSize, ySize):
        try:
            floor = aecSpace()
            shaper = aecShaper()
            if floorType == 1:
                floor.boundary = shaper.makeBox(point, xSize, ySize)
                floor.rotate(uniform(0, 360))
                x = 0
                boundaries = uniform(1, 5)
                tempFloor = aecSpace()
                while x < boundaries:
                    tempFloor.boundary = shaper.makeBox(origin=point,
                                                        xSize=uniform(65, 100),
                                                        ySize=uniform(65, 100))
                    tempFloor.rotate(uniform(0, 360))
                    floor.add(tempFloor.points_floor)
                    x += 1
            if floorType == 2:
                floor.boundary = shaper.makeCylinder(aecPoint(
                    point.x + (xSize * 0.5), point.y + (ySize * 0.5)),
                                                     radius=(xSize * 0.5))
            if floorType > 2 and floorType < 9:
                floor.boundary = shaper.makePolygon(aecPoint(
                    point.x + (xSize * 0.5), point.y + (ySize * 0.5)),
                                                    radius=(xSize * 0.5),
                                                    sides=floorType)
            if floorType == 9:
                floor.boundary = shaper.makeCross(point,
                                                  xSize=xSize,
                                                  ySize=ySize)
            if floorType == 10:
                floor.boundary = shaper.makeH(point, xSize=xSize, ySize=ySize)
            if floorType == 11:
                floor.boundary = shaper.makeU(point, xSize=xSize, ySize=ySize)
            floor.height = 15
            return floor
        except:
            return False

    spacer = aecSpacer()
    floor = randomFloor(aecPoint(0, 0, 0), xSize, ySize)
    floors = [floor] + spacer.stack(floor, levels - 1)
    if uniform(1, 3) == 1:
        plinth = aecSpace()
        plinthLevels = randint(1, 3)
        plinthHeight = 15 * plinthLevels
        plinth.wrap(floor.points_floor)
        plinth.height = plinthHeight
        plinth.scale(1.25, 1.25, 1)
        floors = floors[plinthLevels:]
        floors = [plinth] + floors
    colors = [aecColor.blue, aecColor.green, aecColor.white]
    tower = aecSpaceGroup()
    tower.spaces = floors
    tower.setColor(colors[randint(0, 2)])
    if levels >= 10:
        index = 10
        while index < levels:
            tower.scale(0.8, 0.8, 1, index=index)
            index += 1
    if levels >= 30:
        index = 30
        while index < levels:
            tower.scale(0.8, 0.8, 1, index=index)
            index += 1

    model = glTF()
    colorBlue = model.add_material(0.0, 0.631, 0.945, 0.5, 0.8, "Blue")
    colorWhite = model.add_material(1.0, 1.0, 1.0, 0.5, 0.8, "White")
    colorIndex = randint(0, 1)
    if colorIndex == 0: color = colorBlue
    if colorIndex == 1: color = colorWhite
    area = 0
    for space in floors:
        area += space.area
        spaceMesh = space.mesh_graphic
        model.add_triangle_mesh(spaceMesh.vertices, spaceMesh.normals,
                                spaceMesh.indices, color)
    return {
        "model": model.save_base64(),
        'computed': {
            'floors': levels,
            'area': area
        }
    }
Beispiel #19
0
                    index += 1
            if levels >= 30:
                index = 30
                while index < levels:
                    spcGroup.scale(0.8, 0.8, 1, index=index)
                    index += 1
        build = spcGroup.spaces
        spaces += build
    return spaces


x = 0
y = 0
spaces = []
vector = (-2000, 0, 0)
while y < 4:
    while x < 4:
        spcGroup = aecSpaceGroup()
        spcGroup.add(develop())
        vector = (vector[0] + 2000, vector[1], 0)
        spcGroup.moveBy(vector[0], vector[1], vector[2])
        spaces += spcGroup.spaces
        x += 1
    vector = (-2000, vector[1] + 2000, 0)
    x = 0
    y += 1
spaceDrawer = aecSpaceDrawOCC()
spaceDrawer.draw3D(spaces, displaySize=(1600, 900), update=True)
# update = True animates the example by updating the display after every space placement.
# About 60x slower to completion, but more interesting to watch.