def placeBuilding():
    spacer = aecSpacer()  
    shaper = aecShaper()      
    site = aecSpace()
    sitePoints = siteBoundary["coordinates"]
    sitePoints = [aecPoint(pnt[0], pnt[1], 0) for pnt in sitePoints]
    site.boundary = sitePoints
    site.color = aecColor.green
    site.height = 0.1
    site.level = -0.1
    spaces = [site]
    building = buildings[0]
    xWidth = building['diameter'][random.randint(0, 1)]
    yDepth = xWidth * 1.618
    space = aecSpace()
    space.boundary = shaper.makeCross(origin = aecPoint(0, 0, 0), 
                                      xSize = xWidth, 
                                      ySize = yDepth)
    space.rotate(random.uniform(0, 270))
    orientation = [
                       aecGeometry.NW,
                       aecGeometry.NNW,
                       aecGeometry.NW,
                       aecGeometry.N,
                       aecGeometry.NNE,
                       aecGeometry.NE,
                  ]
    if spacer.placeOnLine(space, site, orientation):
        space.height = building['height']
        space.level= building['level']
        space.color = building['color']
        spaces += [space]
        space2 = spacer.stackToArea(space, building['area'])
        spaces += space2
    return spaces
Esempio n. 2
0
def makeSpace(building, point, xSize, ySize):
    try:
        spcType = randint(building['plan'][0], building['plan'][1])
        space = aecSpace()
        shaper = aecShaper()
        if spcType == 1:
            space.boundary = shaper.makeBox(point, xSize, ySize)
            space.rotate(randint(0, 360))
            x = 0
            boundaries = randint(1, 5)
            tempFloor = aecSpace()
            while x < boundaries:
                if xSize <= ySize:
                    tempFloor.boundary = \
                    shaper.makeBox(point, uniform(xSize, ySize), uniform(xSize, ySize))
                else:
                    tempFloor.boundary = \
                    shaper.makeBox(point, uniform(ySize, xSize), uniform(ySize, xSize))
                tempFloor.rotate(uniform(0, 360))
                space.add(tempFloor.points_floor)
                x += 1
        if spcType == 2:
            space.boundary = shaper.makeCylinder(point, (xSize * 0.5))
        if spcType > 2 and spcType < 9:
            space.boundary = shaper.makePolygon(point, (xSize * 0.5), spcType)
        if spcType == 9: space.boundary = shaper.makeCross(point, xSize, ySize)
        if spcType == 10: space.boundary = shaper.makeH(point, xSize, ySize)
        if spcType == 11: space.boundary = shaper.makeL(point, xSize, ySize)
        if spcType == 12: space.boundary = shaper.makeT(point, xSize, ySize)
        if spcType == 13: space.boundary = shaper.makeU(point, xSize, ySize)
        return space
    except Exception:
        traceback.print_exc()
        return None
Esempio n. 3
0
class aecFloor():
    """
    Represents the spatial configuration of a single floor.
    """

    __shaper = aecShaper()

    __slots__ = \
    [
        '__corridor',
        '__floor',
        '__rooms'
    ]

    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

    @property
    def corridor(self) -> aecSpace:
        """
        Returns the corridor space..
        Returns None on failure.
        """
        try:
            return self.__corridor
        except Exception:
            traceback.print_exc()
            return None

    @property
    def floor(self) -> aecSpace:
        """
        Returns the floor space..
        Returns None on failure.
        """
        try:
            return self.__floor
        except Exception:
            traceback.print_exc()
            return None

    @property
    def rooms(self) -> aecSpaceGroup:
        """
        Returns the spaceGroup containing all the occupiable spaces.
        Returns None on failure.
        """
        try:
            return self.__rooms
        except Exception:
            traceback.print_exc()
            return None
Esempio n. 4
0
 def randomFloor(point):
     try:
         floor = aecSpace()
         shaper = aecShaper()
         floorSizeX = uniform(60, 100)
         floorSizeY = uniform(60, 100)
         floorHeight = uniform(10, 20)
         floorType = randint(1, 11)
         width = uniform(33, 45)
         depth = uniform(33, 45)
         xOffset = uniform(10, 90)
         yOffset = uniform(10, 90)
         if floorType == 1:
             floor.boundary = shaper.makeBox(point, floorSizeX, floorSizeY)
             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 + (floorSizeX * 0.5),
                          point.y + (floorSizeY * 0.5)), (floorSizeX * 0.5))
         if floorType > 2 and floorType < 9:
             floor.boundary = shaper.makePolygon(
                 aecPoint(point.x + (floorSizeX * 0.5),
                          point.y + (floorSizeY * 0.5)), (floorSizeX * 0.5),
                 floorType)
         if floorType == 9:
             floor.boundary = shaper.makeCross(point,
                                               xSize=floorSizeX,
                                               ySize=floorSizeY,
                                               xAxis=xOffset,
                                               yAxis=yOffset)
         if floorType == 10:
             floor.boundary = shaper.makeH(point,
                                           xSize=floorSizeX,
                                           ySize=floorSizeY,
                                           xWidth1=width,
                                           xWidth2=depth,
                                           yDepth=depth)
         if floorType == 11:
             floor.boundary = shaper.makeU(point,
                                           xSize=floorSizeX,
                                           ySize=floorSizeY,
                                           xWidth1=width,
                                           xWidth2=depth,
                                           yDepth=depth)
         floor.rotate(uniform(0, 360))
         floor.height = floorHeight
         return floor
     except:
         return False
Esempio n. 5
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
Esempio n. 6
0
def makeFloor(offset: float = 0.0,
              rotation: float = 0.0,
              roomsSouth: int = 1, 
              roomsEast: int = 2, 
              roomsNorth: int = 1, 
              roomsWest: int = 2,
              roomsNorthSize: float = 12000,
              roomsSouthSize: float = 15000):
    shell = aecFloor()
    floor = shell.floor
    corridor = shell.corridor
    if roomsSouth == 0:
        if randint(0, 1) == 0: roomsNorth = 0
        corridor.persons = 10
    else: corridor.persons = 5
    shaper = aecShaper()
    floorSizeX = 30000
    floorSizeY = 70000
    floor.boundary = shaper.makeBox(aecPoint(), floorSizeX, floorSizeY)
    shell.makeI(offset = offset,
                rotation = rotation,
                roomsWest = roomsWest, 
                roomsEast = roomsEast,
                roomsNorth = roomsNorth,
                roomsNorthSize = roomsNorthSize,
                roomsSouth = roomsSouth, 
                roomsSouthSize = roomsSouthSize)   
    rooms = shell.rooms.spaces
    roomsIndex =len(rooms) - 2
    if roomsIndex > 8:
        join = randint(0, roomsIndex)
        nxtRoom = join + 1
        if rooms[join].add(rooms[nxtRoom].points_floor): del rooms[nxtRoom]
    color = 0
    lastColor = 0
    for room in rooms:
        while color == lastColor: color = randint(1, 6)
        lastColor = color
        room.color = colors[color]
        room.color.alpha = 125
    corridor.space.color = aecColor.green
    floor.height = 7000
    floor.color = aecColor.aqua
    floor.color.alpha = 125
    corridor.space.height = 3500
    shell.rooms.setHeight(3500)    
    if roomsSouth == 0:
        floor.height = 10000
        corridor.space.height = 10000
        shell.rooms.setHeight(10000)
    return shell
Esempio n. 7
0
def makeBuilding(site: aecSpace, length: float, width: float, height: float,
                 rotation: float, area: float):
    spacer = aecSpacer()
    building = aecSpace()
    shaper = aecShaper()
    points = shaper.makeBox(aecPoint(0, 0, 0), xSize=length, ySize=width)
    building.boundary = points
    building.rotate(rotation)
    if spacer.placeWithin(building, site):
        building.level = 0
        building.height = height
        building = [building]
        building += spacer.stackToArea(building[0], area)
    return building
Esempio n. 8
0
def makeDuct(start: aecPoint, end: aecPoint, width: float,
             height: float) -> aecSpace:
    shaper = aecShaper()
    duct = aecSpace()
    length = sqrt(((end.x - start.x)**2) + ((end.y - start.y)**2))
    duct.boundary = shaper.makeBox(aecPoint(0, 0, 0),
                                   xSize=length,
                                   ySize=width)
    midOrigin = aecPoint(0, (width * 0.5), 0)
    duct.moveTo(fromPnt=midOrigin, toPnt=start)
    angle = rad2deg(arctan2(end.y - start.y, end.x - start.x))
    duct.rotate(angle, start)
    duct.moveBy(z=(height * -0.5))
    duct.height = height
    return duct
Esempio n. 9
0
def makeFloor(roomsSouth: int = 1,
              roomsEast: int = 2,
              roomsNorth: int = 1,
              roomsWest: int = 2,
              roomsNorthSize: float = 12000,
              roomsSouthSize: float = 15000):
    height = 3500
    shell = aecFloor()
    floor = shell.floor
    rooms = shell.rooms
    corridor = shell.corridor
    if roomsSouth == 0:
        if randint(0, 1) == 0: roomsNorth = 0
        corridor.persons = 10
    else:
        corridor.persons = 5
    roomsTotal = roomsSouth + roomsEast + roomsNorth + roomsWest
    shaper = aecShaper()
    floorSizeX = 30000
    floorSizeY = 70000
    floor.boundary = shaper.makeBox(aecPoint(), floorSizeX, floorSizeY)
    rooms = corridor.makePolar(floor,
                               roomsWest=roomsWest,
                               roomsEast=roomsEast,
                               roomsNorth=roomsNorth,
                               roomsNorthSize=roomsNorthSize,
                               roomsSouth=roomsSouth,
                               roomsSouthSize=roomsSouthSize)
    corridor.space.height = height
    mesh = corridor.space.mesh_graphic
    model.add_triangle_mesh(mesh.vertices, mesh.normals, mesh.indices,
                            colorGreen)
    #    if roomsTotal > 8:
    #        join = randint(0, roomsTotal - 2)
    #        if rooms[join].add(rooms[join + 1].points_floor): del rooms[join + 1]
    for room in rooms:
        room.height = height
        mesh = room.mesh_graphic
        model.add_triangle_mesh(mesh.vertices, mesh.normals, mesh.indices,
                                getColor(randint(0, 3)))
    return {
        "model": model.save_base64(),
        'computed': {
            'Total rooms': roomsTotal
        }
    }
Esempio n. 10
0
 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
def placeBuilding():
    spacer = aecSpacer()
    shaper = aecShaper()        
    site = aecSpace()
    site.boundary = [aecPoint(pnt[0], pnt[1]) for pnt in siteBoundary["coordinates"]]
    site.color = aecColor.green
    site.height = 0.1
    site.level = -0.1
    spaces = [site]
    building = buildings[0]
    xWidth = building['diameter'][random.randint(0, 1)]
    yDepth = xWidth * 1.618
    space = aecSpace()
    space.boundary = shaper.makeCross(aecPoint(0, 0, 0), xWidth, yDepth)
    space.rotate(random.uniform(0, 360))
    if spacer.placeWithin(space, site):
        space.height = building['height']
        space.level = building['level']
        space.color = building['color']
        spaces += [space]
        space2 = spacer.stackToArea(space, building['area'])
        spaces += space2          
    return spaces
Esempio n. 12
0
class aecCorridor():
    """
    Represents architectural corridors of various configurations.
    """
    __dimensionError = "Critical corridor dimension exceeds floor boundary."
    __minPersons = 3
    __personWidth = 2
    __geometry = aecGeometry()
    __shaper = aecShaper()
    __spacer = aecSpacer()

    # Defines a series of constants indicating corridor types.

    Unknown, H, I, L, T, U, X = range(0, 7)

    __slots__ = \
    [
        '__compass',
        '__corridor',
        '__persons',
        '__shape',
        '__space',
        '__width'
    ]

    def __init__(self,
                 corridor: int = 1,
                 origin: aecPoint = aecPoint(),
                 xSize: float = 5,
                 ySize: float = 5,
                 persons: int = 3):
        """
        Constructor       
        """
        self.__compass = self.__geometry.compass
        self.__corridor = aecSpace()
        self.__persons = self.__minPersons
        self.__shape = self.Unknown
        self.__width = self.__minPersons * self.__personWidth
        if persons > self.__minPersons:
            self.__persons = persons = int(persons)
            persons -= self.__minPersons
            self.__width += (persons * self.__personWidth)
        self.__space = aecSpace()

    @property
    def persons(self) -> int:
        """
        Returns the capacity of the corridor as the quantity of 
        persons who can pass along its length simultaneously.
        Returns None on failure.
        """
        try:
            return self.__persons
        except Exception:
            traceback.print_exc()
            return None

    @persons.setter
    def persons(self, value: int = 3) -> int:
        """
        Sets the capacity of the corridor as the quantity of 
        persons who can pass along its length simultaneously.
        Returns None on failure.
        """
        try:
            value = abs(int(value))
            if value < self.__minPersons: value = self.__minPersons
            self.__persons = value
            if value > self.__minPersons: value -= self.__minPersons
            self.__width += self.__personWidth * value
        except Exception:
            traceback.print_exc()

    @property
    def space(self) -> aecSpace:
        """
        Returns the aecSpace object.
        Returns None on failure.
        """
        try:
            return self.__space
        except Exception:
            traceback.print_exc()
            return None

    @property
    def width(self) -> float:
        """
        Returns the corridor width.
        Returns None on failure.
        """
        try:
            return self.__width
        except Exception:
            traceback.print_exc()
            return None

    def addLobby(self, lobby: aecSpace) -> bool:
        """
        Attempts to join a lobby to the corridor
        """

    def makeH(self,
              floor: aecSpace,
              margin: float = 0.0,
              rotate: float = 0.0) -> bool:
        """
        Sets the corridor to an H shape within the specified
        margin of the delivered floor's bounding box.
        Returns True on success.
        Returns False on Failure.
        """
        try:
            if (self.width * 2) >= floor.size_x or \
                self.width >= floor.size_y:
                raise ValueError
            self.space.height = floor.height - 0.25
            self.space.level = floor.level
            floorBox = floor.points_box
            xPnt = floorBox.SW.x + margin
            yPnt = floorBox.SW.y + margin
            origin = aecPoint(xPnt, yPnt)
            xSize = abs((floorBox.SE.x - margin) - xPnt)
            ySize = abs((floorBox.NW.y - margin) - yPnt)
            points = self.__shaper.makeH(origin=origin,
                                         xSize=xSize,
                                         ySize=ySize,
                                         xWidth1=self.width,
                                         xWidth2=self.width,
                                         yDepth=self.width)
            if not points: raise Exception
            self.__space.boundary = points
            self.space.rotate(rotate)
            return self.space.fitWithin(floor.points_floor)
        except ValueError:
            print(self.__dimensionError)
            return False
        except Exception:
            traceback.print_exc()
            return False

    def makeL(self,
              floor: aecSpace,
              margin: float = 0.0,
              rotate: float = 0.0) -> bool:
        """
        Sets the corridor to an L shape within the specified
        margin of the delivered floor's bounding box.
        Returns True on success.
        Returns False on Failure.
        """
        try:
            if self.width >= floor.size_x or \
               self.width >= floor.size_y:
                raise ValueError
            self.space.height = floor.height - 0.25
            self.space.level = floor.level
            floorBox = floor.points_box
            xPnt = floorBox.SW.x + margin
            yPnt = floorBox.SW.y + margin
            origin = aecPoint(xPnt, yPnt)
            xSize = abs((floorBox.SE.x - margin) - xPnt)
            ySize = abs((floorBox.NW.y - margin) - yPnt)
            points = self.__shaper.makeL(origin=origin,
                                         xSize=xSize,
                                         ySize=ySize,
                                         xWidth=self.width,
                                         yDepth=self.width)
            if not points: raise Exception
            self.__space.boundary = points
            self.space.rotate(rotate)
            return self.space.fitWithin(floor.points_floor)
        except ValueError:
            print(self.__dimensionError)
            return False
        except Exception:
            traceback.print_exc()
            return False

    def makeT(self,
              floor: aecSpace,
              margin: float = 0.0,
              rotate: float = 0.0) -> bool:
        """
        Sets the corridor to an T shape within the specified
        margin of the delivered floor's bounding box.
        Returns True on success.
        Returns False on Failure.
        """
        try:
            if self.width >= floor.size_x or \
               self.width >= floor.size_y:
                raise ValueError
            self.space.height = floor.height - 0.25
            self.space.level = floor.level
            floorBox = floor.points_box
            xPnt = floorBox.SW.x + margin
            yPnt = floorBox.SW.y + margin
            origin = aecPoint(xPnt, yPnt)
            xSize = abs((floorBox.SE.x - margin) - xPnt)
            ySize = abs((floorBox.NW.y - margin) - yPnt)
            points = self.__shaper.makeT(origin=origin,
                                         xSize=xSize,
                                         ySize=ySize,
                                         xWidth=self.width,
                                         yDepth=self.width)
            if not points: raise Exception
            self.__space.boundary = points
            self.space.rotate(rotate)
            return self.space.fitWithin(floor.points_floor)
        except ValueError:
            print(self.__dimensionError)
            return False
        except Exception:
            traceback.print_exc()
            return False

    def makeU(self,
              floor: aecSpace,
              margin: float = 0.0,
              rotate: float = 0.0) -> bool:
        """
        Sets the corridor to a U shape within the specified
        margin of the delivered floor's bounding box.
        Returns True on success.
        Returns False on Failure.
        """
        try:
            if (self.width * 2) >= floor.size_x or \
                self.width >= floor.size_y:
                raise ValueError
            self.space.height = floor.height - 0.25
            self.space.level = floor.level
            floorBox = floor.points_box
            xPnt = floorBox.SW.x + margin
            yPnt = floorBox.SW.y + margin
            origin = aecPoint(xPnt, yPnt)
            xSize = abs((floorBox.SE.x - margin) - xPnt)
            ySize = abs((floorBox.NW.y - margin) - yPnt)
            points = self.__shaper.makeU(origin=origin,
                                         xSize=xSize,
                                         ySize=ySize,
                                         xWidth1=self.width,
                                         xWidth2=self.width,
                                         yDepth=self.width)
            if not points: raise Exception
            self.__space.boundary = points
            self.space.rotate(rotate)
            return self.space.fitWithin(floor.points_floor)
        except ValueError:
            print(self.__dimensionError)
            return False
        except Exception:
            traceback.print_exc()
            return False

    def makeX(self,
              floor: aecSpace,
              margin: float = 0.0,
              rotate: float = 0.0) -> bool:
        """
        Sets the corridor to a cross shape within the
        margin of the delivered floor's bounding box.
        Returns True on success.
        Returns False on Failure.
        """
        try:
            if self.width >= floor.size_x or \
               self.width >= floor.size_y:
                raise ValueError
            self.space.height = floor.height - 0.25
            self.space.level = floor.level
            floorBox = floor.points_box
            xPnt = floorBox.SW.x + margin
            yPnt = floorBox.SW.y + margin
            origin = aecPoint(xPnt, yPnt)
            xSize = abs((floorBox.SE.x - margin) - xPnt)
            ySize = abs((floorBox.NW.y - margin) - yPnt)
            points = self.__shaper.makeCross(origin=origin,
                                             xSize=xSize,
                                             ySize=ySize,
                                             xWidth=self.width,
                                             yDepth=self.width)
            if not points: raise Exception
            self.space.boundary = points
            self.space.rotate(rotate)
            return self.space.fitWithin(floor.points_floor)
        except ValueError:
            print(self.__dimensionError)
            return False
        except Exception:
            traceback.print_exc()
            return False
Esempio n. 13
0
def aecSpaceRandomTowers():
    """
    Constructs a series of tower space distibution examples from a 
    combination of fixed and randomly set values and floor divisions.
    """
    origin = aecPoint(0, 0, 0)
    displace = 175
    spacer = aecSpacer()
    shaper = aecShaper()
    
    def full(point, xWidth, yDepth, zHeight, level):
        floor = aecSpace()
        floor.boundary = shaper.makeBox(point, xWidth, yDepth)
        floor.height = zHeight
        floor.level = level
        setColors([floor])
        return [floor]
    
    def halfDepth(point, xWidth, yDepth, zHeight, level):
        depth = yDepth * 0.5
        half1 = aecSpace()  
        half1.boundary = shaper.makeBox(point, xWidth, depth)
        half1.height = zHeight
        half1.level = level
        halfSpaces = [half1] + spacer.row(half1, xAxis = False)
        setColors(halfSpaces)
        return halfSpaces
    
    def halfWidth(point, xWidth, yDepth, zHeight, level):
        width = xWidth * 0.5
        half1 = aecSpace()  
        half1.boundary = shaper.makeBox(point, width, yDepth)
        half1.height = zHeight
        half1.level = level
        halfSpaces = [half1] + spacer.row(half1)
        setColors(halfSpaces)
        return halfSpaces
    
    def quarterDepth(point, xWidth, yDepth, zHeight, level):
        if randint(0, 1) == 0:
            depth = yDepth * 0.25
            scale = 3
        else:
            depth = yDepth * 0.75
            scale = 0.333333333       
        half1 = aecSpace()  
        half1.boundary = shaper.makeBox(point, xWidth, depth)
        half1.height = zHeight
        half1.level = level        
        halfSpaces = [half1] + spacer.row(half1, xAxis = False)
        halfSpaces[1].scale(1, scale, 1, halfSpaces[1].points_floor[0])
        setColors(halfSpaces)
        return halfSpaces
    
    def quarterWidth(point, xWidth, yDepth, zHeight, level):
        if randint(0, 1) == 0:
            width = xWidth * 0.25
            scale = 3
        else:
            width = xWidth * 0.75
            scale = 0.333333333       
        half1 = aecSpace()  
        half1.boundary = shaper.makeBox(point, width, yDepth)
        half1.height = zHeight
        half1.level = level        
        halfSpaces = [half1] + spacer.row(half1)
        halfSpaces[1].scale(scale, 1, 1, halfSpaces[1].points_floor[0])
        setColors(halfSpaces)
        return halfSpaces
    
    def setColors(halfSpaces):
        colors = [aecColor.blue, aecColor.orange, aecColor.purple, aecColor.yellow]
        colorPick = randint(0, 3)
        halfSpaces[0].color = colors[colorPick]
        if len(halfSpaces) == 1: return
        colors.reverse()
        halfSpaces[1].color = colors[colorPick]
    
    def makeFloor(point, xWidth, yDepth, zHeight, level):
        floorType = randint(0, 4)
        if floorType == 0: floorSpaces = full(point, xWidth, yDepth, zHeight, level)
        if floorType == 1: floorSpaces = halfDepth(point, xWidth, yDepth, zHeight, level)
        if floorType == 2: floorSpaces = halfWidth(point, xWidth, yDepth, zHeight, level)
        if floorType == 3: floorSpaces = quarterDepth(point, xWidth, yDepth, zHeight, level)
        if floorType == 4: floorSpaces = quarterWidth(point, xWidth, yDepth, zHeight, level)
        return floorSpaces
    
    def makeCore(point, xWidth, yDepth, zHeight): 
        xCoord = (point.x - 5) + (xWidth * 0.5)
        yCoord = (point.y + (yDepth * (randint(0, 9) * 0.1)))
        point = aecPoint(xCoord, yCoord, point.z)
        core = aecSpace()
        core.boundary = shaper.makeBox(point, 10, 20)
        core.height = zHeight
        core.color = aecColor.gray
        return [core]
    
    def makeTower(point):
        floors = []
        xWidth = uniform(20, 60)
        yDepth = uniform(20, 60)
        levels = randint(5, 50)
        zHeight = uniform(3, 6)
        plinth = aecSpace()
        plinth.boundary = shaper.makeBox(point, xWidth, yDepth)
        plinthScaleX = (uniform(1, 2.5))
        plinthScaleY = (uniform(1, 2.5))
        plinth.scale(plinthScaleX, plinthScaleY, 2, plinth.centroid_floor)
        plinth.height = (zHeight * 2)
        plinth.color = aecColor.green
        floors.append(plinth)
        floors = floors + makeCore(point, xWidth, yDepth, zHeight * (levels + 3))
        level = (zHeight * 2)
        x = 0
        while x < levels:
            floors = floors + makeFloor(point, xWidth, yDepth, zHeight, level)
            level += zHeight
            x += 1       
        return floors
        
    def makeTowerRow(point, columns, displacement):
        towers = []
        towers = towers + makeTower(point)
        x = 0
        while x < columns:
            point.x += displacement
            towers = towers + makeTower(point)
            x += 1
        return towers
    
    def makeTowerRows(point, displacement, columns, rows):
        towers = []
        x = 0
        while x < rows:
            towers = towers + makeTowerRow(point, columns, displacement)
            point.x = 0
            point.y += displacement
            x += 1
        return towers
        
    return makeTowerRows(origin, displace, 4, 5)
Esempio n. 14
0
class aecFloor():
    """
    Represents the spatial configuration of a single floor.
    """
    __dimensionError = "Critical corridor dimension exceeds floor boundary."
    __minSpace = 1000
    __geometry = aecGeometry()
    __shaper = aecShaper()
    __spacer = aecSpacer()

    __slots__ = \
    [
        '__corridor',
        '__floor',
        '__rooms'
    ]

    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

    @property
    def corridor(self) -> aecSpace:
        """
        Returns the corridor space..
        Returns None on failure.
        """
        try:
            return self.__corridor
        except Exception:
            traceback.print_exc()
            return None

    @property
    def floor(self) -> aecSpace:
        """
        Returns the floor space..
        Returns None on failure.
        """
        try:
            return self.__floor
        except Exception:
            traceback.print_exc()
            return None

    @property
    def rooms(self) -> aecSpaceGroup:
        """
        Returns the spaceGroup containing all the occupiable spaces.
        Returns None on failure.
        """
        try:
            return self.__rooms
        except Exception:
            traceback.print_exc()
            return None

    def makeI(self,
              offset: float = 0,
              rotation: float = 0,
              roomsWest: int = 2,
              roomsEast: int = 2,
              roomsNorth: int = 0,
              roomsNorthSize: float = 3000,
              roomsSouth: int = 0,
              roomsSouthSize: float = 3000) -> bool:
        """
        Sets the corridor to a centered box shape within the specified
        north and south margins of the delivered floor's bounding box.
        Populates the perimeter of the cooridor with the specified
        number of rooms in each compass quadrant and records the 
        list of room spaces in anticlockwise order, starting either
        from the southwestern room (if it exists) or the southeastern room.
        Returns None on Failure.
        """
        try:
            # Copy the incomming floor to avoid changing the original

            floor = self.__spacer.copy(self.floor)

            # Test and perform initial rotation.

            rotate = 0
            if abs(rotation) <= aecGeometry.pi * 2:
                rotation = aecGeometry.toDegrees(rotation)
            if rotation < 0: rotate = abs(rotation)
            if rotation > 0: rotate = 0.0 - rotation
            if rotate != 0: floor.rotate(rotate)
            if self.corridor.width >= floor.size_x: raise ValueError

            # Test proposed room quantities for feasibility

            roomsWest = abs(int(roomsWest))
            roomsEast = abs(int(roomsEast))
            roomsNorth = abs(int(roomsNorth))
            roomsSouth = abs(int(roomsSouth))
            if roomsNorth <= 0:
                roomsNorth = 0
                roomsNorthSize = 0
            if roomsSouth <= 0:
                roomsSouth = 0
                roomsSouthSize = 0
            if roomsNorth > 2: roomsNorth = 2
            if roomsSouth > 2: roomsSouth = 2
            if roomsNorth > 0 and roomsNorthSize < self.__minSpace:
                roomsNorthSize = self.__minSpace
            if roomsSouth > 0 and roomsSouthSize < self.__minSpace:
                roomsSouthSize = self.__minSpace
            if floor.size_y <= (roomsNorthSize + roomsSouthSize):
                raise ValueError

            # Determine corridor origin

            floorBox = floor.points_box
            xPnt = self.__geometry.getMidpoint(
                floorBox.SW, floorBox.SE).x - (self.corridor.width * 0.5)
            xMin = floorBox.SW.x
            xMax = floorBox.SE.x - (self.corridor.width + self.__minSpace)
            xPnt += offset
            if xPnt < xMin: xPnt = xMin
            if xPnt > xMax: xPnt = xMax
            if xPnt == xMin: roomsWest = 0
            if xPnt == xMax: roomsEast = 0
            yPnt = floorBox.SW.y
            if roomsSouth > 0: yPnt += roomsSouthSize

            # Create the corridor

            self.corridor.space.level = floor.level
            origin = aecPoint(xPnt, yPnt)
            if roomsNorth > 0:
                ySize = abs((floorBox.NW.y - roomsNorthSize) - yPnt)
            else:
                ySize = abs(floorBox.NW.y - yPnt)
            points = self.__shaper.makeBox(origin=origin,
                                           xSize=self.corridor.width,
                                           ySize=ySize)
            if not points: raise Exception
            self.corridor.space.boundary = points
            if not self.corridor.space.fitWithin(floor.points_floor):
                return None

            # Create the Western rooms

            westRooms = None
            if roomsWest > 0:
                xRoom = abs(origin.x - floorBox.SW.x)
                yRoom = ySize / roomsWest
                xPnt = floorBox.SW.x
                yPnt = origin.y
                oRoom = aecPoint(xPnt, yPnt)
                points = self.__shaper.makeBox(origin=oRoom,
                                               xSize=xRoom,
                                               ySize=yRoom)
                if not points: raise Exception
                room = aecSpace()
                room.boundary = points
                westRooms = [room] + self.__spacer.place(
                    room, roomsWest - 1, y=yRoom)
                westRooms.reverse()

            # Create the Eastern rooms

            eastRooms = None
            if roomsEast > 0:
                xRoom = abs(floorBox.SE.x - (origin.x + self.corridor.width))
                yRoom = ySize / roomsEast
                xPnt = origin.x + self.corridor.width
                oRoom = aecPoint(xPnt, yPnt)
                points = self.__shaper.makeBox(origin=oRoom,
                                               xSize=xRoom,
                                               ySize=yRoom)
                if not points: raise Exception
                room = aecSpace()
                room.boundary = points
                eastRooms = [room] + self.__spacer.place(
                    room, roomsEast - 1, y=yRoom)

            # Create the North rooms

            northRooms = None
            if roomsNorth > 0:
                xPnt = floorBox.NW.x
                yPnt = floorBox.NW.y - roomsNorthSize
                oRoom = aecPoint(xPnt, yPnt)
                xRoom = abs(floorBox.NE.x - floorBox.NW.x)
                yRoom = roomsNorthSize
                if roomsNorth == 2: xRoom *= 0.5
                points = self.__shaper.makeBox(origin=oRoom,
                                               xSize=xRoom,
                                               ySize=yRoom)
                if not points: raise Exception
                room = aecSpace()
                room.boundary = points
                northRooms = []
                northRooms.append(room)
                if roomsNorth == 2:
                    northRooms.append(self.__spacer.copy(room, x=xRoom))
                    northRooms.reverse()

            # Create the South rooms

            southRooms = None
            if roomsSouth > 0:
                xPnt = floorBox.SW.x
                yPnt = floorBox.SW.y
                oRoom = aecPoint(xPnt, yPnt)
                xRoom = abs(floorBox.NE.x - floorBox.NW.x)
                yRoom = roomsSouthSize
                if roomsSouth == 2: xRoom *= 0.5
                points = self.__shaper.makeBox(origin=oRoom,
                                               xSize=xRoom,
                                               ySize=yRoom)
                if not points: raise Exception
                room = aecSpace()
                room.boundary = points
                southRooms = []
                southRooms.append(room)
                if roomsSouth == 2:
                    southRooms.append(self.__spacer.copy(room, x=xRoom))

            # Create list of all rooms

            testRooms = []
            if southRooms: testRooms += southRooms
            if eastRooms: testRooms += eastRooms
            if northRooms: testRooms += northRooms
            if westRooms: testRooms += westRooms

            # Test all rooms for inclusion in floor boundary and corridor adjacency

            finalRooms = []
            index = 0
            while index < len(testRooms):
                if not self.__geometry.areAdjacent(testRooms[index].points_floor,
                                                   self.corridor.space.points_floor) or \
                                                   testRooms[index].area < self.__minSpace:
                    testRooms[(index + 1) % len(testRooms)].add(
                        testRooms[index].points_floor)
                index += 1
            for room in testRooms:
                if room.fitWithin(floor.points_floor) and \
                self.__geometry.areAdjacent(room.points_floor, self.corridor.space.points_floor) and \
                room.area >= self.__minSpace:
                    finalRooms.append(room)
            self.rooms.clear
            self.rooms.add(finalRooms)

            # Complete corridor rotation

            if rotation != 0:
                self.corridor.space.rotate(rotation, floor.center_floor)
                self.rooms.rotate(rotation, floor.center_floor)
            return True
        except ValueError:
            print(self.__dimensionError)
            if rotate != 0: floor.rotate(rotate)
            return None
        except Exception:
            traceback.print_exc()
            return None
Esempio n. 15
0
def makeTowerDucts(stories: int = 5, mostRooms: int = 4, routing = 0, useColor=0):
    model = glTF()
    spaces = MakeSpaceTower.makeSpaceTower(stories, mostRooms)

    alpha = 0.2
    reflect = 0.1
    colorAqua = model.add_material(0.302, 0.722, 0.392, alpha, reflect, "Aqua")
    colorBlue = model.add_material(0.0, 0.631, 0.945, alpha, reflect, "Blue")
    colorCyan = model.add_material(0.275, 0.941, 0.941, alpha, reflect, "Cyan")
    colorGranite = model.add_material(0.235, 0.235, 0.235, alpha, reflect, "Gray")
    colorGray = model.add_material(0.5, 0.5, 0.5, 1.0, 0.2, "Gray")
    colorGreen = model.add_material(0.486, 0.733, 0.0, alpha, reflect, "Green")
    colorOrange = model.add_material(0.964, 0.325, 0.078, alpha, reflect, "Orange")
    colorSand = model.add_material(1.0, 0.843, 0.376, alpha, reflect, "Sand") 
    colorTeal = model.add_material(0.0, 0.502, 0.502, alpha, reflect, "Teal")  
    colorYellow = model.add_material(1.0, 0.733, 0.0, alpha, reflect, "Yellow")

    loads = space_cfm_calc.Space_CFM_Calc(spaces)
    ductSpecs = pathing.minSpanningPath.GetDuctPathFromBldg(loads)
    mini = min([x["cfm"] for x in ductSpecs])
    maxi = max([x["cfm"] for x in ductSpecs])
    numcolors = 12
    hmColors = []

    xCoord = 13000
    yCoord = 74000
    point = aecPoint(xCoord, yCoord, 0)
    shaper = aecShaper()
    stack = aecSpace()
    stack.boundary = shaper.makeBox(point, 4000, 3000)
    stack.color = aecColor.gray
    stack.level = 8500
    stack.height = ((stories - 2) * 3500) + 8000
    spaces += [stack]
    
    xCoord = 10000
    yCoord = 65000
    point = aecPoint(xCoord, yCoord, 0)
    mech = aecSpace()
    mech.boundary = shaper.makeBox(point, 10000, 15000)
    mech.color = aecColor.gray
    mech.level = ((stories - 1) * 3500) + 11000
    mech.height = 4000
    spaces += [mech]    
    
    for space in spaces:
        spaceMesh = space.mesh_graphic
        if space.color.color == aecColor.aqua: color = colorAqua
        if space.color.color == aecColor.blue: color = colorBlue
        if space.color.color == aecColor.cyan: color = colorCyan
        if space.color.color == aecColor.gray: color = colorGray 
        if space.color.color == aecColor.granite: color = colorGranite
        if space.color.color == aecColor.green: color = colorGreen
        if space.color.color == aecColor.orange: color = colorOrange
        if space.color.color == aecColor.sand: color = colorSand
        if space.color.color == aecColor.teal: color = colorTeal
        if space.color.color == aecColor.yellow: color = colorYellow
        model.add_triangle_mesh(spaceMesh.vertices, spaceMesh.normals, spaceMesh.indices, color)   

    for i in range(numcolors):
        dI = i * (maxi-mini)/numcolors
        r,g,b = heatmap.convert_to_rgb(mini, maxi, dI)
        hmColors.append(model.add_material(r/255,g/255,b/255,1.0,1.0,"HM"+str(i)))
    for ductSpec in ductSpecs:
        start = aecPoint(ductSpec['start'][0], ductSpec['start'][1], ductSpec['start'][2])
        end = aecPoint(ductSpec['end'][0], ductSpec['end'][1], ductSpec['end'][2])
        chosenColor = math.floor(12-ductSpec['cfm'] / (maxi-mini) * 12 )
        duct = MakeDuct.makeDuct(start, end, ductSpec['width'], ductSpec['height'])
        ductMesh = duct.mesh_graphic
        if useColor == 1:
            model.add_triangle_mesh(ductMesh.vertices, ductMesh.normals, ductMesh.indices, hmColors[ chosenColor-1])   
        else:
            model.add_triangle_mesh(ductMesh.vertices, ductMesh.normals, ductMesh.indices, colorGray)   

#   return {"model": model.save_base64()}   
    model.save_glb('model.glb')
Esempio n. 16
0
def makeTower(bldgWidth: float = 20,
              bldgDepth: float = 20,
              floorHeight: float = 3,
              bldgLevels: int = 10,
              plinthScale: float = 1.1):
    """
    Constructs a series of tower space distibution examples from a 
    combination of fixed and randomly set values and floor divisions.
    """
    spacer = aecSpacer()
    shaper = aecShaper()

    def full(point, xWidth, yDepth, zHeight, level):
        floor = aecSpace()
        floor.boundary = shaper.makeBox(point, xWidth, yDepth)
        floor.height = zHeight
        floor.level = level
        setColors([floor])
        return [floor]

    def halfDepth(point, xWidth, yDepth, zHeight, level):
        depth = yDepth * 0.5
        half1 = aecSpace()
        half1.boundary = shaper.makeBox(point, xWidth, depth)
        half1.height = zHeight
        half1.level = level
        halfSpaces = [half1] + spacer.row(half1, xAxis=False)
        setColors(halfSpaces)
        return halfSpaces

    def halfWidth(point, xWidth, yDepth, zHeight, level):
        width = xWidth * 0.5
        half1 = aecSpace()
        half1.boundary = shaper.makeBox(point, width, yDepth)
        half1.height = zHeight
        half1.level = level
        halfSpaces = [half1] + spacer.row(half1)
        setColors(halfSpaces)
        return halfSpaces

    def quarterDepth(point, xWidth, yDepth, zHeight, level):
        if randint(0, 1) == 0:
            depth = yDepth * 0.25
            scale = 3
        else:
            depth = yDepth * 0.75
            scale = 0.333333333
        half1 = aecSpace()
        half1.boundary = shaper.makeBox(point, xWidth, depth)
        half1.height = zHeight
        half1.level = level
        halfSpaces = [half1] + spacer.row(half1, xAxis=False)
        halfSpaces[1].scale(1, scale, 1, halfSpaces[1].points_floor[0])
        setColors(halfSpaces)
        return halfSpaces

    def quarterWidth(point, xWidth, yDepth, zHeight, level):
        if randint(0, 1) == 0:
            width = xWidth * 0.25
            scale = 3
        else:
            width = xWidth * 0.75
            scale = 0.333333333
        half1 = aecSpace()
        half1.boundary = shaper.makeBox(point, width, yDepth)
        half1.height = zHeight
        half1.level = level
        halfSpaces = [half1] + spacer.row(half1)
        halfSpaces[1].scale(scale, 1, 1, halfSpaces[1].points_floor[0])
        setColors(halfSpaces)
        return halfSpaces

    def setColors(halfSpaces):
        colors = [
            aecColor.blue, aecColor.orange, aecColor.purple, aecColor.yellow
        ]
        colorPick = randint(0, 3)
        halfSpaces[0].color = colors[colorPick]
        if len(halfSpaces) == 1: return
        colors.reverse()
        halfSpaces[1].color = colors[colorPick]

    def makeFloor(point, xWidth, yDepth, zHeight, level):
        floorType = randint(0, 4)
        if floorType == 0:
            floorSpaces = full(point, xWidth, yDepth, zHeight, level)
        if floorType == 1:
            floorSpaces = halfDepth(point, xWidth, yDepth, zHeight, level)
        if floorType == 2:
            floorSpaces = halfWidth(point, xWidth, yDepth, zHeight, level)
        if floorType == 3:
            floorSpaces = quarterDepth(point, xWidth, yDepth, zHeight, level)
        if floorType == 4:
            floorSpaces = quarterWidth(point, xWidth, yDepth, zHeight, level)
        return floorSpaces

    def makeCore(point, xWidth, yDepth, zHeight):
        xCoord = (point.x - 5) + (xWidth * 0.5)
        yCoord = (point.y + (yDepth * (randint(0, 9) * 0.1)))
        point = aecPoint(xCoord, yCoord, point.z)
        core = aecSpace()
        core.boundary = shaper.makeBox(point, 10, 20)
        core.height = zHeight
        core.color = aecColor.gray
        return core

    plinth = aecSpace()
    point = aecPoint()
    plinth.boundary = shaper.makeBox(point, bldgWidth, bldgDepth)
    plinth.scale(plinthScale, plinthScale, 2, plinth.centroid_floor)
    plinth.height = (floorHeight * 2)
    plinth.color = aecColor.green
    core = makeCore(point, bldgWidth, bldgDepth,
                    floorHeight * (bldgLevels + 3))
    level = (floorHeight * 2)
    x = 0
    floors = []
    while x < bldgLevels:
        floors = floors + makeFloor(point, bldgWidth, bldgDepth, floorHeight,
                                    level)
        level += floorHeight
        x += 1
    model = glTF()
    colorBlue = model.add_material(0.0, 0.631, 0.945, 0.9, 0.8, "Blue")
    colorGray = model.add_material(0.5, 0.5, 0.5, 0.9, 0.8, "Gray")
    colorGreen = model.add_material(0.486, 0.733, 0.0, 0.9, 0.8, "Green")
    colorOrange = model.add_material(0.964, 0.325, 0.078, 0.9, 0.8, "Orange")
    colorPurple = model.add_material(0.75, 0.07, 1.0, 0.9, 0.8, "Purple")
    colorYellow = model.add_material(1.0, 0.733, 0.0, 0.9, 0.8, "Yellow")
    mesh = core.mesh_graphic
    model.add_triangle_mesh(mesh.vertices, mesh.normals, mesh.indices,
                            colorGray)
    mesh = plinth.mesh_graphic
    model.add_triangle_mesh(mesh.vertices, mesh.normals, mesh.indices,
                            colorGreen)
    area = 0
    levels = 0
    for space in floors:
        area += space.area
        levels += 1
        spaceMesh = space.mesh_graphic
        colorIndex = randint(0, 3)
        if colorIndex == 0: color = colorBlue
        if colorIndex == 1: color = colorOrange
        if colorIndex == 2: color = colorPurple
        if colorIndex == 3: color = colorYellow
        model.add_triangle_mesh(spaceMesh.vertices, spaceMesh.normals,
                                spaceMesh.indices, color)
    return {
        "model": model.save_base64(),
        'computed': {
            'floors': levels,
            'area': area
        }
    }
Esempio n. 17
0
from hypar import glTF
from random import randint, uniform
from typing import List

from aecSpace.aecPoint import aecPoint
from aecSpace.aecShaper import aecShaper
from aecSpace.aecSpace import aecSpace
from aecSpace.aecSpaceGroup import aecSpaceGroup
from aecSpace.aecSpacer import aecSpacer

spacer = aecSpacer()
shaper = aecShaper()

model = glTF()
colorAqua = model.add_material(0.3, 0.72, 0.392, 1.0, 0.8, "Aqua")
colorBlue = model.add_material(0.0, 0.631, 0.945, 1.0, 0.8, "Blue")
colorBrown = model.add_material(0.5, 0.2, 0.0, 1.0, 0.5, "Brown")
colorGray = model.add_material(0.5, 0.5, 0.5, 1.0, 0.8, "Gray")
colorGranite = model.add_material(0.25, 0.25, 0.25, 1.0, 0.8, "Granite")
colorGreen = model.add_material(0.486, 0.733, 0.0, 1.0, 0.8, "Green")
colorOrange = model.add_material(0.964, 0.325, 0.078, 1.0, 0.8, "Orange")
colorPurple = model.add_material(0.75, 0.07, 1.0, 1.0, 0.8, "Purple")
colorSand = model.add_material(1.0, 0.843, 0.376, 1.0, 0.8, "Sand") 
colorSilver = model.add_material(0.75, 0.75, 0.75, 1.0, 1.0, "Silver")
colorWhite = model.add_material(1.0, 1.0, 1.0, 1.0, 0.8, "White")
colorYellow = model.add_material(1.0, 0.733, 0.0, 1.0, 0.8, "Yellow")

def getColor(color: int = 0):
    if color == 0: return colorAqua
    if color == 1: return colorBlue
    if color == 2: return colorBrown
Esempio n. 18
0
class aecCorridor():
    """
    Represents architectural corridors of various configurations.
    """
    __dimensionError = "Critical corridor dimension exceeds floor boundary."
    __minPersons = 3
    __minWidth = 1700
    __personWidth = 570
    __geometry = aecGeometry()
    __shaper = aecShaper()
    __spacer = aecSpacer()

    # Defines a series of constants indicating corridor types.

    Cross, Equatorial, H, L, Polar, T, U = range(0, 7)

    __slots__ = \
    [
        '__corridor',
        '__persons',
        '__space',
        '__width'
    ]

    def __init__(self,
                 corridor: int = 1,
                 origin: aecPoint = aecPoint(),
                 xSize: float = 1700,
                 ySize: float = 1700,
                 persons: int = 3):
        """
        Constructor by default creates an Equatorial corridor.       
        """
        self.__corridor = self.Equatorial
        self.__persons = self.__minPersons
        self.__width = self.__minWidth
        if persons > 3:
            self.__persons = persons = int(persons)
            persons -= self.__minPersons
            self.__width += (persons * self.__minWidth)
        self.__space = aecSpace()

    @property
    def persons(self) -> int:
        """
        Returns the capacity of the corridor as the quantity of 
        persons who can pass along its length simultaneously.
        Returns None on failure.
        """
        try:
            return self.__passage
        except Exception:
            traceback.print_exc()
            return None

    @persons.setter
    def persons(self, value: int = 3) -> int:
        """
        Sets the capacity of the corridor as the quantity of 
        persons who can pass along its length simultaneously.
        Returns None on failure.
        """
        try:
            value = abs(int(value))
            if value < self.__minPersons: value = self.__minPersons
            self.__persons = value
            if value > self.__minPersons: value -= self.__minPersons
            self.__width = self.__minWidth + (self.__personWidth * value)
        except Exception:
            traceback.print_exc()

    @property
    def space(self) -> aecSpace:
        """
        Returns the aecSpace object.
        Returns None on failure.
        """
        try:
            return self.__space
        except Exception:
            traceback.print_exc()
            return None

    @property
    def width(self) -> float:
        """
        Returns the corridor width.
        Returns None on failure.
        """
        try:
            return self.__width
        except Exception:
            traceback.print_exc()
            return None

    def makeCross(self,
                  floor: aecSpace,
                  margin: float = 0.0,
                  rotate: float = 0.0) -> bool:
        """
        Sets the corridor to a cross shape within the
        margin of the delivered floor's bounding box.
        Returns True on success.
        Returns False on Failure.
        """
        try:
            if self.width >= floor.size_x or \
               self.width >= floor.size_y:
                raise ValueError
            self.space.height = floor.height - 0.25
            self.space.level = floor.level
            floorBox = floor.points_box
            xPnt = floorBox.SW.x + margin
            yPnt = floorBox.SW.y + margin
            origin = aecPoint(xPnt, yPnt)
            xSize = abs((floorBox.SE.x - margin) - xPnt)
            ySize = abs((floorBox.NW.y - margin) - yPnt)
            points = self.__shaper.makeCross(origin=origin,
                                             xSize=xSize,
                                             ySize=ySize,
                                             xWidth=self.width,
                                             yDepth=self.width)
            if not points: raise Exception
            self.space.boundary = points
            self.space.rotate(rotate)
            return self.space.fitWithin(floor.points_floor)
        except ValueError:
            print(self.__dimensionError)
            return False
        except Exception:
            traceback.print_exc()
            return False

    def makeEquatorial(self,
                       floor: aecSpace,
                       marginWest: float = 0.0,
                       marginEast: float = 0.0,
                       rotate: float = 0.0) -> bool:
        """
        Sets the corridor to an vertically centered box shape within
        the specified margin of the delivered floor's bounding box.
        Returns True on success.
        Returns False on Failure.
        """
        try:
            if self.width >= floor.size_y: raise ValueError
            self.space.height = floor.height - 0.25
            self.space.level = floor.level
            floorBox = floor.points_box
            xPnt = floorBox.SW.x + marginWest
            yPnt = self.__geometry.getMidpoint(
                floorBox.SW, floorBox.NW).y - (self.__width * 0.5)
            origin = aecPoint(xPnt, yPnt)
            xSize = abs((floorBox.SE.x - marginEast) - xPnt)
            points = self.__shaper.makeBox(origin=origin,
                                           xSize=xSize,
                                           ySize=self.width)
            if not points: raise Exception
            self.space.boundary = points
            self.space.rotate(rotate)
            return self.space.fitWithin(floor.points_floor)
        except ValueError:
            print(self.__dimensionError)
            return False
        except Exception:
            traceback.print_exc()
            return False

    def makeH(self,
              floor: aecSpace,
              margin: float = 0.0,
              rotate: float = 0.0) -> bool:
        """
        Sets the corridor to an H shape within the specified
        margin of the delivered floor's bounding box.
        Returns True on success.
        Returns False on Failure.
        """
        try:
            if (self.width * 2) >= floor.size_x or \
                self.width >= floor.size_y:
                raise ValueError
            self.space.height = floor.height - 0.25
            self.space.level = floor.level
            floorBox = floor.points_box
            xPnt = floorBox.SW.x + margin
            yPnt = floorBox.SW.y + margin
            origin = aecPoint(xPnt, yPnt)
            xSize = abs((floorBox.SE.x - margin) - xPnt)
            ySize = abs((floorBox.NW.y - margin) - yPnt)
            points = self.__shaper.makeH(origin=origin,
                                         xSize=xSize,
                                         ySize=ySize,
                                         xWidth1=self.width,
                                         xWidth2=self.width,
                                         yDepth=self.width)
            if not points: raise Exception
            self.__space.boundary = points
            self.space.rotate(rotate)
            return self.space.fitWithin(floor.points_floor)
        except ValueError:
            print(self.__dimensionError)
            return False
        except Exception:
            traceback.print_exc()
            return False

    def makeL(self,
              floor: aecSpace,
              margin: float = 0.0,
              rotate: float = 0.0) -> bool:
        """
        Sets the corridor to an L shape within the specified
        margin of the delivered floor's bounding box.
        Returns True on success.
        Returns False on Failure.
        """
        try:
            if self.width >= floor.size_x or \
               self.width >= floor.size_y:
                raise ValueError
            self.space.height = floor.height - 0.25
            self.space.level = floor.level
            floorBox = floor.points_box
            xPnt = floorBox.SW.x + margin
            yPnt = floorBox.SW.y + margin
            origin = aecPoint(xPnt, yPnt)
            xSize = abs((floorBox.SE.x - margin) - xPnt)
            ySize = abs((floorBox.NW.y - margin) - yPnt)
            points = self.__shaper.makeL(origin=origin,
                                         xSize=xSize,
                                         ySize=ySize,
                                         xWidth=self.width,
                                         yDepth=self.width)
            if not points: raise Exception
            self.__space.boundary = points
            self.space.rotate(rotate)
            return self.space.fitWithin(floor.points_floor)
        except ValueError:
            print(self.__dimensionError)
            return False
        except Exception:
            traceback.print_exc()
            return False

    def makePolar(self,
                  floor: aecSpace,
                  roomsWest: int = 2,
                  roomsEast: int = 2,
                  roomsNorth: int = 0,
                  roomsNorthSize: float = 3000,
                  roomsSouth: int = 0,
                  roomsSouthSize: float = 3000) -> bool:
        """
        Sets the corridor to a horizontally centered box shape within
        the specified margin of the delivered floor's bounding box.
        Populates the perimeter of the cooridor with the specified
        number of rooms in each compass quadrant and returns the 
        list of room spaces in anticlockwise order, starting either
        from the southwestern room (if it exists) or the southeastern room.
        Returns None on Failure.
        """
        try:
            if self.width >= floor.size_x: raise ValueError
            roomsWest = abs(int(roomsWest))
            roomsEast = abs(int(roomsEast))
            if roomsWest < 1: roomsWest = 1
            if roomsEast < 1: roomsEast = 1
            roomsNorth = abs(int(roomsNorth))
            roomsSouth = abs(int(roomsSouth))
            if roomsNorth <= 0:
                roomsNorth = 0
                roomsNorthSize = 0
            if roomsSouth <= 0:
                roomsSouth = 0
                roomsSouthSize = 0
            if roomsNorth > 2: roomsNorth = 2
            if roomsSouth > 2: roomsSouth = 2
            if roomsNorth > 0 and roomsNorthSize < 1000: roomsNorthSize = 1000
            if roomsSouth > 0 and roomsSouthSize < 1000: roomsSouthSize = 1000
            if floor.size_y <= (roomsNorthSize + roomsSouthSize):
                raise ValueError
            self.space.level = floor.level
            floorBox = floor.points_box
            xPnt = self.__geometry.getMidpoint(
                floorBox.SW, floorBox.SE).x - (self.width * 0.5)
            yPnt = floorBox.SW.y
            if roomsSouth: yPnt += roomsSouthSize
            origin = aecPoint(xPnt, yPnt)
            if roomsNorth > 0:
                ySize = abs((floorBox.NW.y - roomsNorthSize) - yPnt)
            else:
                ySize = abs(floorBox.NW.y - yPnt)
            points = self.__shaper.makeBox(origin=origin,
                                           xSize=self.width,
                                           ySize=ySize)
            if not points: raise Exception
            self.space.boundary = points
            if not self.space.fitWithin(floor.points_floor): return False
            xRoom = abs(origin.x - floorBox.SW.x)
            yRoom = ySize / roomsWest
            xPnt = floorBox.SW.x
            yPnt = origin.y
            oRoom = aecPoint(xPnt, yPnt)
            points = self.__shaper.makeBox(origin=oRoom,
                                           xSize=xRoom,
                                           ySize=yRoom)
            room = aecSpace()
            room.boundary = points
            westRooms = [room] + self.__spacer.place(
                room, roomsWest - 1, y=yRoom)
            westRooms.reverse()
            xRoom = abs(floorBox.SE.x - (origin.x + self.width))
            yRoom = ySize / roomsEast
            xPnt = origin.x + self.width
            oRoom = aecPoint(xPnt, yPnt)
            points = self.__shaper.makeBox(origin=oRoom,
                                           xSize=xRoom,
                                           ySize=yRoom)
            room = aecSpace()
            room.boundary = points
            eastRooms = [room] + self.__spacer.place(
                room, roomsEast - 1, y=yRoom)
            rooms = []
            if roomsNorth > 0:
                xPnt = floorBox.NW.x
                yPnt = floorBox.NW.y - roomsNorthSize
                oRoom = aecPoint(xPnt, yPnt)
                xRoom = abs(floorBox.NE.x - floorBox.NW.x)
                yRoom = roomsNorthSize
                if roomsNorth == 2: xRoom *= 0.5
                points = self.__shaper.makeBox(origin=oRoom,
                                               xSize=xRoom,
                                               ySize=yRoom)
                room = aecSpace()
                room.boundary = points
                northRooms = []
                northRooms.append(room)
                if roomsNorth == 2:
                    northRooms.append(self.__spacer.copy(room, x=xRoom))
                    northRooms.reverse()
            if roomsSouth > 0:
                xPnt = floorBox.SW.x
                yPnt = floorBox.SW.y
                oRoom = aecPoint(xPnt, yPnt)
                xRoom = abs(floorBox.NE.x - floorBox.NW.x)
                yRoom = roomsSouthSize
                if roomsSouth == 2: xRoom *= 0.5
                points = self.__shaper.makeBox(origin=oRoom,
                                               xSize=xRoom,
                                               ySize=yRoom)
                room = aecSpace()
                room.boundary = points
                southRooms = []
                southRooms.append(room)
                if roomsSouth == 2:
                    southRooms.append(self.__spacer.copy(room, x=xRoom))
                rooms = southRooms
            rooms += eastRooms
            if roomsNorth: rooms += northRooms
            rooms += westRooms
            for room in rooms:
                room.fitWithin(floor.points_floor)
            return rooms
        except ValueError:
            print(self.__dimensionError)
            return None
        except Exception:
            traceback.print_exc()
            return None

    def makeT(self,
              floor: aecSpace,
              margin: float = 0.0,
              rotate: float = 0.0) -> bool:
        """
        Sets the corridor to an T shape within the specified
        margin of the delivered floor's bounding box.
        Returns True on success.
        Returns False on Failure.
        """
        try:
            if self.width >= floor.size_x or \
               self.width >= floor.size_y:
                raise ValueError
            self.space.height = floor.height - 0.25
            self.space.level = floor.level
            floorBox = floor.points_box
            xPnt = floorBox.SW.x + margin
            yPnt = floorBox.SW.y + margin
            origin = aecPoint(xPnt, yPnt)
            xSize = abs((floorBox.SE.x - margin) - xPnt)
            ySize = abs((floorBox.NW.y - margin) - yPnt)
            points = self.__shaper.makeT(origin=origin,
                                         xSize=xSize,
                                         ySize=ySize,
                                         xWidth=self.width,
                                         yDepth=self.width)
            if not points: raise Exception
            self.__space.boundary = points
            self.space.rotate(rotate)
            return self.space.fitWithin(floor.points_floor)
        except ValueError:
            print(self.__dimensionError)
            return False
        except Exception:
            traceback.print_exc()
            return False

    def makeU(self,
              floor: aecSpace,
              margin: float = 0.0,
              rotate: float = 0.0) -> bool:
        """
        Sets the corridor to a U shape within the specified
        margin of the delivered floor's bounding box.
        Returns True on success.
        Returns False on Failure.
        """
        try:
            if (self.width * 2) >= floor.size_x or \
                self.width >= floor.size_y:
                raise ValueError
            self.space.height = floor.height - 0.25
            self.space.level = floor.level
            floorBox = floor.points_box
            xPnt = floorBox.SW.x + margin
            yPnt = floorBox.SW.y + margin
            origin = aecPoint(xPnt, yPnt)
            xSize = abs((floorBox.SE.x - margin) - xPnt)
            ySize = abs((floorBox.NW.y - margin) - yPnt)
            points = self.__shaper.makeU(origin=origin,
                                         xSize=xSize,
                                         ySize=ySize,
                                         xWidth1=self.width,
                                         xWidth2=self.width,
                                         yDepth=self.width)
            if not points: raise Exception
            self.__space.boundary = points
            self.space.rotate(rotate)
            return self.space.fitWithin(floor.points_floor)
        except ValueError:
            print(self.__dimensionError)
            return False
        except Exception:
            traceback.print_exc()
            return False